This commit is contained in:
Daniel Pham 2016-02-19 12:40:41 -05:00
Π ΠΎΠ΄ΠΈΡ‚Π΅Π»ΡŒ 5839d7dcd5
ΠšΠΎΠΌΠΌΠΈΡ‚ eaac67ac60
4 ΠΈΠ·ΠΌΠ΅Π½Ρ‘Π½Π½Ρ‹Ρ… Ρ„Π°ΠΉΠ»ΠΎΠ²: 13 Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠΉ ΠΈ 0 ΡƒΠ΄Π°Π»Π΅Π½ΠΈΠΉ

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -370,6 +370,7 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
.SetMethod("hide", base::Bind(&Browser::Hide, browser)) .SetMethod("hide", base::Bind(&Browser::Hide, browser))
.SetMethod("show", base::Bind(&Browser::Show, browser)) .SetMethod("show", base::Bind(&Browser::Show, browser))
.SetMethod("isDarkModeEnabled", base::Bind(&Browser::IsDarkModeEnabled, browser))
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
.SetMethod("setUserTasks", .SetMethod("setUserTasks",

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -83,6 +83,9 @@ class Browser : public WindowListObserver {
// Show the application. // Show the application.
void Show(); void Show();
// Check if Dark Mode enabled.
bool IsDarkModeEnabled();
// Bounce the dock icon. // Bounce the dock icon.
enum BounceType { enum BounceType {
BOUNCE_CRITICAL = 0, BOUNCE_CRITICAL = 0,

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -26,6 +26,11 @@ void Browser::Show() {
[[AtomApplication sharedApplication] unhide:nil]; [[AtomApplication sharedApplication] unhide:nil];
} }
bool Browser::IsDarkModeEnabled() {
NSString *mode = CFBridgingRelease(CFPreferencesCopyValue((CFStringRef)@"AppleInterfaceStyle", kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost));
return [mode isEqualToString: @"Dark"];
}
void Browser::AddRecentDocument(const base::FilePath& path) { void Browser::AddRecentDocument(const base::FilePath& path) {
NSString* path_string = base::mac::FilePathToNSString(path); NSString* path_string = base::mac::FilePathToNSString(path);
if (!path_string) if (!path_string)

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -461,6 +461,10 @@ if (browserOptions.transparent) {
} }
``` ```
### `app.isDarkModeEnabled()` _OS X_
This method returns `true` if Dark Mode is enabled, and `false` otherwise.
### `app.commandLine.appendSwitch(switch[, value])` ### `app.commandLine.appendSwitch(switch[, value])`
Append a switch (with optional `value`) to Chromium's command line. Append a switch (with optional `value`) to Chromium's command line.