OLD | NEW |
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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/sessions/session_service.h" | 34 #include "chrome/browser/sessions/session_service.h" |
35 #include "chrome/browser/sessions/session_service_factory.h" | 35 #include "chrome/browser/sessions/session_service_factory.h" |
36 #include "chrome/browser/sessions/tab_restore_service.h" | 36 #include "chrome/browser/sessions/tab_restore_service.h" |
37 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 37 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
38 #include "chrome/browser/sync/profile_sync_service.h" | 38 #include "chrome/browser/sync/profile_sync_service.h" |
39 #include "chrome/browser/sync/sync_ui_util.h" | 39 #include "chrome/browser/sync/sync_ui_util.h" |
40 #include "chrome/browser/ui/browser.h" | 40 #include "chrome/browser/ui/browser.h" |
41 #include "chrome/browser/ui/browser_command_controller.h" | 41 #include "chrome/browser/ui/browser_command_controller.h" |
42 #include "chrome/browser/ui/browser_commands.h" | 42 #include "chrome/browser/ui/browser_commands.h" |
43 #include "chrome/browser/ui/browser_finder.h" | 43 #include "chrome/browser/ui/browser_finder.h" |
| 44 #include "chrome/browser/ui/browser_iterator.h" |
44 #include "chrome/browser/ui/browser_list.h" | 45 #include "chrome/browser/ui/browser_list.h" |
45 #include "chrome/browser/ui/browser_mac.h" | 46 #include "chrome/browser/ui/browser_mac.h" |
46 #include "chrome/browser/ui/browser_window.h" | 47 #include "chrome/browser/ui/browser_window.h" |
47 #include "chrome/browser/ui/chrome_pages.h" | 48 #include "chrome/browser/ui/chrome_pages.h" |
48 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" | 49 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" |
49 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 50 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
50 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 51 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
51 #import "chrome/browser/ui/cocoa/confirm_quit.h" | 52 #import "chrome/browser/ui/cocoa/confirm_quit.h" |
52 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" | 53 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" |
53 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" | 54 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 // to prevent AppKit from doing anything. | 978 // to prevent AppKit from doing anything. |
978 // TODO(rohitrao): Remove this code when http://crbug.com/40861 is resolved. | 979 // TODO(rohitrao): Remove this code when http://crbug.com/40861 is resolved. |
979 if (browser_shutdown::IsTryingToQuit()) | 980 if (browser_shutdown::IsTryingToQuit()) |
980 return NO; | 981 return NO; |
981 | 982 |
982 // Don't do anything if there are visible tabbed or popup windows. This will | 983 // Don't do anything if there are visible tabbed or popup windows. This will |
983 // cause AppKit to unminimize the most recently minimized window. If the | 984 // cause AppKit to unminimize the most recently minimized window. If the |
984 // visible windows are panels or notifications, we still need to open a new | 985 // visible windows are panels or notifications, we still need to open a new |
985 // window. | 986 // window. |
986 if (flag) { | 987 if (flag) { |
987 for (BrowserList::const_iterator iter = BrowserList::begin(); | 988 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { |
988 iter != BrowserList::end(); ++iter) { | |
989 Browser* browser = *iter; | 989 Browser* browser = *iter; |
990 if (browser->is_type_tabbed() || browser->is_type_popup()) | 990 if (browser->is_type_tabbed() || browser->is_type_popup()) |
991 return YES; | 991 return YES; |
992 } | 992 } |
993 } | 993 } |
994 | 994 |
995 // If launched as a hidden login item (due to installation of a persistent app | 995 // If launched as a hidden login item (due to installation of a persistent app |
996 // or by the user, for example in System Preferences->Accounts->Login Items), | 996 // or by the user, for example in System Preferences->Accounts->Login Items), |
997 // allow session to be restored first time the user clicks on a Dock icon. | 997 // allow session to be restored first time the user clicks on a Dock icon. |
998 // Normally, it'd just open a new empty page. | 998 // Normally, it'd just open a new empty page. |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 | 1352 |
1353 //--------------------------------------------------------------------------- | 1353 //--------------------------------------------------------------------------- |
1354 | 1354 |
1355 namespace app_controller_mac { | 1355 namespace app_controller_mac { |
1356 | 1356 |
1357 bool IsOpeningNewWindow() { | 1357 bool IsOpeningNewWindow() { |
1358 return g_is_opening_new_window; | 1358 return g_is_opening_new_window; |
1359 } | 1359 } |
1360 | 1360 |
1361 } // namespace app_controller_mac | 1361 } // namespace app_controller_mac |
OLD | NEW |