OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/profiles/user_manager_view.h" | 5 #include "chrome/browser/ui/views/profiles/user_manager_view.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/lifetime/application_lifetime.h" | 8 #include "chrome/browser/lifetime/application_lifetime.h" |
9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/profiles/profile_metrics.h" | 10 #include "chrome/browser/profiles/profile_metrics.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // Default window size. | 35 // Default window size. |
36 const int kWindowWidth = 900; | 36 const int kWindowWidth = 900; |
37 const int kWindowHeight = 700; | 37 const int kWindowHeight = 700; |
38 | 38 |
39 } | 39 } |
40 | 40 |
41 namespace chrome { | 41 namespace chrome { |
42 | 42 |
43 // Declared in browser_dialogs.h so others don't have to depend on this header. | 43 // Declared in browser_dialogs.h so others don't have to depend on this header. |
44 void ShowUserManager(const base::FilePath& profile_path_to_focus) { | 44 void ShowUserManager(const base::FilePath& profile_path_to_focus) { |
45 UserManagerView::Show( | 45 UserManagerView::Show(profile_path_to_focus, |
46 profile_path_to_focus, profiles::USER_MANAGER_NO_TUTORIAL); | 46 profiles::USER_MANAGER_NO_TUTORIAL, |
| 47 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
47 } | 48 } |
48 | 49 |
49 void ShowUserManagerWithTutorial(profiles::UserManagerTutorialMode tutorial) { | 50 void ShowUserManagerWithTutorial(profiles::UserManagerTutorialMode tutorial) { |
50 UserManagerView::Show(base::FilePath(), tutorial); | 51 UserManagerView::Show(base::FilePath(), |
| 52 tutorial, |
| 53 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| 54 } |
| 55 |
| 56 void ShowUserManagerThenTaskManager() { |
| 57 UserManagerView::Show(base::FilePath(), |
| 58 profiles::USER_MANAGER_NO_TUTORIAL, |
| 59 profiles::USER_MANAGER_SELECT_PROFILE_TASK_MANAGER); |
| 60 } |
| 61 |
| 62 void ShowUserManagerThenAboutChrome() { |
| 63 UserManagerView::Show(base::FilePath(), |
| 64 profiles::USER_MANAGER_NO_TUTORIAL, |
| 65 profiles::USER_MANAGER_SELECT_PROFILE_ABOUT_CHROME); |
51 } | 66 } |
52 | 67 |
53 void HideUserManager() { | 68 void HideUserManager() { |
54 UserManagerView::Hide(); | 69 UserManagerView::Hide(); |
55 } | 70 } |
56 | 71 |
57 } // namespace chrome | 72 } // namespace chrome |
58 | 73 |
59 // static | 74 // static |
60 UserManagerView* UserManagerView::instance_ = NULL; | 75 UserManagerView* UserManagerView::instance_ = NULL; |
61 | 76 |
62 UserManagerView::UserManagerView() | 77 UserManagerView::UserManagerView() |
63 : web_view_(NULL), | 78 : web_view_(NULL), |
64 keep_alive_(new AutoKeepAlive(NULL)) { | 79 keep_alive_(new AutoKeepAlive(NULL)) { |
65 } | 80 } |
66 | 81 |
67 UserManagerView::~UserManagerView() { | 82 UserManagerView::~UserManagerView() { |
68 } | 83 } |
69 | 84 |
70 // static | 85 // static |
71 void UserManagerView::Show(const base::FilePath& profile_path_to_focus, | 86 void UserManagerView::Show( |
72 profiles::UserManagerTutorialMode tutorial_mode) { | 87 const base::FilePath& profile_path_to_focus, |
| 88 profiles::UserManagerTutorialMode tutorial_mode, |
| 89 profiles::UserManagerProfileSelected profile_open_action) { |
73 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::OPEN_USER_MANAGER); | 90 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::OPEN_USER_MANAGER); |
74 if (instance_) { | 91 if (instance_) { |
75 // If there's a user manager window open already, just activate it. | 92 // If there's a user manager window open already, just activate it. |
76 instance_->GetWidget()->Activate(); | 93 instance_->GetWidget()->Activate(); |
77 return; | 94 return; |
78 } | 95 } |
79 | 96 |
80 // Create the guest profile, if necessary, and open the user manager | 97 // Create the guest profile, if necessary, and open the user manager |
81 // from the guest profile. | 98 // from the guest profile. |
82 profiles::CreateGuestProfileForUserManager( | 99 profiles::CreateGuestProfileForUserManager( |
83 profile_path_to_focus, | 100 profile_path_to_focus, |
84 tutorial_mode, | 101 tutorial_mode, |
| 102 profile_open_action, |
85 base::Bind(&UserManagerView::OnGuestProfileCreated, | 103 base::Bind(&UserManagerView::OnGuestProfileCreated, |
86 base::Passed(make_scoped_ptr(new UserManagerView)), | 104 base::Passed(make_scoped_ptr(new UserManagerView)), |
87 profile_path_to_focus)); | 105 profile_path_to_focus)); |
88 } | 106 } |
89 | 107 |
90 // static | 108 // static |
91 void UserManagerView::Hide() { | 109 void UserManagerView::Hide() { |
92 if (instance_) | 110 if (instance_) |
93 instance_->GetWidget()->Close(); | 111 instance_->GetWidget()->Close(); |
94 } | 112 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // Now that the window is closed, we can allow a new one to be opened. | 216 // Now that the window is closed, we can allow a new one to be opened. |
199 // (WindowClosing comes in asynchronously from the call to Close() and we | 217 // (WindowClosing comes in asynchronously from the call to Close() and we |
200 // may have already opened a new instance). | 218 // may have already opened a new instance). |
201 if (instance_ == this) | 219 if (instance_ == this) |
202 instance_ = NULL; | 220 instance_ = NULL; |
203 } | 221 } |
204 | 222 |
205 bool UserManagerView::UseNewStyleForThisDialog() const { | 223 bool UserManagerView::UseNewStyleForThisDialog() const { |
206 return false; | 224 return false; |
207 } | 225 } |
OLD | NEW |