Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 564453003: Access to Chrome via the System Tray should go through the User Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pkasting's nits Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 if (SessionRestore::IsRestoring(lastProfile) && 1040 if (SessionRestore::IsRestoring(lastProfile) &&
1040 base::MessageLoop::current()->IsNested()) 1041 base::MessageLoop::current()->IsNested())
1041 return; 1042 return;
1042 1043
1043 NSInteger tag = [sender tag]; 1044 NSInteger tag = [sender tag];
1044 1045
1045 // If there are no browser windows, and we are trying to open a browser 1046 // If there are no browser windows, and we are trying to open a browser
1046 // for a locked profile, we have to show the User Manager instead as the 1047 // for a locked profile, we have to show the User Manager instead as the
1047 // locked profile needs authentication. 1048 // locked profile needs authentication.
1048 if (IsProfileSignedOut(lastProfile)) { 1049 if (IsProfileSignedOut(lastProfile)) {
1049 chrome::ShowUserManager(lastProfile->GetPath()); 1050 UserManager::Show(lastProfile->GetPath(),
1051 profiles::USER_MANAGER_NO_TUTORIAL,
1052 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
1050 return; 1053 return;
1051 } 1054 }
1052 1055
1053 switch (tag) { 1056 switch (tag) {
1054 case IDC_NEW_TAB: 1057 case IDC_NEW_TAB:
1055 // Create a new tab in an existing browser window (which we activate) if 1058 // Create a new tab in an existing browser window (which we activate) if
1056 // possible. 1059 // possible.
1057 if (Browser* browser = ActivateBrowser(lastProfile)) { 1060 if (Browser* browser = ActivateBrowser(lastProfile)) {
1058 chrome::ExecuteCommand(browser, IDC_NEW_TAB); 1061 chrome::ExecuteCommand(browser, IDC_NEW_TAB);
1059 break; 1062 break;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 return NO; 1243 return NO;
1241 } 1244 }
1242 } 1245 }
1243 1246
1244 // Otherwise open a new window. 1247 // Otherwise open a new window.
1245 // If the last profile was locked, we have to open the User Manager, as the 1248 // If the last profile was locked, we have to open the User Manager, as the
1246 // profile requires authentication. Similarly, because guest mode is 1249 // profile requires authentication. Similarly, because guest mode is
1247 // implemented as forced incognito, we can't open a new guest browser either, 1250 // implemented as forced incognito, we can't open a new guest browser either,
1248 // so we have to show the User Manager as well. 1251 // so we have to show the User Manager as well.
1249 Profile* lastProfile = [self lastProfile]; 1252 Profile* lastProfile = [self lastProfile];
1250 if (lastProfile->IsGuestSession() || IsProfileSignedOut(lastProfile)) 1253 if (lastProfile->IsGuestSession() || IsProfileSignedOut(lastProfile)) {
1251 chrome::ShowUserManager(lastProfile->GetPath()); 1254 UserManager::Show(lastProfile->GetPath(),
1252 else 1255 profiles::USER_MANAGER_NO_TUTORIAL,
Alexei Svitkine (slow) 2014/09/18 20:54:04 Nit: Align.
1256 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
1257 } else {
1253 CreateBrowser(lastProfile); 1258 CreateBrowser(lastProfile);
1259 }
1254 1260
1255 // We've handled the reopen event, so return NO to tell AppKit not 1261 // We've handled the reopen event, so return NO to tell AppKit not
1256 // to do anything. 1262 // to do anything.
1257 return NO; 1263 return NO;
1258 } 1264 }
1259 1265
1260 - (void)initMenuState { 1266 - (void)initMenuState {
1261 menuState_.reset(new CommandUpdater(NULL)); 1267 menuState_.reset(new CommandUpdater(NULL));
1262 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true); 1268 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true);
1263 menuState_->UpdateCommandEnabled(IDC_NEW_WINDOW, true); 1269 menuState_->UpdateCommandEnabled(IDC_NEW_WINDOW, true);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 1586
1581 //--------------------------------------------------------------------------- 1587 //---------------------------------------------------------------------------
1582 1588
1583 namespace app_controller_mac { 1589 namespace app_controller_mac {
1584 1590
1585 bool IsOpeningNewWindow() { 1591 bool IsOpeningNewWindow() {
1586 return g_is_opening_new_window; 1592 return g_is_opening_new_window;
1587 } 1593 }
1588 1594
1589 } // namespace app_controller_mac 1595 } // namespace app_controller_mac
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698