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

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

Issue 800473006: Don't include hidden windows in IsAppWindowRegisteredInAnyProfile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 11 months 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 web_app::GetExtensionIdFromApplicationName(browser->app_name()), 144 web_app::GetExtensionIdFromApplicationName(browser->app_name()),
145 ExtensionRegistry::ENABLED); 145 ExtensionRegistry::ENABLED);
146 if (extension->is_hosted_app()) { 146 if (extension->is_hosted_app()) {
147 hosted_apps_open = true; 147 hosted_apps_open = true;
148 break; 148 break;
149 } 149 }
150 } 150 }
151 151
152 // Quit immediately if there are no packaged app windows or hosted apps open 152 // Quit immediately if there are no packaged app windows or hosted apps open
153 // or the confirmation has been suppressed. Ignore panels. 153 // or the confirmation has been suppressed. Ignore panels.
154 if (!AppWindowRegistryUtil::IsAppWindowRegisteredInAnyProfile( 154 if (!AppWindowRegistryUtil::IsAppWindowVisibleInAnyProfile(
155 extensions::AppWindow::WINDOW_TYPE_DEFAULT) && 155 extensions::AppWindow::WINDOW_TYPE_DEFAULT) &&
156 !hosted_apps_open) { 156 !hosted_apps_open) {
157 return true; 157 return true;
158 } 158 }
159 } else { 159 } else {
160 // Quit immediately if there are no windows or the confirmation has been 160 // Quit immediately if there are no windows or the confirmation has been
161 // suppressed. 161 // suppressed.
162 if (!AppWindowRegistryUtil::IsAppWindowRegisteredInAnyProfile( 162 if (!AppWindowRegistryUtil::IsAppWindowVisibleInAnyProfile(
163 extensions::AppWindow::WINDOW_TYPE_DEFAULT)) 163 extensions::AppWindow::WINDOW_TYPE_DEFAULT))
164 return true; 164 return true;
165 } 165 }
166 166
167 // If there are browser windows, and this notification has been suppressed for 167 // If there are browser windows, and this notification has been suppressed for
168 // this session or permanently, then just return false to prevent Chrome from 168 // this session or permanently, then just return false to prevent Chrome from
169 // quitting. If there are no browser windows, or Chrome is restarting, always 169 // quitting. If there are no browser windows, or Chrome is restarting, always
170 // show the notification. 170 // show the notification.
171 bool is_restart = g_browser_process->local_state()->GetBoolean( 171 bool is_restart = g_browser_process->local_state()->GetBoolean(
172 prefs::kRestartLastSessionOnShutdown); 172 prefs::kRestartLastSessionOnShutdown);
(...skipping 24 matching lines...) Expand all
197 197
198 // Always return false, the notification UI can be used to quit all apps which 198 // Always return false, the notification UI can be used to quit all apps which
199 // will cause Chrome to quit. 199 // will cause Chrome to quit.
200 return false; 200 return false;
201 } 201 }
202 202
203 // static 203 // static
204 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) { 204 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) {
205 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true); 205 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true);
206 } 206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698