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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 // to prevent AppKit from doing anything. | 974 // to prevent AppKit from doing anything. |
974 // TODO(rohitrao): Remove this code when http://crbug.com/40861 is resolved. | 975 // TODO(rohitrao): Remove this code when http://crbug.com/40861 is resolved. |
975 if (browser_shutdown::IsTryingToQuit()) | 976 if (browser_shutdown::IsTryingToQuit()) |
976 return NO; | 977 return NO; |
977 | 978 |
978 // Don't do anything if there are visible tabbed or popup windows. This will | 979 // Don't do anything if there are visible tabbed or popup windows. This will |
979 // cause AppKit to unminimize the most recently minimized window. If the | 980 // cause AppKit to unminimize the most recently minimized window. If the |
980 // visible windows are panels or notifications, we still need to open a new | 981 // visible windows are panels or notifications, we still need to open a new |
981 // window. | 982 // window. |
982 if (flag) { | 983 if (flag) { |
983 for (BrowserList::const_iterator iter = BrowserList::begin(); | 984 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { |
984 iter != BrowserList::end(); ++iter) { | |
985 Browser* browser = *iter; | 985 Browser* browser = *iter; |
986 if (browser->is_type_tabbed() || browser->is_type_popup()) | 986 if (browser->is_type_tabbed() || browser->is_type_popup()) |
987 return YES; | 987 return YES; |
988 } | 988 } |
989 } | 989 } |
990 | 990 |
991 // If launched as a hidden login item (due to installation of a persistent app | 991 // If launched as a hidden login item (due to installation of a persistent app |
992 // or by the user, for example in System Preferences->Accounts->Login Items), | 992 // or by the user, for example in System Preferences->Accounts->Login Items), |
993 // allow session to be restored first time the user clicks on a Dock icon. | 993 // allow session to be restored first time the user clicks on a Dock icon. |
994 // Normally, it'd just open a new empty page. | 994 // Normally, it'd just open a new empty page. |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 | 1347 |
1348 //--------------------------------------------------------------------------- | 1348 //--------------------------------------------------------------------------- |
1349 | 1349 |
1350 namespace app_controller_mac { | 1350 namespace app_controller_mac { |
1351 | 1351 |
1352 bool IsOpeningNewWindow() { | 1352 bool IsOpeningNewWindow() { |
1353 return g_is_opening_new_window; | 1353 return g_is_opening_new_window; |
1354 } | 1354 } |
1355 | 1355 |
1356 } // namespace app_controller_mac | 1356 } // namespace app_controller_mac |
OLD | NEW |