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 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 if (SessionRestore::IsRestoring(lastProfile) && | 1039 if (SessionRestore::IsRestoring(lastProfile) && |
1039 base::MessageLoop::current()->IsNested()) | 1040 base::MessageLoop::current()->IsNested()) |
1040 return; | 1041 return; |
1041 | 1042 |
1042 NSInteger tag = [sender tag]; | 1043 NSInteger tag = [sender tag]; |
1043 | 1044 |
1044 // If there are no browser windows, and we are trying to open a browser | 1045 // If there are no browser windows, and we are trying to open a browser |
1045 // for a locked profile, we have to show the User Manager instead as the | 1046 // for a locked profile, we have to show the User Manager instead as the |
1046 // locked profile needs authentication. | 1047 // locked profile needs authentication. |
1047 if (IsProfileSignedOut(lastProfile)) { | 1048 if (IsProfileSignedOut(lastProfile)) { |
1048 chrome::ShowUserManager(lastProfile->GetPath()); | 1049 UserManager::Show(lastProfile->GetPath(), |
| 1050 profiles::USER_MANAGER_NO_TUTORIAL, |
| 1051 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
1049 return; | 1052 return; |
1050 } | 1053 } |
1051 | 1054 |
1052 switch (tag) { | 1055 switch (tag) { |
1053 case IDC_NEW_TAB: | 1056 case IDC_NEW_TAB: |
1054 // Create a new tab in an existing browser window (which we activate) if | 1057 // Create a new tab in an existing browser window (which we activate) if |
1055 // possible. | 1058 // possible. |
1056 if (Browser* browser = ActivateBrowser(lastProfile)) { | 1059 if (Browser* browser = ActivateBrowser(lastProfile)) { |
1057 chrome::ExecuteCommand(browser, IDC_NEW_TAB); | 1060 chrome::ExecuteCommand(browser, IDC_NEW_TAB); |
1058 break; | 1061 break; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 return NO; | 1242 return NO; |
1240 } | 1243 } |
1241 } | 1244 } |
1242 | 1245 |
1243 // Otherwise open a new window. | 1246 // Otherwise open a new window. |
1244 // If the last profile was locked, we have to open the User Manager, as the | 1247 // If the last profile was locked, we have to open the User Manager, as the |
1245 // profile requires authentication. Similarly, because guest mode is | 1248 // profile requires authentication. Similarly, because guest mode is |
1246 // implemented as forced incognito, we can't open a new guest browser either, | 1249 // implemented as forced incognito, we can't open a new guest browser either, |
1247 // so we have to show the User Manager as well. | 1250 // so we have to show the User Manager as well. |
1248 Profile* lastProfile = [self lastProfile]; | 1251 Profile* lastProfile = [self lastProfile]; |
1249 if (lastProfile->IsGuestSession() || IsProfileSignedOut(lastProfile)) | 1252 if (lastProfile->IsGuestSession() || IsProfileSignedOut(lastProfile)) { |
1250 chrome::ShowUserManager(lastProfile->GetPath()); | 1253 UserManager::Show(lastProfile->GetPath(), |
1251 else | 1254 profiles::USER_MANAGER_NO_TUTORIAL, |
| 1255 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| 1256 } else { |
1252 CreateBrowser(lastProfile); | 1257 CreateBrowser(lastProfile); |
| 1258 } |
1253 | 1259 |
1254 // We've handled the reopen event, so return NO to tell AppKit not | 1260 // We've handled the reopen event, so return NO to tell AppKit not |
1255 // to do anything. | 1261 // to do anything. |
1256 return NO; | 1262 return NO; |
1257 } | 1263 } |
1258 | 1264 |
1259 - (void)initMenuState { | 1265 - (void)initMenuState { |
1260 menuState_.reset(new CommandUpdater(NULL)); | 1266 menuState_.reset(new CommandUpdater(NULL)); |
1261 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true); | 1267 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true); |
1262 menuState_->UpdateCommandEnabled(IDC_NEW_WINDOW, true); | 1268 menuState_->UpdateCommandEnabled(IDC_NEW_WINDOW, true); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 | 1585 |
1580 //--------------------------------------------------------------------------- | 1586 //--------------------------------------------------------------------------- |
1581 | 1587 |
1582 namespace app_controller_mac { | 1588 namespace app_controller_mac { |
1583 | 1589 |
1584 bool IsOpeningNewWindow() { | 1590 bool IsOpeningNewWindow() { |
1585 return g_is_opening_new_window; | 1591 return g_is_opening_new_window; |
1586 } | 1592 } |
1587 | 1593 |
1588 } // namespace app_controller_mac | 1594 } // namespace app_controller_mac |
OLD | NEW |