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 "apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" | 62 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" |
63 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 63 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
64 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" | 64 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" |
65 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 65 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
66 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 66 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
67 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 67 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
68 #include "chrome/browser/ui/extensions/application_launch.h" | 68 #include "chrome/browser/ui/extensions/application_launch.h" |
69 #include "chrome/browser/ui/host_desktop.h" | 69 #include "chrome/browser/ui/host_desktop.h" |
70 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 70 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
71 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 71 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
| 72 #include "chrome/browser/ui/user_manager.h" |
72 #include "chrome/common/chrome_paths_internal.h" | 73 #include "chrome/common/chrome_paths_internal.h" |
73 #include "chrome/common/chrome_switches.h" | 74 #include "chrome/common/chrome_switches.h" |
74 #include "chrome/common/cloud_print/cloud_print_class_mac.h" | 75 #include "chrome/common/cloud_print/cloud_print_class_mac.h" |
75 #include "chrome/common/extensions/extension_constants.h" | 76 #include "chrome/common/extensions/extension_constants.h" |
76 #include "chrome/common/mac/app_mode_common.h" | 77 #include "chrome/common/mac/app_mode_common.h" |
77 #include "chrome/common/pref_names.h" | 78 #include "chrome/common/pref_names.h" |
78 #include "chrome/common/url_constants.h" | 79 #include "chrome/common/url_constants.h" |
79 #include "chrome/grit/chromium_strings.h" | 80 #include "chrome/grit/chromium_strings.h" |
80 #include "chrome/grit/generated_resources.h" | 81 #include "chrome/grit/generated_resources.h" |
81 #include "components/signin/core/browser/signin_manager.h" | 82 #include "components/signin/core/browser/signin_manager.h" |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 if (SessionRestore::IsRestoring(lastProfile) && | 1000 if (SessionRestore::IsRestoring(lastProfile) && |
1000 base::MessageLoop::current()->IsNested()) | 1001 base::MessageLoop::current()->IsNested()) |
1001 return; | 1002 return; |
1002 | 1003 |
1003 NSInteger tag = [sender tag]; | 1004 NSInteger tag = [sender tag]; |
1004 | 1005 |
1005 // If there are no browser windows, and we are trying to open a browser | 1006 // If there are no browser windows, and we are trying to open a browser |
1006 // for a locked profile, we have to show the User Manager instead as the | 1007 // for a locked profile, we have to show the User Manager instead as the |
1007 // locked profile needs authentication. | 1008 // locked profile needs authentication. |
1008 if (IsProfileSignedOut(lastProfile)) { | 1009 if (IsProfileSignedOut(lastProfile)) { |
1009 chrome::ShowUserManager(lastProfile->GetPath()); | 1010 UserManager::Show(lastProfile->GetPath(), |
| 1011 profiles::USER_MANAGER_NO_TUTORIAL, |
| 1012 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
1010 return; | 1013 return; |
1011 } | 1014 } |
1012 | 1015 |
1013 switch (tag) { | 1016 switch (tag) { |
1014 case IDC_NEW_TAB: | 1017 case IDC_NEW_TAB: |
1015 // Create a new tab in an existing browser window (which we activate) if | 1018 // Create a new tab in an existing browser window (which we activate) if |
1016 // possible. | 1019 // possible. |
1017 if (Browser* browser = ActivateBrowser(lastProfile)) { | 1020 if (Browser* browser = ActivateBrowser(lastProfile)) { |
1018 chrome::ExecuteCommand(browser, IDC_NEW_TAB); | 1021 chrome::ExecuteCommand(browser, IDC_NEW_TAB); |
1019 break; | 1022 break; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 return NO; | 1203 return NO; |
1201 } | 1204 } |
1202 } | 1205 } |
1203 | 1206 |
1204 // Otherwise open a new window. | 1207 // Otherwise open a new window. |
1205 // If the last profile was locked, we have to open the User Manager, as the | 1208 // If the last profile was locked, we have to open the User Manager, as the |
1206 // profile requires authentication. Similarly, because guest mode is | 1209 // profile requires authentication. Similarly, because guest mode is |
1207 // implemented as forced incognito, we can't open a new guest browser either, | 1210 // implemented as forced incognito, we can't open a new guest browser either, |
1208 // so we have to show the User Manager as well. | 1211 // so we have to show the User Manager as well. |
1209 Profile* lastProfile = [self lastProfile]; | 1212 Profile* lastProfile = [self lastProfile]; |
1210 if (lastProfile->IsGuestSession() || IsProfileSignedOut(lastProfile)) | 1213 if (lastProfile->IsGuestSession() || IsProfileSignedOut(lastProfile)) { |
1211 chrome::ShowUserManager(lastProfile->GetPath()); | 1214 UserManager::Show(lastProfile->GetPath(), |
1212 else | 1215 profiles::USER_MANAGER_NO_TUTORIAL, |
| 1216 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| 1217 } else { |
1213 CreateBrowser(lastProfile); | 1218 CreateBrowser(lastProfile); |
| 1219 } |
1214 | 1220 |
1215 // We've handled the reopen event, so return NO to tell AppKit not | 1221 // We've handled the reopen event, so return NO to tell AppKit not |
1216 // to do anything. | 1222 // to do anything. |
1217 return NO; | 1223 return NO; |
1218 } | 1224 } |
1219 | 1225 |
1220 - (void)initMenuState { | 1226 - (void)initMenuState { |
1221 menuState_.reset(new CommandUpdater(NULL)); | 1227 menuState_.reset(new CommandUpdater(NULL)); |
1222 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true); | 1228 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true); |
1223 menuState_->UpdateCommandEnabled(IDC_NEW_WINDOW, true); | 1229 menuState_->UpdateCommandEnabled(IDC_NEW_WINDOW, true); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 | 1580 |
1575 //--------------------------------------------------------------------------- | 1581 //--------------------------------------------------------------------------- |
1576 | 1582 |
1577 namespace app_controller_mac { | 1583 namespace app_controller_mac { |
1578 | 1584 |
1579 bool IsOpeningNewWindow() { | 1585 bool IsOpeningNewWindow() { |
1580 return g_is_opening_new_window; | 1586 return g_is_opening_new_window; |
1581 } | 1587 } |
1582 | 1588 |
1583 } // namespace app_controller_mac | 1589 } // namespace app_controller_mac |
OLD | NEW |