| 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "ui/views/view.h" | 38 #include "ui/views/view.h" |
| 39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 40 #include "ui/views/window/dialog_client_view.h" | 40 #include "ui/views/window/dialog_client_view.h" |
| 41 | 41 |
| 42 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
| 43 #include "chrome/browser/shell_integration_win.h" | 43 #include "chrome/browser/shell_integration_win.h" |
| 44 #include "ui/base/win/shell.h" | 44 #include "ui/base/win/shell.h" |
| 45 #include "ui/views/win/hwnd_util.h" | 45 #include "ui/views/win/hwnd_util.h" |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 #if defined(USE_ASH) | |
| 49 #include "ash/resources/grit/ash_resources.h" // nogncheck | |
| 50 #include "ash/shelf/shelf_util.h" // nogncheck | |
| 51 #include "ash/wm/window_util.h" // nogncheck | |
| 52 #endif | |
| 53 | |
| 54 namespace { | 48 namespace { |
| 55 | 49 |
| 56 // An open User Manager window. There can only be one open at a time. This | 50 // An open User Manager window. There can only be one open at a time. This |
| 57 // is reset to NULL when the window is closed. | 51 // is reset to NULL when the window is closed. |
| 58 UserManagerView* instance_ = nullptr; | 52 UserManagerView* instance_ = nullptr; |
| 59 base::Closure* user_manager_shown_callback_for_testing_ = nullptr; | 53 base::Closure* user_manager_shown_callback_for_testing_ = nullptr; |
| 60 bool instance_under_construction_ = false; | 54 bool instance_under_construction_ = false; |
| 61 } // namespace | 55 } // namespace |
| 62 | 56 |
| 63 // ReauthDelegate--------------------------------------------------------------- | 57 // ReauthDelegate--------------------------------------------------------------- |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 DCHECK(!user_manager_shown_callback_for_testing_); | 229 DCHECK(!user_manager_shown_callback_for_testing_); |
| 236 user_manager_shown_callback_for_testing_ = new base::Closure(callback); | 230 user_manager_shown_callback_for_testing_ = new base::Closure(callback); |
| 237 } | 231 } |
| 238 | 232 |
| 239 // UserManagerView ------------------------------------------------------------- | 233 // UserManagerView ------------------------------------------------------------- |
| 240 | 234 |
| 241 UserManagerView::UserManagerView() | 235 UserManagerView::UserManagerView() |
| 242 : web_view_(nullptr), | 236 : web_view_(nullptr), |
| 243 delegate_(nullptr), | 237 delegate_(nullptr), |
| 244 user_manager_started_showing_(base::Time()) { | 238 user_manager_started_showing_(base::Time()) { |
| 245 #if !defined(USE_ASH) | |
| 246 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::USER_MANAGER_VIEW, | 239 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::USER_MANAGER_VIEW, |
| 247 KeepAliveRestartOption::DISABLED)); | 240 KeepAliveRestartOption::DISABLED)); |
| 248 #endif // !defined(USE_ASH) | |
| 249 } | 241 } |
| 250 | 242 |
| 251 UserManagerView::~UserManagerView() { | 243 UserManagerView::~UserManagerView() { |
| 252 HideReauthDialog(); | 244 HideReauthDialog(); |
| 253 } | 245 } |
| 254 | 246 |
| 255 // static | 247 // static |
| 256 void UserManagerView::OnSystemProfileCreated( | 248 void UserManagerView::OnSystemProfileCreated( |
| 257 std::unique_ptr<UserManagerView> instance, | 249 std::unique_ptr<UserManagerView> instance, |
| 258 base::AutoReset<bool>* pending, | 250 base::AutoReset<bool>* pending, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); | 338 ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); |
| 347 | 339 |
| 348 #if defined(OS_WIN) | 340 #if defined(OS_WIN) |
| 349 // Set the app id for the task manager to the app id of its parent | 341 // Set the app id for the task manager to the app id of its parent |
| 350 ui::win::SetAppIdForWindow( | 342 ui::win::SetAppIdForWindow( |
| 351 shell_integration::win::GetChromiumModelIdForProfile( | 343 shell_integration::win::GetChromiumModelIdForProfile( |
| 352 system_profile->GetPath()), | 344 system_profile->GetPath()), |
| 353 views::HWNDForWidget(GetWidget())); | 345 views::HWNDForWidget(GetWidget())); |
| 354 #endif | 346 #endif |
| 355 | 347 |
| 356 #if defined(USE_ASH) | |
| 357 gfx::NativeWindow native_window = GetWidget()->GetNativeWindow(); | |
| 358 ash::SetShelfItemDetailsForDialogWindow( | |
| 359 native_window, IDR_ASH_SHELF_LIST_BROWSER, native_window->title()); | |
| 360 #endif | |
| 361 | |
| 362 web_view_->LoadInitialURL(url); | 348 web_view_->LoadInitialURL(url); |
| 363 content::RenderWidgetHostView* rwhv = | 349 content::RenderWidgetHostView* rwhv = |
| 364 web_view_->GetWebContents()->GetRenderWidgetHostView(); | 350 web_view_->GetWebContents()->GetRenderWidgetHostView(); |
| 365 if (rwhv) | 351 if (rwhv) |
| 366 rwhv->SetBackgroundColor(profiles::kUserManagerBackgroundColor); | 352 rwhv->SetBackgroundColor(profiles::kUserManagerBackgroundColor); |
| 367 | 353 |
| 368 GetWidget()->Show(); | 354 GetWidget()->Show(); |
| 369 web_view_->RequestFocus(); | 355 web_view_->RequestFocus(); |
| 370 } | 356 } |
| 371 | 357 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 // Now that the window is closed, we can allow a new one to be opened. | 401 // Now that the window is closed, we can allow a new one to be opened. |
| 416 // (WindowClosing comes in asynchronously from the call to Close() and we | 402 // (WindowClosing comes in asynchronously from the call to Close() and we |
| 417 // may have already opened a new instance). | 403 // may have already opened a new instance). |
| 418 if (instance_ == this) | 404 if (instance_ == this) |
| 419 instance_ = NULL; | 405 instance_ = NULL; |
| 420 } | 406 } |
| 421 | 407 |
| 422 bool UserManagerView::ShouldUseCustomFrame() const { | 408 bool UserManagerView::ShouldUseCustomFrame() const { |
| 423 return false; | 409 return false; |
| 424 } | 410 } |
| OLD | NEW |