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

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 23737003: Mac: Fix window raising for multiple desktops (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PlatformAppReopenWithWindows test Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import "chrome/browser/app_controller_mac.h" 5 #import "chrome/browser/app_controller_mac.h"
6 6
7 #include "apps/app_shim/extension_app_shim_handler_mac.h" 7 #include "apps/app_shim/extension_app_shim_handler_mac.h"
8 #include "apps/shell_window_registry.h" 8 #include "apps/shell_window_registry.h"
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 hasVisibleWindows:(BOOL)hasVisibleWindows { 1069 hasVisibleWindows:(BOOL)hasVisibleWindows {
1070 // If the browser is currently trying to quit, don't do anything and return NO 1070 // If the browser is currently trying to quit, don't do anything and return NO
1071 // to prevent AppKit from doing anything. 1071 // to prevent AppKit from doing anything.
1072 // TODO(rohitrao): Remove this code when http://crbug.com/40861 is resolved. 1072 // TODO(rohitrao): Remove this code when http://crbug.com/40861 is resolved.
1073 if (browser_shutdown::IsTryingToQuit()) 1073 if (browser_shutdown::IsTryingToQuit())
1074 return NO; 1074 return NO;
1075 1075
1076 // Bring all browser windows to the front. Specifically, this brings them in 1076 // Bring all browser windows to the front. Specifically, this brings them in
1077 // front of any app windows. FocusWindowSet will also unminimize the most 1077 // front of any app windows. FocusWindowSet will also unminimize the most
1078 // recently minimized window if no windows in the set are visible. 1078 // recently minimized window if no windows in the set are visible.
1079 // If there are tabbed or popup windows, return here. Otherwise, the windows 1079 // If there are any, return here. Otherwise, the windows are panels or
1080 // are panels or notifications so we still need to open a new window. 1080 // notifications so we still need to open a new window.
1081 if (hasVisibleWindows) { 1081 if (hasVisibleWindows) {
1082 BOOL foundBrowser = NO;
1083 std::set<NSWindow*> browserWindows; 1082 std::set<NSWindow*> browserWindows;
1084 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { 1083 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) {
1085 Browser* browser = *iter; 1084 Browser* browser = *iter;
1086 browserWindows.insert(browser->window()->GetNativeWindow()); 1085 browserWindows.insert(browser->window()->GetNativeWindow());
1087 if (browser->is_type_tabbed() || browser->is_type_popup())
1088 foundBrowser = YES;
1089 } 1086 }
1090 ui::FocusWindowSet(browserWindows); 1087 if (!browserWindows.empty()) {
1091 if (foundBrowser) 1088 ui::FocusWindowSet(browserWindows);
1092 return YES; 1089 // Return NO; we've done the unminimize, so AppKit shouldn't do
1090 // anything.
1091 return NO;
1092 }
1093 } 1093 }
1094 1094
1095 // If launched as a hidden login item (due to installation of a persistent app 1095 // If launched as a hidden login item (due to installation of a persistent app
1096 // or by the user, for example in System Preferences->Accounts->Login Items), 1096 // or by the user, for example in System Preferences->Accounts->Login Items),
1097 // allow session to be restored first time the user clicks on a Dock icon. 1097 // allow session to be restored first time the user clicks on a Dock icon.
1098 // Normally, it'd just open a new empty page. 1098 // Normally, it'd just open a new empty page.
1099 { 1099 {
1100 static BOOL doneOnce = NO; 1100 static BOOL doneOnce = NO;
1101 if (!doneOnce) { 1101 if (!doneOnce) {
1102 doneOnce = YES; 1102 doneOnce = YES;
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 1423
1424 //--------------------------------------------------------------------------- 1424 //---------------------------------------------------------------------------
1425 1425
1426 namespace app_controller_mac { 1426 namespace app_controller_mac {
1427 1427
1428 bool IsOpeningNewWindow() { 1428 bool IsOpeningNewWindow() {
1429 return g_is_opening_new_window; 1429 return g_is_opening_new_window;
1430 } 1430 }
1431 1431
1432 } // namespace app_controller_mac 1432 } // namespace app_controller_mac
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/app_controller_mac_browsertest.mm » ('j') | ui/base/cocoa/focus_window_set.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698