Index: chrome/browser/ui/cocoa/profiles/user_manager_mac.mm |
diff --git a/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm b/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm |
index 957d95ba57bb6b8b04cab3e077f8fa47836a668c..faf3223da30bedc7ad98b4e96b36b57db56ab26b 100644 |
--- a/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm |
+++ b/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm |
@@ -10,6 +10,7 @@ |
#include "chrome/browser/ui/browser_dialogs.h" |
#import "chrome/browser/ui/cocoa/browser_window_utils.h" |
#include "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
+#include "chrome/browser/ui/user_manager.h" |
#include "chrome/grit/chromium_strings.h" |
#include "content/public/browser/native_web_keyboard_event.h" |
#include "content/public/browser/web_contents.h" |
@@ -23,23 +24,37 @@ |
const int kWindowWidth = 900; |
const int kWindowHeight = 700; |
-namespace chrome { |
+// An open User Manager window. There can only be one open at a time. This |
+// is reset to NULL when the window is closed. |
+static UserManagerMac* instance_ = NULL; // Weak. |
-// Declared in browser_dialogs.h so others don't have to depend on this header. |
-void ShowUserManager(const base::FilePath& profile_path_to_focus) { |
- UserManagerMac::Show( |
- profile_path_to_focus, profiles::USER_MANAGER_NO_TUTORIAL); |
-} |
+void UserManager::Show( |
+ const base::FilePath& profile_path_to_focus, |
+ profiles::UserManagerTutorialMode tutorial_mode, |
+ profiles::UserManagerProfileSelected profile_open_action) { |
+ if (instance_) { |
+ // If there's a user manager window open already, just activate it. |
+ [instance_->window_controller_ show]; |
+ return; |
+ } |
-void ShowUserManagerWithTutorial(profiles::UserManagerTutorialMode tutorial) { |
- UserManagerMac::Show(base::FilePath(), tutorial); |
+ // Create the guest profile, if necessary, and open the User Manager |
+ // from the guest profile. |
+ profiles::CreateGuestProfileForUserManager( |
+ profile_path_to_focus, |
+ tutorial_mode, |
+ profile_open_action, |
+ base::Bind(&UserManagerMac::OnGuestProfileCreated)); |
} |
-void HideUserManager() { |
- UserManagerMac::Hide(); |
+void UserManager::Hide() { |
+ if (instance_) |
+ [instance_->window_controller_ close]; |
} |
-} // namespace chrome |
+bool UserManager::IsShowing() { |
+ return instance_ ? [instance_->window_controller_ isVisible]: false; |
+} |
// Custom WebContentsDelegate that allows handling of hotkeys. |
class UserManagerWebContentsDelegate : public content::WebContentsDelegate { |
@@ -175,34 +190,6 @@ UserManagerMac::~UserManagerMac() { |
} |
// static |
-void UserManagerMac::Show(const base::FilePath& profile_path_to_focus, |
- profiles::UserManagerTutorialMode tutorial_mode) { |
- if (instance_) { |
- // If there's a user manager window open already, just activate it. |
- [instance_->window_controller_ show]; |
- return; |
- } |
- |
- // Create the guest profile, if necessary, and open the User Manager |
- // from the guest profile. |
- profiles::CreateGuestProfileForUserManager( |
- profile_path_to_focus, |
- tutorial_mode, |
- base::Bind(&UserManagerMac::OnGuestProfileCreated)); |
-} |
- |
-// static |
-void UserManagerMac::Hide() { |
- if (instance_) |
- [instance_->window_controller_ close]; |
-} |
- |
-// static |
-bool UserManagerMac::IsShowing() { |
- return instance_ ? [instance_->window_controller_ isVisible]: false; |
-} |
- |
-// static |
void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, |
const std::string& url) { |
instance_ = new UserManagerMac(guest_profile); |