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

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: Manually switch spaces for app shims 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 hasVisibleWindows:(BOOL)hasVisibleWindows { 1062 hasVisibleWindows:(BOOL)hasVisibleWindows {
1063 // If the browser is currently trying to quit, don't do anything and return NO 1063 // If the browser is currently trying to quit, don't do anything and return NO
1064 // to prevent AppKit from doing anything. 1064 // to prevent AppKit from doing anything.
1065 // TODO(rohitrao): Remove this code when http://crbug.com/40861 is resolved. 1065 // TODO(rohitrao): Remove this code when http://crbug.com/40861 is resolved.
1066 if (browser_shutdown::IsTryingToQuit()) 1066 if (browser_shutdown::IsTryingToQuit())
1067 return NO; 1067 return NO;
1068 1068
1069 // Bring all browser windows to the front. Specifically, this brings them in 1069 // Bring all browser windows to the front. Specifically, this brings them in
1070 // front of any app windows. FocusWindowSet will also unminimize the most 1070 // front of any app windows. FocusWindowSet will also unminimize the most
1071 // recently minimized window if no windows in the set are visible. 1071 // recently minimized window if no windows in the set are visible.
1072 // If there are tabbed or popup windows, return here. Otherwise, the windows 1072 // If there are any, return here. Otherwise, the windows are panels or
1073 // are panels or notifications so we still need to open a new window. 1073 // notifications so we still need to open a new window.
1074 if (hasVisibleWindows) { 1074 if (hasVisibleWindows) {
1075 BOOL foundBrowser = NO;
1076 std::set<NSWindow*> browserWindows; 1075 std::set<NSWindow*> browserWindows;
1077 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { 1076 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) {
1078 Browser* browser = *iter; 1077 Browser* browser = *iter;
1079 browserWindows.insert(browser->window()->GetNativeWindow()); 1078 browserWindows.insert(browser->window()->GetNativeWindow());
1080 if (browser->is_type_tabbed() || browser->is_type_popup())
1081 foundBrowser = YES;
1082 } 1079 }
1083 ui::FocusWindowSet(browserWindows); 1080 if (!browserWindows.empty()) {
1084 if (foundBrowser) 1081 ui::FocusWindowSet(browserWindows, false);
1085 return YES; 1082 // Return NO; we've done the unminimize, so AppKit shouldn't do
1083 // anything.
1084 return NO;
1085 }
1086 } 1086 }
1087 1087
1088 // If launched as a hidden login item (due to installation of a persistent app 1088 // If launched as a hidden login item (due to installation of a persistent app
1089 // or by the user, for example in System Preferences->Accounts->Login Items), 1089 // or by the user, for example in System Preferences->Accounts->Login Items),
1090 // allow session to be restored first time the user clicks on a Dock icon. 1090 // allow session to be restored first time the user clicks on a Dock icon.
1091 // Normally, it'd just open a new empty page. 1091 // Normally, it'd just open a new empty page.
1092 { 1092 {
1093 static BOOL doneOnce = NO; 1093 static BOOL doneOnce = NO;
1094 if (!doneOnce) { 1094 if (!doneOnce) {
1095 doneOnce = YES; 1095 doneOnce = YES;
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 1416
1417 //--------------------------------------------------------------------------- 1417 //---------------------------------------------------------------------------
1418 1418
1419 namespace app_controller_mac { 1419 namespace app_controller_mac {
1420 1420
1421 bool IsOpeningNewWindow() { 1421 bool IsOpeningNewWindow() {
1422 return g_is_opening_new_window; 1422 return g_is_opening_new_window;
1423 } 1423 }
1424 1424
1425 } // namespace app_controller_mac 1425 } // namespace app_controller_mac
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698