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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator.cc

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: Rebase continued 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 #include "chrome/browser/ui/startup/startup_browser_creator.h" 5 #include "chrome/browser/ui/startup/startup_browser_creator.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 #include <set> 8 #include <set>
9 9
10 #include "apps/app_load_service.h" 10 #include "apps/app_load_service.h"
(...skipping 30 matching lines...) Expand all
41 #include "chrome/browser/profiles/profile.h" 41 #include "chrome/browser/profiles/profile.h"
42 #include "chrome/browser/profiles/profile_manager.h" 42 #include "chrome/browser/profiles/profile_manager.h"
43 #include "chrome/browser/profiles/profiles_state.h" 43 #include "chrome/browser/profiles/profiles_state.h"
44 #include "chrome/browser/search_engines/template_url_service_factory.h" 44 #include "chrome/browser/search_engines/template_url_service_factory.h"
45 #include "chrome/browser/ui/app_list/app_list_service.h" 45 #include "chrome/browser/ui/app_list/app_list_service.h"
46 #include "chrome/browser/ui/browser.h" 46 #include "chrome/browser/ui/browser.h"
47 #include "chrome/browser/ui/browser_dialogs.h" 47 #include "chrome/browser/ui/browser_dialogs.h"
48 #include "chrome/browser/ui/browser_finder.h" 48 #include "chrome/browser/ui/browser_finder.h"
49 #include "chrome/browser/ui/browser_window.h" 49 #include "chrome/browser/ui/browser_window.h"
50 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" 50 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
51 #include "chrome/browser/ui/user_manager.h"
51 #include "chrome/common/chrome_constants.h" 52 #include "chrome/common/chrome_constants.h"
52 #include "chrome/common/chrome_paths.h" 53 #include "chrome/common/chrome_paths.h"
53 #include "chrome/common/chrome_result_codes.h" 54 #include "chrome/common/chrome_result_codes.h"
54 #include "chrome/common/chrome_switches.h" 55 #include "chrome/common/chrome_switches.h"
55 #include "chrome/common/chrome_version_info.h" 56 #include "chrome/common/chrome_version_info.h"
56 #include "chrome/common/pref_names.h" 57 #include "chrome/common/pref_names.h"
57 #include "chrome/common/url_constants.h" 58 #include "chrome/common/url_constants.h"
58 #include "chrome/installer/util/browser_distribution.h" 59 #include "chrome/installer/util/browser_distribution.h"
59 #include "components/google/core/browser/google_util.h" 60 #include "components/google/core/browser/google_util.h"
60 #include "components/search_engines/util.h" 61 #include "components/search_engines/util.h"
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 if (last_opened_profiles.empty()) { 628 if (last_opened_profiles.empty()) {
628 // If the last used profile is locked or was a guest, show the user manager. 629 // If the last used profile is locked or was a guest, show the user manager.
629 if (switches::IsNewAvatarMenu()) { 630 if (switches::IsNewAvatarMenu()) {
630 ProfileInfoCache& profile_info = 631 ProfileInfoCache& profile_info =
631 g_browser_process->profile_manager()->GetProfileInfoCache(); 632 g_browser_process->profile_manager()->GetProfileInfoCache();
632 size_t profile_index = profile_info.GetIndexOfProfileWithPath( 633 size_t profile_index = profile_info.GetIndexOfProfileWithPath(
633 last_used_profile->GetPath()); 634 last_used_profile->GetPath());
634 bool signin_required = profile_index != std::string::npos && 635 bool signin_required = profile_index != std::string::npos &&
635 profile_info.ProfileIsSigninRequiredAtIndex(profile_index); 636 profile_info.ProfileIsSigninRequiredAtIndex(profile_index);
636 if (signin_required || last_used_profile->IsGuestSession()) { 637 if (signin_required || last_used_profile->IsGuestSession()) {
637 chrome::ShowUserManager(base::FilePath()); 638 UserManager::Show(base::FilePath(),
639 profiles::USER_MANAGER_NO_TUTORIAL,
640 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
638 return true; 641 return true;
639 } 642 }
640 } 643 }
641 if (!browser_creator->LaunchBrowser(command_line, last_used_profile, 644 if (!browser_creator->LaunchBrowser(command_line, last_used_profile,
642 cur_dir, is_process_startup, 645 cur_dir, is_process_startup,
643 is_first_run, return_code)) { 646 is_first_run, return_code)) {
644 return false; 647 return false;
645 } 648 }
646 } else { 649 } else {
647 // Launch the last used profile with the full command line, and the other 650 // Launch the last used profile with the full command line, and the other
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 // If we are showing the app list then chrome isn't shown so load the app 745 // If we are showing the app list then chrome isn't shown so load the app
743 // list's profile rather than chrome's. 746 // list's profile rather than chrome's.
744 if (command_line.HasSwitch(switches::kShowAppList)) { 747 if (command_line.HasSwitch(switches::kShowAppList)) {
745 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> 748 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)->
746 GetProfilePath(user_data_dir); 749 GetProfilePath(user_data_dir);
747 } 750 }
748 751
749 return g_browser_process->profile_manager()->GetLastUsedProfileDir( 752 return g_browser_process->profile_manager()->GetLastUsedProfileDir(
750 user_data_dir); 753 user_data_dir);
751 } 754 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/user_manager_mac_unittest.mm ('k') | chrome/browser/ui/user_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698