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" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // static | 57 // static |
58 UserManagerView* UserManagerView::instance_ = NULL; | 58 UserManagerView* UserManagerView::instance_ = NULL; |
59 | 59 |
60 UserManagerView::UserManagerView(Profile* profile) | 60 UserManagerView::UserManagerView(Profile* profile) |
61 : web_view_(new views::WebView(profile)) { | 61 : web_view_(new views::WebView(profile)) { |
62 SetLayoutManager(new views::FillLayout); | 62 SetLayoutManager(new views::FillLayout); |
63 AddChildView(web_view_); | 63 AddChildView(web_view_); |
64 } | 64 } |
65 | 65 |
66 UserManagerView::~UserManagerView() { | 66 UserManagerView::~UserManagerView() { |
67 chrome::EndKeepAlive(); // Remove shutdown prevention. | 67 chrome::DecrementKeepAliveCount(); // Remove shutdown prevention. |
68 } | 68 } |
69 | 69 |
70 // static | 70 // static |
71 void UserManagerView::Show(const base::FilePath& profile_path_to_focus) { | 71 void UserManagerView::Show(const base::FilePath& profile_path_to_focus) { |
72 // 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. |
73 chrome::StartKeepAlive(); | 73 chrome::IncrementKeepAliveCount(); |
74 | 74 |
75 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::OPEN_USER_MANAGER); | 75 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::OPEN_USER_MANAGER); |
76 if (instance_) { | 76 if (instance_) { |
77 // 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. |
78 instance_->GetWidget()->Activate(); | 78 instance_->GetWidget()->Activate(); |
79 return; | 79 return; |
80 } | 80 } |
81 | 81 |
82 // Create the guest profile, if necessary, and open the user manager | 82 // Create the guest profile, if necessary, and open the user manager |
83 // from the guest profile. | 83 // from the guest profile. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // 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. |
163 // (WindowClosing comes in asynchronously from the call to Close() and we | 163 // (WindowClosing comes in asynchronously from the call to Close() and we |
164 // may have already opened a new instance). | 164 // may have already opened a new instance). |
165 if (instance_ == this) | 165 if (instance_ == this) |
166 instance_ = NULL; | 166 instance_ = NULL; |
167 } | 167 } |
168 | 168 |
169 bool UserManagerView::UseNewStyleForThisDialog() const { | 169 bool UserManagerView::UseNewStyleForThisDialog() const { |
170 return false; | 170 return false; |
171 } | 171 } |
OLD | NEW |