Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Side by Side Diff: chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 const int kQuitAllAppsButtonIndex = 0; 41 const int kQuitAllAppsButtonIndex = 0;
42 const int kDontShowAgainButtonIndex = 1; 42 const int kDontShowAgainButtonIndex = 1;
43 43
44 const char QuitWithAppsController::kQuitWithAppsNotificationID[] = 44 const char QuitWithAppsController::kQuitWithAppsNotificationID[] =
45 "quit-with-apps"; 45 "quit-with-apps";
46 46
47 QuitWithAppsController::QuitWithAppsController() 47 QuitWithAppsController::QuitWithAppsController()
48 : notification_profile_(NULL), suppress_for_session_(false) { 48 : notification_profile_(NULL), suppress_for_session_(false) {
49 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 49 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
50 50
51 hosted_app_quit_notification_ = CommandLine::ForCurrentProcess()->HasSwitch( 51 hosted_app_quit_notification_ =
52 switches::kHostedAppQuitNotification); 52 base::CommandLine::ForCurrentProcess()->HasSwitch(
53 switches::kHostedAppQuitNotification);
53 54
54 // There is only ever one notification to replace, so use the same replace_id 55 // There is only ever one notification to replace, so use the same replace_id
55 // each time. 56 // each time.
56 base::string16 replace_id = base::UTF8ToUTF16(id()); 57 base::string16 replace_id = base::UTF8ToUTF16(id());
57 58
58 message_center::ButtonInfo quit_apps_button_info( 59 message_center::ButtonInfo quit_apps_button_info(
59 l10n_util::GetStringUTF16(IDS_QUIT_WITH_APPS_QUIT_LABEL)); 60 l10n_util::GetStringUTF16(IDS_QUIT_WITH_APPS_QUIT_LABEL));
60 message_center::RichNotificationData rich_notification_data; 61 message_center::RichNotificationData rich_notification_data;
61 rich_notification_data.buttons.push_back(quit_apps_button_info); 62 rich_notification_data.buttons.push_back(quit_apps_button_info);
62 if (!hosted_app_quit_notification_) { 63 if (!hosted_app_quit_notification_) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 118 }
118 119
119 std::string QuitWithAppsController::id() const { 120 std::string QuitWithAppsController::id() const {
120 return kQuitWithAppsNotificationID; 121 return kQuitWithAppsNotificationID;
121 } 122 }
122 123
123 bool QuitWithAppsController::ShouldQuit() { 124 bool QuitWithAppsController::ShouldQuit() {
124 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 125 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
125 126
126 // Quit immediately if this is a test. 127 // Quit immediately if this is a test.
127 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType) && 128 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType) &&
128 !CommandLine::ForCurrentProcess()->HasSwitch( 129 !base::CommandLine::ForCurrentProcess()->HasSwitch(
129 switches::kAppsKeepChromeAliveInTests)) { 130 switches::kAppsKeepChromeAliveInTests)) {
130 return true; 131 return true;
131 } 132 }
132 133
133 if (hosted_app_quit_notification_) { 134 if (hosted_app_quit_notification_) {
134 bool hosted_apps_open = false; 135 bool hosted_apps_open = false;
135 const BrowserList* browser_list = 136 const BrowserList* browser_list =
136 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE); 137 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE);
137 for (Browser* browser : *browser_list) { 138 for (Browser* browser : *browser_list) {
138 if (!browser->is_app()) 139 if (!browser->is_app())
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 195
195 // Always return false, the notification UI can be used to quit all apps which 196 // Always return false, the notification UI can be used to quit all apps which
196 // will cause Chrome to quit. 197 // will cause Chrome to quit.
197 return false; 198 return false;
198 } 199 }
199 200
200 // static 201 // static
201 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) { 202 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) {
202 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true); 203 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true);
203 } 204 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698