Chromium Code Reviews| Index: chrome/browser/ui/views/profiles/user_manager_view.cc |
| diff --git a/chrome/browser/ui/views/profiles/user_manager_view.cc b/chrome/browser/ui/views/profiles/user_manager_view.cc |
| index 8f6a80ccd6a377c090e9a8801e9cf60eeee93d11..7626b3d24261e4e6296c5a896c2e646f430bd98f 100644 |
| --- a/chrome/browser/ui/views/profiles/user_manager_view.cc |
| +++ b/chrome/browser/ui/views/profiles/user_manager_view.cc |
| @@ -13,6 +13,7 @@ |
| #include "chrome/browser/ui/browser_dialogs.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_window.h" |
| +#include "chrome/browser/ui/user_manager.h" |
| #include "chrome/browser/ui/views/auto_keep_alive.h" |
| #include "chrome/grit/chromium_strings.h" |
| #include "content/public/browser/web_contents.h" |
| @@ -36,40 +37,16 @@ namespace { |
| 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) { |
| - UserManagerView::Show( |
| - profile_path_to_focus, profiles::USER_MANAGER_NO_TUTORIAL); |
| -} |
| - |
| -void ShowUserManagerWithTutorial(profiles::UserManagerTutorialMode tutorial) { |
| - UserManagerView::Show(base::FilePath(), tutorial); |
| -} |
| - |
| -void HideUserManager() { |
| - UserManagerView::Hide(); |
| -} |
| - |
| -} // namespace chrome |
| - |
| -// static |
| -UserManagerView* UserManagerView::instance_ = NULL; |
| - |
| -UserManagerView::UserManagerView() |
| - : web_view_(NULL), |
| - keep_alive_(new AutoKeepAlive(NULL)) { |
| -} |
| +// 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 UserManagerView* instance_ = NULL; |
|
Peter Kasting
2014/09/18 18:55:05
This shouldn't be static as it's already in an ano
|
| -UserManagerView::~UserManagerView() { |
| -} |
| +} // namespace |
| -// static |
| -void UserManagerView::Show(const base::FilePath& profile_path_to_focus, |
| - profiles::UserManagerTutorialMode tutorial_mode) { |
| +void UserManager::Show( |
|
Peter Kasting
2014/09/18 18:55:05
Optional: Add divider lines ("// UserManager -----
|
| + const base::FilePath& profile_path_to_focus, |
| + profiles::UserManagerTutorialMode tutorial_mode, |
| + profiles::UserManagerProfileSelected profile_open_action) { |
| ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::OPEN_USER_MANAGER); |
| if (instance_) { |
| // If there's a user manager window open already, just activate it. |
| @@ -82,22 +59,29 @@ void UserManagerView::Show(const base::FilePath& profile_path_to_focus, |
| profiles::CreateGuestProfileForUserManager( |
| profile_path_to_focus, |
| tutorial_mode, |
| + profile_open_action, |
| base::Bind(&UserManagerView::OnGuestProfileCreated, |
|
Peter Kasting
2014/09/18 18:55:05
Somehow it seems weird to me that this is a static
|
| base::Passed(make_scoped_ptr(new UserManagerView)), |
| profile_path_to_focus)); |
| } |
| -// static |
| -void UserManagerView::Hide() { |
| +void UserManager::Hide() { |
| if (instance_) |
| instance_->GetWidget()->Close(); |
| } |
| -// static |
| -bool UserManagerView::IsShowing() { |
| +bool UserManager::IsShowing() { |
| return instance_ ? instance_->GetWidget()->IsActive() : false; |
| } |
| +UserManagerView::UserManagerView() |
| + : web_view_(NULL), |
| + keep_alive_(new AutoKeepAlive(NULL)) { |
| +} |
| + |
| +UserManagerView::~UserManagerView() { |
| +} |
| + |
| // static |
| void UserManagerView::OnGuestProfileCreated( |
| scoped_ptr<UserManagerView> instance, |