From 63294892f0be54713a2104646291a7e1a6eddb94 Mon Sep 17 00:00:00 2001 From: Daniel Pham Date: Thu, 3 Mar 2016 23:58:58 -0500 Subject: [PATCH] Rename dark-mode-changed to platform-theme-changed --- atom/browser/api/atom_api_app.cc | 4 ++-- atom/browser/api/atom_api_app.h | 2 +- atom/browser/browser.cc | 4 ++-- atom/browser/browser.h | 3 ++- atom/browser/browser_observer.h | 2 +- atom/browser/mac/atom_application_delegate.mm | 6 +++--- docs/api/app.md | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 76a5f32a2450..fc1afb6d35c4 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -283,8 +283,8 @@ void App::OnGpuProcessCrashed(base::TerminationStatus exit_code) { } #if defined(OS_MACOSX) -void App::OnDarkModeChanged() { - Emit("dark-mode-changed"); +void App::OnPlatformThemeChanged() { + Emit("platform-theme-changed"); } #endif diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index 54d3f9dc7433..3d4ac17adf75 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -72,7 +72,7 @@ class App : public AtomBrowserClient::Delegate, void OnGpuProcessCrashed(base::TerminationStatus exit_code) override; #if defined(OS_MACOSX) - void OnDarkModeChanged() override; + void OnPlatformThemeChanged() override; #endif // mate::Wrappable: diff --git a/atom/browser/browser.cc b/atom/browser/browser.cc index 7fbe01633b0c..e89f52283b3c 100644 --- a/atom/browser/browser.cc +++ b/atom/browser/browser.cc @@ -181,8 +181,8 @@ void Browser::OnWindowAllClosed() { FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed()); } -void Browser::DarkModeChanged() { - FOR_EACH_OBSERVER(BrowserObserver, observers_, OnDarkModeChanged()); +void Browser::PlatformThemeChanged() { + FOR_EACH_OBSERVER(BrowserObserver, observers_, OnPlatformThemeChanged()); } } // namespace atom diff --git a/atom/browser/browser.h b/atom/browser/browser.h index 04b7a7257875..8ea523700270 100644 --- a/atom/browser/browser.h +++ b/atom/browser/browser.h @@ -145,7 +145,8 @@ class Browser : public WindowListObserver { // Request basic auth login. void RequestLogin(LoginHandler* login_handler); - void DarkModeChanged(); + // Tell the application that plaform's theme changed. + void PlatformThemeChanged(); void AddObserver(BrowserObserver* obs) { observers_.AddObserver(obs); diff --git a/atom/browser/browser_observer.h b/atom/browser/browser_observer.h index 0577712becd0..da327eb90a02 100644 --- a/atom/browser/browser_observer.h +++ b/atom/browser/browser_observer.h @@ -45,7 +45,7 @@ class BrowserObserver { // The browser requests HTTP login. virtual void OnLogin(LoginHandler* login_handler) {} - virtual void OnDarkModeChanged() {} + virtual void OnPlatformThemeChanged() {} protected: virtual ~BrowserObserver() {} diff --git a/atom/browser/mac/atom_application_delegate.mm b/atom/browser/mac/atom_application_delegate.mm index 0b9c60e7d261..f4db929bf575 100644 --- a/atom/browser/mac/atom_application_delegate.mm +++ b/atom/browser/mac/atom_application_delegate.mm @@ -25,7 +25,7 @@ [[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]; + [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(platformThemeChanged:) name:@"AppleInterfaceThemeChangedNotification" object:nil]; atom::Browser::Get()->WillFinishLaunching(); } @@ -62,8 +62,8 @@ return flag; } -- (void)darkModeChanged:(NSNotification *)notify { - atom::Browser::Get()->DarkModeChanged(); +- (void)platformThemeChanged:(NSNotification *)notify { + atom::Browser::Get()->PlatformThemeChanged(); } @end diff --git a/docs/api/app.md b/docs/api/app.md index 3469c6b108d5..8cc9c6e37477 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -228,7 +228,7 @@ app.on('login', function(event, webContents, request, authInfo, callback) { 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.