Rename dark-mode-changed to platform-theme-changed
This commit is contained in:
parent
b1eefbdcd9
commit
63294892f0
7 changed files with 12 additions and 11 deletions
|
@ -283,8 +283,8 @@ void App::OnGpuProcessCrashed(base::TerminationStatus exit_code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void App::OnDarkModeChanged() {
|
void App::OnPlatformThemeChanged() {
|
||||||
Emit("dark-mode-changed");
|
Emit("platform-theme-changed");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class App : public AtomBrowserClient::Delegate,
|
||||||
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
|
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void OnDarkModeChanged() override;
|
void OnPlatformThemeChanged() override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// mate::Wrappable:
|
// mate::Wrappable:
|
||||||
|
|
|
@ -181,8 +181,8 @@ void Browser::OnWindowAllClosed() {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
|
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::DarkModeChanged() {
|
void Browser::PlatformThemeChanged() {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnDarkModeChanged());
|
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnPlatformThemeChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -145,7 +145,8 @@ class Browser : public WindowListObserver {
|
||||||
// Request basic auth login.
|
// Request basic auth login.
|
||||||
void RequestLogin(LoginHandler* login_handler);
|
void RequestLogin(LoginHandler* login_handler);
|
||||||
|
|
||||||
void DarkModeChanged();
|
// Tell the application that plaform's theme changed.
|
||||||
|
void PlatformThemeChanged();
|
||||||
|
|
||||||
void AddObserver(BrowserObserver* obs) {
|
void AddObserver(BrowserObserver* obs) {
|
||||||
observers_.AddObserver(obs);
|
observers_.AddObserver(obs);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class BrowserObserver {
|
||||||
// The browser requests HTTP login.
|
// The browser requests HTTP login.
|
||||||
virtual void OnLogin(LoginHandler* login_handler) {}
|
virtual void OnLogin(LoginHandler* login_handler) {}
|
||||||
|
|
||||||
virtual void OnDarkModeChanged() {}
|
virtual void OnPlatformThemeChanged() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~BrowserObserver() {}
|
virtual ~BrowserObserver() {}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
|
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
|
||||||
|
|
||||||
// Add observer to monitor the system's Dark Mode theme.
|
// Add observer to monitor the system's Dark Mode theme.
|
||||||
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(darkModeChanged:) name:@"AppleInterfaceThemeChangedNotification" object:nil];
|
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(platformThemeChanged:) name:@"AppleInterfaceThemeChangedNotification" object:nil];
|
||||||
|
|
||||||
atom::Browser::Get()->WillFinishLaunching();
|
atom::Browser::Get()->WillFinishLaunching();
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,8 @@
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)darkModeChanged:(NSNotification *)notify {
|
- (void)platformThemeChanged:(NSNotification *)notify {
|
||||||
atom::Browser::Get()->DarkModeChanged();
|
atom::Browser::Get()->PlatformThemeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -228,7 +228,7 @@ app.on('login', function(event, webContents, request, authInfo, callback) {
|
||||||
|
|
||||||
Emitted when the gpu process crashes.
|
Emitted when the gpu process crashes.
|
||||||
|
|
||||||
### Event: 'dark-mode-changed' _OS X_
|
### Event: 'platform-theme-changed' _OS X_
|
||||||
|
|
||||||
Emitted when the system's Dark Mode theme is toggled.
|
Emitted when the system's Dark Mode theme is toggled.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue