Deprecate the platform-theme-changed event

This commit is contained in:
Cheng Zhao 2016-04-25 14:34:30 +09:00
parent 9557226223
commit a421c66f3f
7 changed files with 11 additions and 28 deletions

View file

@ -331,12 +331,6 @@ void App::OnGpuProcessCrashed(base::TerminationStatus exit_code) {
Emit("gpu-process-crashed");
}
#if defined(OS_MACOSX)
void App::OnPlatformThemeChanged() {
Emit("platform-theme-changed");
}
#endif
base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
bool succeed = false;
base::FilePath path;

View file

@ -92,10 +92,6 @@ class App : public AtomBrowserClient::Delegate,
// content::GpuDataManagerObserver:
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
#if defined(OS_MACOSX)
void OnPlatformThemeChanged() override;
#endif
private:
// Get/Set the pre-defined path in PathService.
base::FilePath GetPath(mate::Arguments* args, const std::string& name);

View file

@ -187,8 +187,4 @@ void Browser::OnWindowAllClosed() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
}
void Browser::PlatformThemeChanged() {
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnPlatformThemeChanged());
}
} // namespace atom

View file

@ -148,9 +148,6 @@ class Browser : public WindowListObserver {
// Request basic auth login.
void RequestLogin(LoginHandler* login_handler);
// Tell the application that plaform's theme changed.
void PlatformThemeChanged();
void AddObserver(BrowserObserver* obs) {
observers_.AddObserver(obs);
}

View file

@ -45,8 +45,6 @@ class BrowserObserver {
// The browser requests HTTP login.
virtual void OnLogin(LoginHandler* login_handler) {}
virtual void OnPlatformThemeChanged() {}
protected:
virtual ~BrowserObserver() {}
};

View file

@ -24,9 +24,6 @@
// 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(platformThemeChanged:) name:@"AppleInterfaceThemeChangedNotification" object:nil];
atom::Browser::Get()->WillFinishLaunching();
}
@ -62,8 +59,4 @@
return flag;
}
- (void)platformThemeChanged:(NSNotification *)notify {
atom::Browser::Get()->PlatformThemeChanged();
}
@end

View file

@ -91,12 +91,21 @@ deprecate.event(app, 'activate-with-no-open-windows', 'activate', function (even
deprecate.event(app, 'select-certificate', 'select-client-certificate')
if (process.platform === 'win32') {
app.isAeroGlassEnabled = deprecate('app.isAeroGlassEnabled', 'systemPreferences.isAeroGlassEnabled', function () {
return electron.systemPreferences.isAeroGlassEnabled();
return electron.systemPreferences.isAeroGlassEnabled()
})
} else if (process.platform === 'darwin') {
app.isDarkMode = deprecate('app.isDarkMode', 'systemPreferences.isDarkMode', function () {
return electron.systemPreferences.isDarkMode();
return electron.systemPreferences.isDarkMode()
})
app.on = app.addListener = function (event, listener) {
if (event === 'platform-theme-changed') {
deprecate.warn('platform-theme-changed event', "systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', callback)")
electron.systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', function () {
app.emit('platform-theme-changed')
})
}
EventEmitter.prototype.addListener.call(app, event, listener)
}
}
// Wrappers for native classes.