| 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_avatar_icon_util.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/profiles/profile_metrics.h" | 11 #include "chrome/browser/profiles/profile_metrics.h" |
| 11 #include "chrome/browser/profiles/profile_window.h" | 12 #include "chrome/browser/profiles/profile_window.h" |
| 12 #include "chrome/browser/profiles/profiles_state.h" | 13 #include "chrome/browser/profiles/profiles_state.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_dialogs.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
| 15 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/user_manager.h" | 18 #include "chrome/browser/ui/user_manager.h" |
| 18 #include "chrome/browser/ui/views/auto_keep_alive.h" | 19 #include "chrome/browser/ui/views/auto_keep_alive.h" |
| 19 #include "chrome/grit/chromium_strings.h" | 20 #include "chrome/grit/chromium_strings.h" |
| 21 #include "content/public/browser/render_widget_host_view.h" |
| 20 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
| 23 #include "ui/views/controls/webview/webview.h" | 25 #include "ui/views/controls/webview/webview.h" |
| 24 #include "ui/views/layout/fill_layout.h" | 26 #include "ui/views/layout/fill_layout.h" |
| 25 #include "ui/views/view.h" | 27 #include "ui/views/view.h" |
| 26 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 27 #include "ui/views/window/dialog_client_view.h" | 29 #include "ui/views/window/dialog_client_view.h" |
| 28 | 30 |
| 29 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 GetDialogClientView()->RemoveAccelerator( | 142 GetDialogClientView()->RemoveAccelerator( |
| 141 ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); | 143 ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); |
| 142 | 144 |
| 143 #if defined(OS_WIN) | 145 #if defined(OS_WIN) |
| 144 // Set the app id for the task manager to the app id of its parent | 146 // Set the app id for the task manager to the app id of its parent |
| 145 ui::win::SetAppIdForWindow( | 147 ui::win::SetAppIdForWindow( |
| 146 ShellIntegration::GetChromiumModelIdForProfile( | 148 ShellIntegration::GetChromiumModelIdForProfile( |
| 147 guest_profile->GetPath()), | 149 guest_profile->GetPath()), |
| 148 views::HWNDForWidget(GetWidget())); | 150 views::HWNDForWidget(GetWidget())); |
| 149 #endif | 151 #endif |
| 150 GetWidget()->Show(); | |
| 151 | 152 |
| 152 web_view_->LoadInitialURL(url); | 153 web_view_->LoadInitialURL(url); |
| 154 content::RenderWidgetHostView* rwhv = |
| 155 web_view_->GetWebContents()->GetRenderWidgetHostView(); |
| 156 if (rwhv) |
| 157 rwhv->SetBackgroundColor(profiles::kUserManagerBackgroundColor); |
| 158 |
| 153 web_view_->RequestFocus(); | 159 web_view_->RequestFocus(); |
| 160 |
| 161 GetWidget()->Show(); |
| 154 } | 162 } |
| 155 | 163 |
| 156 bool UserManagerView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 164 bool UserManagerView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 157 DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); | 165 DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); |
| 158 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); | 166 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); |
| 159 GetWidget()->Close(); | 167 GetWidget()->Close(); |
| 160 return true; | 168 return true; |
| 161 } | 169 } |
| 162 | 170 |
| 163 gfx::Size UserManagerView::GetPreferredSize() const { | 171 gfx::Size UserManagerView::GetPreferredSize() const { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 188 // Now that the window is closed, we can allow a new one to be opened. | 196 // Now that the window is closed, we can allow a new one to be opened. |
| 189 // (WindowClosing comes in asynchronously from the call to Close() and we | 197 // (WindowClosing comes in asynchronously from the call to Close() and we |
| 190 // may have already opened a new instance). | 198 // may have already opened a new instance). |
| 191 if (instance_ == this) | 199 if (instance_ == this) |
| 192 instance_ = NULL; | 200 instance_ = NULL; |
| 193 } | 201 } |
| 194 | 202 |
| 195 bool UserManagerView::UseNewStyleForThisDialog() const { | 203 bool UserManagerView::UseNewStyleForThisDialog() const { |
| 196 return false; | 204 return false; |
| 197 } | 205 } |
| OLD | NEW |