Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Side by Side Diff: chrome/browser/chromeos/login/lock/webui_screen_locker.cc

Issue 1920263003: Rename gfx::Display/Screen to display::Display/Screen in chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/chromeos/login/lock/webui_screen_locker.h" 5 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/chromeos/power/power_event_observer.h" 8 #include "ash/system/chromeos/power/power_event_observer.h"
9 #include "ash/wm/lock_state_controller.h" 9 #include "ash/wm/lock_state_controller.h"
10 #include "ash/wm/lock_state_observer.h" 10 #include "ash/wm/lock_state_observer.h"
(...skipping 13 matching lines...) Expand all
24 #include "chromeos/dbus/dbus_thread_manager.h" 24 #include "chromeos/dbus/dbus_thread_manager.h"
25 #include "components/user_manager/user.h" 25 #include "components/user_manager/user.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/notification_types.h" 28 #include "content/public/browser/notification_types.h"
29 #include "content/public/browser/render_widget_host_view.h" 29 #include "content/public/browser/render_widget_host_view.h"
30 #include "content/public/browser/web_ui.h" 30 #include "content/public/browser/web_ui.h"
31 #include "ui/aura/client/capture_client.h" 31 #include "ui/aura/client/capture_client.h"
32 #include "ui/aura/window_event_dispatcher.h" 32 #include "ui/aura/window_event_dispatcher.h"
33 #include "ui/base/x/x11_util.h" 33 #include "ui/base/x/x11_util.h"
34 #include "ui/gfx/screen.h" 34 #include "ui/display/screen.h"
35 #include "ui/keyboard/keyboard_controller.h" 35 #include "ui/keyboard/keyboard_controller.h"
36 #include "ui/keyboard/keyboard_util.h" 36 #include "ui/keyboard/keyboard_util.h"
37 #include "ui/views/controls/webview/webview.h" 37 #include "ui/views/controls/webview/webview.h"
38 38
39 namespace { 39 namespace {
40 40
41 // URL which corresponds to the login WebUI. 41 // URL which corresponds to the login WebUI.
42 const char kLoginURL[] = "chrome://oobe/lock"; 42 const char kLoginURL[] = "chrome://oobe/lock";
43 43
44 // Disables virtual keyboard overscroll. Login UI will scroll user pods 44 // Disables virtual keyboard overscroll. Login UI will scroll user pods
(...skipping 18 matching lines...) Expand all
63 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) 63 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker)
64 : ScreenLockerDelegate(screen_locker), 64 : ScreenLockerDelegate(screen_locker),
65 lock_ready_(false), 65 lock_ready_(false),
66 webui_ready_(false), 66 webui_ready_(false),
67 network_state_helper_(new login::NetworkStateHelper), 67 network_state_helper_(new login::NetworkStateHelper),
68 is_observing_keyboard_(false), 68 is_observing_keyboard_(false),
69 weak_factory_(this) { 69 weak_factory_(this) {
70 set_should_emit_login_prompt_visible(false); 70 set_should_emit_login_prompt_visible(false);
71 ash::Shell::GetInstance()->lock_state_controller()->AddObserver(this); 71 ash::Shell::GetInstance()->lock_state_controller()->AddObserver(this);
72 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); 72 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this);
73 gfx::Screen::GetScreen()->AddObserver(this); 73 display::Screen::GetScreen()->AddObserver(this);
74 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); 74 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
75 75
76 if (keyboard::KeyboardController::GetInstance()) { 76 if (keyboard::KeyboardController::GetInstance()) {
77 keyboard::KeyboardController::GetInstance()->AddObserver(this); 77 keyboard::KeyboardController::GetInstance()->AddObserver(this);
78 is_observing_keyboard_ = true; 78 is_observing_keyboard_ = true;
79 } 79 }
80 } 80 }
81 81
82 void WebUIScreenLocker::LockScreen() { 82 void WebUIScreenLocker::LockScreen() {
83 gfx::Rect bounds = gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); 83 gfx::Rect bounds = display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
84 84
85 lock_time_ = base::TimeTicks::Now(); 85 lock_time_ = base::TimeTicks::Now();
86 LockWindow* lock_window = LockWindow::Create(); 86 LockWindow* lock_window = LockWindow::Create();
87 lock_window->set_observer(this); 87 lock_window->set_observer(this);
88 lock_window->set_initially_focused_view(this); 88 lock_window->set_initially_focused_view(this);
89 lock_window_ = lock_window->GetWidget(); 89 lock_window_ = lock_window->GetWidget();
90 lock_window_->AddObserver(this); 90 lock_window_->AddObserver(this);
91 WebUILoginView::Init(); 91 WebUILoginView::Init();
92 content::WebContentsObserver::Observe(webui_login_->GetWebContents()); 92 content::WebContentsObserver::Observe(webui_login_->GetWebContents());
93 lock_window_->SetContentsView(this); 93 lock_window_->SetContentsView(this);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 void WebUIScreenLocker::ResetAndFocusUserPod() { 158 void WebUIScreenLocker::ResetAndFocusUserPod() {
159 if (!webui_ready_) 159 if (!webui_ready_)
160 return; 160 return;
161 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearUserPodPassword"); 161 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearUserPodPassword");
162 FocusUserPod(); 162 FocusUserPod();
163 } 163 }
164 164
165 WebUIScreenLocker::~WebUIScreenLocker() { 165 WebUIScreenLocker::~WebUIScreenLocker() {
166 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); 166 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
167 gfx::Screen::GetScreen()->RemoveObserver(this); 167 display::Screen::GetScreen()->RemoveObserver(this);
168 ash::Shell::GetInstance()-> 168 ash::Shell::GetInstance()->
169 lock_state_controller()->RemoveObserver(this); 169 lock_state_controller()->RemoveObserver(this);
170 170
171 ash::Shell::GetInstance()->delegate()-> 171 ash::Shell::GetInstance()->delegate()->
172 RemoveVirtualKeyboardStateObserver(this); 172 RemoveVirtualKeyboardStateObserver(this);
173 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. 173 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker.
174 if (lock_window_) { 174 if (lock_window_) {
175 lock_window_->RemoveObserver(this); 175 lock_window_->RemoveObserver(this);
176 lock_window_->Close(); 176 lock_window_->Close();
177 } 177 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (GetOobeUI()) 400 if (GetOobeUI())
401 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(true); 401 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(true);
402 } else { 402 } else {
403 // Keyboard has been shown. 403 // Keyboard has been shown.
404 if (GetOobeUI()) 404 if (GetOobeUI())
405 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(false); 405 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(false);
406 } 406 }
407 } 407 }
408 408
409 //////////////////////////////////////////////////////////////////////////////// 409 ////////////////////////////////////////////////////////////////////////////////
410 // gfx::DisplayObserver: 410 // display::DisplayObserver:
411 411
412 void WebUIScreenLocker::OnDisplayAdded(const gfx::Display& new_display) { 412 void WebUIScreenLocker::OnDisplayAdded(const display::Display& new_display) {}
413 }
414 413
415 void WebUIScreenLocker::OnDisplayRemoved(const gfx::Display& old_display) { 414 void WebUIScreenLocker::OnDisplayRemoved(const display::Display& old_display) {}
416 }
417 415
418 void WebUIScreenLocker::OnDisplayMetricsChanged(const gfx::Display& display, 416 void WebUIScreenLocker::OnDisplayMetricsChanged(const display::Display& display,
419 uint32_t changed_metrics) { 417 uint32_t changed_metrics) {
420 gfx::Display primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); 418 display::Display primary_display =
419 display::Screen::GetScreen()->GetPrimaryDisplay();
421 if (display.id() != primary_display.id() || 420 if (display.id() != primary_display.id() ||
422 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) { 421 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) {
423 return; 422 return;
424 } 423 }
425 424
426 if (GetOobeUI()) { 425 if (GetOobeUI()) {
427 const gfx::Size& size = primary_display.size(); 426 const gfx::Size& size = primary_display.size();
428 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), 427 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(),
429 size.height()); 428 size.height());
430 } 429 }
431 } 430 }
432 431
433 } // namespace chromeos 432 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/lock/webui_screen_locker.h ('k') | chrome/browser/chromeos/login/ui/login_display_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698