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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 631163004: Mac - show user manager before opening browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use different app_controller_mac method. use different TaskMgr call. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/app_controller_mac.mm
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 6435203b5b101bbd62cfa8346ea3e8cc0cd387b3..5cd916661152545b15e4dc7509654cd3a3744bfd 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -1007,7 +1007,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
// for a locked profile, we have to show the User Manager instead as the
// locked profile needs authentication.
if (IsProfileSignedOut(lastProfile)) {
- UserManager::Show(lastProfile->GetPath(),
+ UserManager::Show(base::FilePath(),
profiles::USER_MANAGER_NO_TUTORIAL,
profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
return;
@@ -1102,8 +1102,15 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
}
break;
case IDC_TASK_MANAGER:
- content::RecordAction(UserMetricsAction("TaskManager"));
- TaskManagerMac::Show();
+ if ([self canOpenNewBrowser]) {
+ // Browser parameter gets ignored on the mac implementation.
+ chrome::OpenTaskManager(NULL);
+ } else {
+ // No way to create a browser, default to the User Manager.
+ UserManager::Show(base::FilePath(),
+ profiles::USER_MANAGER_NO_TUTORIAL,
+ profiles::USER_MANAGER_SELECT_PROFILE_TASK_MANAGER);
+ }
break;
case IDC_OPTIONS:
[self showPreferences:sender];
@@ -1211,7 +1218,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
// so we have to show the User Manager as well.
Profile* lastProfile = [self lastProfile];
if (lastProfile->IsGuestSession() || IsProfileSignedOut(lastProfile)) {
- UserManager::Show(lastProfile->GetPath(),
+ UserManager::Show(base::FilePath(),
profiles::USER_MANAGER_NO_TUTORIAL,
profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
} else {
@@ -1319,6 +1326,14 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
return profile;
}
+- (bool)canOpenNewBrowser {
Mark Mentovai 2014/10/08 16:43:22 You need to document this.
Mike Lerman 2014/10/08 20:23:41 Done.
+ Profile* profile = [self safeLastProfileForNewWindows];
+
+ const PrefService* prefs = g_browser_process->local_state();
+ return !profile->IsGuestSession() ||
+ prefs->GetBoolean(prefs::kBrowserGuestModeEnabled);
+}
+
// Various methods to open URLs that we get in a native fashion. We use
// StartupBrowserCreator here because on the other platforms, URLs to open come
// through the ProcessSingleton, and it calls StartupBrowserCreator. It's best
@@ -1380,18 +1395,28 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
if (Browser* browser = ActivateBrowser([self lastProfile])) {
// Show options tab in the active browser window.
chrome::ShowSettings(browser);
- } else {
+ } else if ([self canOpenNewBrowser]) {
// No browser window, so create one for the options tab.
chrome::OpenOptionsWindow([self safeLastProfileForNewWindows]);
+ } else {
+ // No way to create a browser, default to the User Manager.
+ UserManager::Show(base::FilePath(),
+ profiles::USER_MANAGER_NO_TUTORIAL,
+ profiles::USER_MANAGER_SELECT_PROFILE_CHROME_SETTINGS);
}
}
- (IBAction)orderFrontStandardAboutPanel:(id)sender {
if (Browser* browser = ActivateBrowser([self lastProfile])) {
chrome::ShowAboutChrome(browser);
- } else {
- // No browser window, so create one for the about tab.
+ } else if ([self canOpenNewBrowser]) {
+ // No browser window, so create one for the options tab.
chrome::OpenAboutWindow([self safeLastProfileForNewWindows]);
+ } else {
+ // No way to create a browser, default to the User Manager.
+ UserManager::Show(base::FilePath(),
+ profiles::USER_MANAGER_NO_TUTORIAL,
+ profiles::USER_MANAGER_SELECT_PROFILE_ABOUT_CHROME);
}
}
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_window.h » ('j') | chrome/browser/ui/webui/signin/user_manager_screen_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698