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 22 matching lines...) Expand all Loading... |
33 #include "chrome/browser/sessions/session_service_factory.h" | 33 #include "chrome/browser/sessions/session_service_factory.h" |
34 #include "chrome/browser/sessions/tab_restore_service.h" | 34 #include "chrome/browser/sessions/tab_restore_service.h" |
35 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 35 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
36 #include "chrome/browser/sync/profile_sync_service.h" | 36 #include "chrome/browser/sync/profile_sync_service.h" |
37 #include "chrome/browser/sync/sync_ui_util.h" | 37 #include "chrome/browser/sync/sync_ui_util.h" |
38 #include "chrome/browser/sync/sync_ui_util_mac.h" | 38 #include "chrome/browser/sync/sync_ui_util_mac.h" |
39 #include "chrome/browser/ui/browser.h" | 39 #include "chrome/browser/ui/browser.h" |
40 #include "chrome/browser/ui/browser_list.h" | 40 #include "chrome/browser/ui/browser_list.h" |
41 #include "chrome/browser/ui/browser_window.h" | 41 #include "chrome/browser/ui/browser_window.h" |
42 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 42 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
43 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | |
44 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" | 43 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" |
45 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 44 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
46 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 45 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
47 #import "chrome/browser/ui/cocoa/confirm_quit.h" | 46 #import "chrome/browser/ui/cocoa/confirm_quit.h" |
48 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" | 47 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" |
49 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" | 48 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" |
50 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" | 49 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" |
51 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" | 50 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" |
52 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 51 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
53 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 52 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 if (flag && command_line.HasSwitch(switches::kAppId)) | 992 if (flag && command_line.HasSwitch(switches::kAppId)) |
994 return YES; | 993 return YES; |
995 | 994 |
996 // Otherwise open a new window. | 995 // Otherwise open a new window. |
997 { | 996 { |
998 AutoReset<bool> auto_reset_in_run(&g_is_opening_new_window, true); | 997 AutoReset<bool> auto_reset_in_run(&g_is_opening_new_window, true); |
999 int return_code; | 998 int return_code; |
1000 StartupBrowserCreator browser_creator; | 999 StartupBrowserCreator browser_creator; |
1001 browser_creator.LaunchBrowser( | 1000 browser_creator.LaunchBrowser( |
1002 command_line, [self lastProfile], FilePath(), | 1001 command_line, [self lastProfile], FilePath(), |
1003 browser::startup::IS_NOT_PROCESS_STARTUP, | 1002 StartupBrowserCreator::IS_NOT_PROCESS_STARTUP, |
1004 browser::startup::IS_NOT_FIRST_RUN, &return_code); | 1003 StartupBrowserCreator::IS_NOT_FIRST_RUN, &return_code); |
1005 } | 1004 } |
1006 | 1005 |
1007 // We've handled the reopen event, so return NO to tell AppKit not | 1006 // We've handled the reopen event, so return NO to tell AppKit not |
1008 // to do anything. | 1007 // to do anything. |
1009 return NO; | 1008 return NO; |
1010 } | 1009 } |
1011 | 1010 |
1012 - (void)initMenuState { | 1011 - (void)initMenuState { |
1013 menuState_.reset(new CommandUpdater(NULL)); | 1012 menuState_.reset(new CommandUpdater(NULL)); |
1014 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true); | 1013 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 } | 1098 } |
1100 | 1099 |
1101 Browser* browser = BrowserList::GetLastActive(); | 1100 Browser* browser = BrowserList::GetLastActive(); |
1102 // if no browser window exists then create one with no tabs to be filled in | 1101 // if no browser window exists then create one with no tabs to be filled in |
1103 if (!browser) { | 1102 if (!browser) { |
1104 browser = Browser::Create([self lastProfile]); | 1103 browser = Browser::Create([self lastProfile]); |
1105 browser->window()->Show(); | 1104 browser->window()->Show(); |
1106 } | 1105 } |
1107 | 1106 |
1108 CommandLine dummy(CommandLine::NO_PROGRAM); | 1107 CommandLine dummy(CommandLine::NO_PROGRAM); |
1109 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 1108 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
1110 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; | 1109 StartupBrowserCreator::IS_FIRST_RUN : |
1111 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); | 1110 StartupBrowserCreator::IS_NOT_FIRST_RUN; |
| 1111 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run); |
1112 launch.OpenURLsInBrowser(browser, false, urls); | 1112 launch.OpenURLsInBrowser(browser, false, urls); |
1113 } | 1113 } |
1114 | 1114 |
1115 - (void)getUrl:(NSAppleEventDescriptor*)event | 1115 - (void)getUrl:(NSAppleEventDescriptor*)event |
1116 withReply:(NSAppleEventDescriptor*)reply { | 1116 withReply:(NSAppleEventDescriptor*)reply { |
1117 NSString* urlStr = [[event paramDescriptorForKeyword:keyDirectObject] | 1117 NSString* urlStr = [[event paramDescriptorForKeyword:keyDirectObject] |
1118 stringValue]; | 1118 stringValue]; |
1119 | 1119 |
1120 GURL gurl(base::SysNSStringToUTF8(urlStr)); | 1120 GURL gurl(base::SysNSStringToUTF8(urlStr)); |
1121 std::vector<GURL> gurlVector; | 1121 std::vector<GURL> gurlVector; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 | 1316 |
1317 } // namespace browser | 1317 } // namespace browser |
1318 | 1318 |
1319 namespace app_controller_mac { | 1319 namespace app_controller_mac { |
1320 | 1320 |
1321 bool IsOpeningNewWindow() { | 1321 bool IsOpeningNewWindow() { |
1322 return g_is_opening_new_window; | 1322 return g_is_opening_new_window; |
1323 } | 1323 } |
1324 | 1324 |
1325 } // namespace app_controller_mac | 1325 } // namespace app_controller_mac |
OLD | NEW |