| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Quit immediately if Chrome is restarting. | 130 // Quit immediately if Chrome is restarting. |
| 131 if (g_browser_process->local_state()->GetBoolean( | 131 if (g_browser_process->local_state()->GetBoolean( |
| 132 prefs::kRestartLastSessionOnShutdown)) { | 132 prefs::kRestartLastSessionOnShutdown)) { |
| 133 return true; | 133 return true; |
| 134 } | 134 } |
| 135 | 135 |
| 136 if (hosted_app_quit_notification_) { | 136 if (hosted_app_quit_notification_) { |
| 137 bool hosted_apps_open = false; | 137 bool hosted_apps_open = false; |
| 138 const BrowserList* browser_list = | 138 for (Browser* browser : *BrowserList::GetInstance()) { |
| 139 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE); | |
| 140 for (Browser* browser : *browser_list) { | |
| 141 if (!browser->is_app()) | 139 if (!browser->is_app()) |
| 142 continue; | 140 continue; |
| 143 | 141 |
| 144 ExtensionRegistry* registry = ExtensionRegistry::Get(browser->profile()); | 142 ExtensionRegistry* registry = ExtensionRegistry::Get(browser->profile()); |
| 145 const extensions::Extension* extension = registry->GetExtensionById( | 143 const extensions::Extension* extension = registry->GetExtensionById( |
| 146 web_app::GetExtensionIdFromApplicationName(browser->app_name()), | 144 web_app::GetExtensionIdFromApplicationName(browser->app_name()), |
| 147 ExtensionRegistry::ENABLED); | 145 ExtensionRegistry::ENABLED); |
| 148 if (extension->is_hosted_app()) { | 146 if (extension->is_hosted_app()) { |
| 149 hosted_apps_open = true; | 147 hosted_apps_open = true; |
| 150 break; | 148 break; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 193 |
| 196 // Always return false, the notification UI can be used to quit all apps which | 194 // Always return false, the notification UI can be used to quit all apps which |
| 197 // will cause Chrome to quit. | 195 // will cause Chrome to quit. |
| 198 return false; | 196 return false; |
| 199 } | 197 } |
| 200 | 198 |
| 201 // static | 199 // static |
| 202 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) { | 200 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) { |
| 203 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true); | 201 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true); |
| 204 } | 202 } |
| OLD | NEW |