Index: chrome/browser/app_controller_mac.mm |
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm |
index 434e3e72ba261b284c2b3360666dd258e6be8b6e..41ebabcca30d20766aca56b7eeb0346edacfa916 100644 |
--- a/chrome/browser/app_controller_mac.mm |
+++ b/chrome/browser/app_controller_mac.mm |
@@ -999,7 +999,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; |
@@ -1094,8 +1094,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver { |
} |
break; |
case IDC_TASK_MANAGER: |
- content::RecordAction(UserMetricsAction("TaskManager")); |
- TaskManagerMac::Show(); |
+ chrome::OpenTaskManager(NULL); |
break; |
case IDC_OPTIONS: |
[self showPreferences:sender]; |
@@ -1203,7 +1202,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 { |
@@ -1311,6 +1310,15 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver { |
return profile; |
} |
+// Returns true if a browser window may be opened for the last active profile. |
+- (bool)canOpenNewBrowser { |
+ 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 |
@@ -1372,18 +1380,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); |
} |
} |