OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/user_manager_view.h" | 5 #include "chrome/browser/ui/views/user_manager_view.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/lifetime/application_lifetime.h" | 9 #include "chrome/browser/lifetime/application_lifetime.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| 11 #include "chrome/browser/profiles/profile_metrics.h" |
11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_dialogs.h" | 13 #include "chrome/browser/ui/browser_dialogs.h" |
13 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_contents_view.h" | 17 #include "content/public/browser/web_contents_view.h" |
17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/views/controls/webview/webview.h" | 20 #include "ui/views/controls/webview/webview.h" |
20 #include "ui/views/layout/fill_layout.h" | 21 #include "ui/views/layout/fill_layout.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 65 |
65 UserManagerView::~UserManagerView() { | 66 UserManagerView::~UserManagerView() { |
66 chrome::EndKeepAlive(); // Remove shutdown prevention. | 67 chrome::EndKeepAlive(); // Remove shutdown prevention. |
67 } | 68 } |
68 | 69 |
69 // static | 70 // static |
70 void UserManagerView::Show(const base::FilePath& profile_path_to_focus) { | 71 void UserManagerView::Show(const base::FilePath& profile_path_to_focus) { |
71 // Prevent the browser process from shutting down while this window is open. | 72 // Prevent the browser process from shutting down while this window is open. |
72 chrome::StartKeepAlive(); | 73 chrome::StartKeepAlive(); |
73 | 74 |
| 75 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::OPEN_USER_MANAGER); |
74 if (instance_) { | 76 if (instance_) { |
75 // If there's a user manager window open already, just activate it. | 77 // If there's a user manager window open already, just activate it. |
76 instance_->GetWidget()->Activate(); | 78 instance_->GetWidget()->Activate(); |
77 return; | 79 return; |
78 } | 80 } |
79 | 81 |
80 // Create the guest profile, if necessary, and open the user manager | 82 // Create the guest profile, if necessary, and open the user manager |
81 // from the guest profile. | 83 // from the guest profile. |
82 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 84 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
83 profile_manager->CreateProfileAsync( | 85 profile_manager->CreateProfileAsync( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // Now that the window is closed, we can allow a new one to be opened. | 162 // Now that the window is closed, we can allow a new one to be opened. |
161 // (WindowClosing comes in asynchronously from the call to Close() and we | 163 // (WindowClosing comes in asynchronously from the call to Close() and we |
162 // may have already opened a new instance). | 164 // may have already opened a new instance). |
163 if (instance_ == this) | 165 if (instance_ == this) |
164 instance_ = NULL; | 166 instance_ = NULL; |
165 } | 167 } |
166 | 168 |
167 bool UserManagerView::UseNewStyleForThisDialog() const { | 169 bool UserManagerView::UseNewStyleForThisDialog() const { |
168 return false; | 170 return false; |
169 } | 171 } |
OLD | NEW |