| 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 678881e97fcbf30abee36a797177205bc3292739..a36f11202b7cd72f7c546227392369a974681343 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"
|
| @@ -24,23 +25,9 @@
|
| const int kWindowWidth = 900;
|
| const int kWindowHeight = 700;
|
|
|
| -namespace chrome {
|
| -
|
| -// 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 ShowUserManagerWithTutorial(profiles::UserManagerTutorialMode tutorial) {
|
| - UserManagerMac::Show(base::FilePath(), tutorial);
|
| -}
|
| -
|
| -void HideUserManager() {
|
| - UserManagerMac::Hide();
|
| -}
|
| -
|
| -} // 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.
|
| +UserManagerMac* instance_ = NULL; // Weak.
|
|
|
| // Custom WebContentsDelegate that allows handling of hotkeys.
|
| class UserManagerWebContentsDelegate : public content::WebContentsDelegate {
|
| @@ -165,23 +152,14 @@ class UserManagerWebContentsDelegate : public content::WebContentsDelegate {
|
|
|
| @end
|
|
|
| -// static
|
| -UserManagerMac* UserManagerMac::instance_ = NULL;
|
|
|
| -UserManagerMac::UserManagerMac(Profile* profile) {
|
| - window_controller_.reset([[UserManagerWindowController alloc]
|
| - initWithProfile:profile withObserver:this]);
|
| -}
|
| -
|
| -UserManagerMac::~UserManagerMac() {
|
| -}
|
| -
|
| -// static
|
| -void UserManagerMac::Show(const base::FilePath& profile_path_to_focus,
|
| - profiles::UserManagerTutorialMode tutorial_mode) {
|
| +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];
|
| + [instance_->window_controller() show];
|
| return;
|
| }
|
|
|
| @@ -190,25 +168,33 @@ void UserManagerMac::Show(const base::FilePath& profile_path_to_focus,
|
| profiles::CreateGuestProfileForUserManager(
|
| profile_path_to_focus,
|
| tutorial_mode,
|
| + profile_open_action,
|
| base::Bind(&UserManagerMac::OnGuestProfileCreated));
|
| }
|
|
|
| -// static
|
| -void UserManagerMac::Hide() {
|
| +void UserManager::Hide() {
|
| if (instance_)
|
| - [instance_->window_controller_ close];
|
| + [instance_->window_controller() close];
|
| }
|
|
|
| -// static
|
| -bool UserManagerMac::IsShowing() {
|
| - return instance_ ? [instance_->window_controller_ isVisible]: false;
|
| +bool UserManager::IsShowing() {
|
| + return instance_ ? [instance_->window_controller() isVisible]: false;
|
| +}
|
| +
|
| +UserManagerMac::UserManagerMac(Profile* profile) {
|
| + window_controller_.reset([[UserManagerWindowController alloc]
|
| + initWithProfile:profile withObserver:this]);
|
| +}
|
| +
|
| +UserManagerMac::~UserManagerMac() {
|
| }
|
|
|
| // static
|
| void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile,
|
| const std::string& url) {
|
| + DCHECK(!instance_);
|
| instance_ = new UserManagerMac(guest_profile);
|
| - [instance_->window_controller_ showURL:GURL(url)];
|
| + [instance_->window_controller() showURL:GURL(url)];
|
| }
|
|
|
| void UserManagerMac::WindowWasClosed() {
|
|
|