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

Unified Diff: chrome/browser/ui/views/profiles/user_manager_view.cc

Issue 564453003: Access to Chrome via the System Tray should go through the User Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase continued Created 6 years, 3 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/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 9de679ed8465dda813d60c86a2c4486098723e3b..6a336a3337f67b9eb0a37f641147676c88339bfb 100644
--- a/chrome/browser/ui/views/profiles/user_manager_view.cc
+++ b/chrome/browser/ui/views/profiles/user_manager_view.cc
@@ -14,6 +14,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"
@@ -37,40 +38,18 @@ 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();
-}
+// An open User Manager window. There can only be one open at a time. This
+// is reset to NULL when the window is closed.
+UserManagerView* instance_ = NULL;
-} // namespace chrome
-
-// static
-UserManagerView* UserManagerView::instance_ = NULL;
-
-UserManagerView::UserManagerView()
- : web_view_(NULL),
- keep_alive_(new AutoKeepAlive(NULL)) {
-}
+} // namespace
-UserManagerView::~UserManagerView() {
-}
+// UserManager -----------------------------------------------------------------
-// static
-void UserManagerView::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) {
ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::OPEN_USER_MANAGER);
if (instance_) {
// If we are showing the User Manager after locking a profile, change the
@@ -87,22 +66,31 @@ 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,
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::UserManagerView()
+ : web_view_(NULL),
+ keep_alive_(new AutoKeepAlive(NULL)) {
+}
+
+UserManagerView::~UserManagerView() {
+}
+
// static
void UserManagerView::OnGuestProfileCreated(
scoped_ptr<UserManagerView> instance,
@@ -113,6 +101,7 @@ void UserManagerView::OnGuestProfileCreated(
// active profile to Guest.
profiles::SetActiveProfileToGuestIfLocked();
+ DCHECK(!instance_);
instance_ = instance.release(); // |instance_| takes over ownership.
instance_->Init(profile_path_to_focus, guest_profile, GURL(url));
}
« no previous file with comments | « chrome/browser/ui/views/profiles/user_manager_view.h ('k') | chrome/browser/ui/webui/signin/user_manager_screen_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698