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 "base/time/time.h" | 7 #include "base/time/time.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_avatar_icon_util.h" | 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // browser, bounds will remain empty and the user manager will be centered on | 141 // browser, bounds will remain empty and the user manager will be centered on |
142 // the default monitor by default. | 142 // the default monitor by default. |
143 // | 143 // |
144 // Note the profile is accessed via GetProfileByPath(GetLastUsedProfileDir()) | 144 // Note the profile is accessed via GetProfileByPath(GetLastUsedProfileDir()) |
145 // instead of GetLastUsedProfile(). If the last active profile isn't loaded, | 145 // instead of GetLastUsedProfile(). If the last active profile isn't loaded, |
146 // the latter may try to synchronously load it, which can only be done on a | 146 // the latter may try to synchronously load it, which can only be done on a |
147 // thread where disk IO is allowed. | 147 // thread where disk IO is allowed. |
148 gfx::Rect bounds; | 148 gfx::Rect bounds; |
149 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 149 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
150 const base::FilePath& last_used_profile_path = | 150 const base::FilePath& last_used_profile_path = |
151 profile_manager->GetLastUsedProfileDir(profile_manager->user_data_dir()); | 151 profile_manager->GetLastUsedProfileDir(); |
152 Profile* profile = profile_manager->GetProfileByPath(last_used_profile_path); | 152 Profile* profile = profile_manager->GetProfileByPath(last_used_profile_path); |
153 if (profile) { | 153 if (profile) { |
154 Browser* browser = chrome::FindLastActiveWithProfile(profile, | 154 Browser* browser = chrome::FindLastActiveWithProfile(profile, |
155 chrome::GetActiveDesktop()); | 155 chrome::GetActiveDesktop()); |
156 if (browser) { | 156 if (browser) { |
157 gfx::NativeView native_view = | 157 gfx::NativeView native_view = |
158 views::Widget::GetWidgetForNativeWindow( | 158 views::Widget::GetWidgetForNativeWindow( |
159 browser->window()->GetNativeWindow())->GetNativeView(); | 159 browser->window()->GetNativeWindow())->GetNativeView(); |
160 bounds = gfx::Screen::GetScreenFor(native_view)-> | 160 bounds = gfx::Screen::GetScreenFor(native_view)-> |
161 GetDisplayNearestWindow(native_view).work_area(); | 161 GetDisplayNearestWindow(native_view).work_area(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // Now that the window is closed, we can allow a new one to be opened. | 242 // Now that the window is closed, we can allow a new one to be opened. |
243 // (WindowClosing comes in asynchronously from the call to Close() and we | 243 // (WindowClosing comes in asynchronously from the call to Close() and we |
244 // may have already opened a new instance). | 244 // may have already opened a new instance). |
245 if (instance_ == this) | 245 if (instance_ == this) |
246 instance_ = NULL; | 246 instance_ = NULL; |
247 } | 247 } |
248 | 248 |
249 bool UserManagerView::UseNewStyleForThisDialog() const { | 249 bool UserManagerView::UseNewStyleForThisDialog() const { |
250 return false; | 250 return false; |
251 } | 251 } |
OLD | NEW |