return v8::Undefined();
}
+// static
+v8::Handle<v8::Value> App::GetName(const v8::Arguments &args) {
+ v8::HandleScope scope;
+
+ std::string name(Browser::Get()->GetName());
+
+ return v8::String::New(name.data(), version.size());
+}
+
+// static
+v8::Handle<v8::Value> App::SetName(const v8::Arguments &args) {
+ v8::HandleScope scope;
+
+ std::string name;
+ if (!FromV8Arguments(args, &name))
+ return node::ThrowError("Bad argument");
+
+ Browser::Get()->SetName(name);
+
+ return v8::Undefined();
+}
+
// static
v8::Handle<v8::Value> App::AppendSwitch(const v8::Arguments &args) {
v8::HandleScope scope;
NODE_SET_PROTOTYPE_METHOD(t, "focus", Focus);
NODE_SET_PROTOTYPE_METHOD(t, "getVersion", GetVersion);
NODE_SET_PROTOTYPE_METHOD(t, "setVersion", SetVersion);
+ NODE_SET_PROTOTYPE_METHOD(t, "getName", GetName);
+ NODE_SET_PROTOTYPE_METHOD(t, "setName", SetName);
target->Set(v8::String::NewSymbol("Application"), t->GetFunction());
static v8::Handle<v8::Value> Focus(const v8::Arguments &args);
static v8::Handle<v8::Value> GetVersion(const v8::Arguments &args);
static v8::Handle<v8::Value> SetVersion(const v8::Arguments &args);
+ static v8::Handle<v8::Value> GetName(const v8::Arguments &args);
+ static v8::Handle<v8::Value> SetName(const v8::Arguments &args);
static v8::Handle<v8::Value> AppendSwitch(const v8::Arguments &args);
static v8::Handle<v8::Value> AppendArgument(const v8::Arguments &args);
version_override_ = version;
}
+std::string Browser::GetName() const {
+ return name_override_.empty() ? "Atom-Shell" : name_override_;
+}
+
+void Browser::SetName(const std::string& name) {
+ name_override_ = name;
+}
+
bool Browser::OpenFile(const std::string& file_path) {
bool prevent_default = false;
FOR_EACH_OBSERVER(BrowserObserver,
// Overrides the application version.
void SetVersion(const std::string& version);
+ // Returns the application's name, default is just Atom-Shell.
+ std::string GetName() const;
+
+ // Overrides the application name.
+ void SetName(const std::string& name);
+
#if defined(OS_MACOSX)
// Bounce the dock icon.
enum BounceType {
ObserverList<BrowserObserver> observers_;
std::string version_override_;
+ std::string name_override_;
DISALLOW_COPY_AND_ASSIGN(Browser);
};