Emit("gpu-process-crashed");
}
+#if defined(OS_MACOSX)
+void App::OnDarkModeChanged() {
+ Emit("dark-mode-changed");
+}
+#endif
+
base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
bool succeed = false;
base::FilePath path;
#if defined(OS_MACOSX)
.SetMethod("hide", base::Bind(&Browser::Hide, browser))
.SetMethod("show", base::Bind(&Browser::Show, browser))
- .SetMethod("isDarkModeEnabled", base::Bind(&Browser::IsDarkModeEnabled, browser))
+ .SetMethod("isDarkModeEnabled",
+ base::Bind(&Browser::IsDarkModeEnabled, browser))
#endif
#if defined(OS_WIN)
.SetMethod("setUserTasks",
// content::GpuDataManagerObserver:
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
+#if defined(OS_MACOSX)
+ void OnDarkModeChanged() override;
+#endif
+
// mate::Wrappable:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
}
+void Browser::DarkModeChanged() {
+ FOR_EACH_OBSERVER(BrowserObserver, observers_, OnDarkModeChanged());
+}
+
} // namespace atom
// Request basic auth login.
void RequestLogin(LoginHandler* login_handler);
+ void DarkModeChanged();
+
void AddObserver(BrowserObserver* obs) {
observers_.AddObserver(obs);
}
// The browser requests HTTP login.
virtual void OnLogin(LoginHandler* login_handler) {}
+ virtual void OnDarkModeChanged() {}
+
protected:
virtual ~BrowserObserver() {}
};
// Don't add the "Enter Full Screen" menu item automatically.
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
+ // Add observer to monitor the system's Dark Mode theme.
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(darkModeChanged:) name:@"AppleInterfaceThemeChangedNotification" object:nil];
+
atom::Browser::Get()->WillFinishLaunching();
}
return flag;
}
+- (void)darkModeChanged:(NSNotification *)notify {
+ atom::Browser::Get()->DarkModeChanged();
+}
+
@end
Emitted when the gpu process crashes.
+### Event: 'dark-mode-changed' _OS X_
+
+Emitted when the system's Dark Mode theme is toggled.
+
## Methods
The `app` object has the following methods: