OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h" | 5 #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void QuitWithAppsController::ButtonClick(int button_index) { | 86 void QuitWithAppsController::ButtonClick(int button_index) { |
87 g_browser_process->notification_ui_manager()->CancelById(id()); | 87 g_browser_process->notification_ui_manager()->CancelById(id()); |
88 if (button_index == kQuitAllAppsButtonIndex) { | 88 if (button_index == kQuitAllAppsButtonIndex) { |
89 extensions::AppWindowRegistry::CloseAllAppWindows(); | 89 extensions::AppWindowRegistry::CloseAllAppWindows(); |
90 } else if (button_index == kDontShowAgainButtonIndex) { | 90 } else if (button_index == kDontShowAgainButtonIndex) { |
91 g_browser_process->local_state()->SetBoolean( | 91 g_browser_process->local_state()->SetBoolean( |
92 prefs::kNotifyWhenAppsKeepChromeAlive, false); | 92 prefs::kNotifyWhenAppsKeepChromeAlive, false); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 content::WebContents* QuitWithAppsController::GetWebContents() const { | |
97 return NULL; | |
98 } | |
99 | |
100 std::string QuitWithAppsController::id() const { | 96 std::string QuitWithAppsController::id() const { |
101 return kQuitWithAppsNotificationID; | 97 return kQuitWithAppsNotificationID; |
102 } | 98 } |
103 | 99 |
104 bool QuitWithAppsController::ShouldQuit() { | 100 bool QuitWithAppsController::ShouldQuit() { |
105 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 101 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
106 | 102 |
107 // Quit immediately if this is a test. | 103 // Quit immediately if this is a test. |
108 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType) && | 104 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType) && |
109 !CommandLine::ForCurrentProcess()->HasSwitch( | 105 !CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 29 matching lines...) Expand all Loading... |
139 | 135 |
140 // Always return false, the notification UI can be used to quit all apps which | 136 // Always return false, the notification UI can be used to quit all apps which |
141 // will cause Chrome to quit. | 137 // will cause Chrome to quit. |
142 return false; | 138 return false; |
143 } | 139 } |
144 | 140 |
145 // static | 141 // static |
146 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) { | 142 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) { |
147 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true); | 143 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true); |
148 } | 144 } |
OLD | NEW |