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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/oobe_ui.cc

Issue 2839643002: Have OobeUI handle display observation (Closed)
Patch Set: And also remove the other leftover header Created 3 years, 8 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
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/oobe_ui.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/webui/chromeos/login/oobe_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "chrome/grit/chrome_unscaled_resources.h" 71 #include "chrome/grit/chrome_unscaled_resources.h"
72 #include "chrome/grit/component_extension_resources.h" 72 #include "chrome/grit/component_extension_resources.h"
73 #include "chromeos/chromeos_switches.h" 73 #include "chromeos/chromeos_switches.h"
74 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 74 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
75 #include "components/prefs/pref_service.h" 75 #include "components/prefs/pref_service.h"
76 #include "content/public/browser/web_ui.h" 76 #include "content/public/browser/web_ui.h"
77 #include "content/public/browser/web_ui_data_source.h" 77 #include "content/public/browser/web_ui_data_source.h"
78 #include "content/public/common/content_switches.h" 78 #include "content/public/common/content_switches.h"
79 #include "ui/base/resource/resource_bundle.h" 79 #include "ui/base/resource/resource_bundle.h"
80 #include "ui/base/webui/web_ui_util.h" 80 #include "ui/base/webui/web_ui_util.h"
81 #include "ui/display/display.h"
82 #include "ui/display/screen.h"
81 83
82 namespace chromeos { 84 namespace chromeos {
83 85
84 namespace { 86 namespace {
85 87
86 const char* kKnownDisplayTypes[] = {OobeUI::kOobeDisplay, 88 const char* kKnownDisplayTypes[] = {OobeUI::kOobeDisplay,
87 OobeUI::kLoginDisplay, 89 OobeUI::kLoginDisplay,
88 OobeUI::kLockDisplay, 90 OobeUI::kLockDisplay,
89 OobeUI::kUserAddingDisplay, 91 OobeUI::kUserAddingDisplay,
90 OobeUI::kAppLaunchSplashDisplay, 92 OobeUI::kAppLaunchSplashDisplay,
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 network_element::AddLocalizedStrings(html_source); 326 network_element::AddLocalizedStrings(html_source);
325 327
326 // Set up the chrome://userimage/ source. 328 // Set up the chrome://userimage/ source.
327 options::UserImageSource* user_image_source = 329 options::UserImageSource* user_image_source =
328 new options::UserImageSource(); 330 new options::UserImageSource();
329 content::URLDataSource::Add(profile, user_image_source); 331 content::URLDataSource::Add(profile, user_image_source);
330 332
331 // TabHelper is required for OOBE webui to make webview working on it. 333 // TabHelper is required for OOBE webui to make webview working on it.
332 content::WebContents* contents = web_ui->GetWebContents(); 334 content::WebContents* contents = web_ui->GetWebContents();
333 extensions::TabHelper::CreateForWebContents(contents); 335 extensions::TabHelper::CreateForWebContents(contents);
336
337 display::Screen::GetScreen()->AddObserver(this);
334 } 338 }
335 339
336 OobeUI::~OobeUI() { 340 OobeUI::~OobeUI() {
337 network_dropdown_handler_->RemoveObserver(GetView<ErrorScreenHandler>()); 341 network_dropdown_handler_->RemoveObserver(GetView<ErrorScreenHandler>());
342 display::Screen::GetScreen()->RemoveObserver(this);
338 if (ash_util::IsRunningInMash()) { 343 if (ash_util::IsRunningInMash()) {
339 // TODO: Ash needs to expose screen dimming api. See 344 // TODO: Ash needs to expose screen dimming api. See
340 // http://crbug.com/646034. 345 // http://crbug.com/646034.
341 NOTIMPLEMENTED(); 346 NOTIMPLEMENTED();
342 } 347 }
343 } 348 }
344 349
345 CoreOobeView* OobeUI::GetCoreOobeView() { 350 CoreOobeView* OobeUI::GetCoreOobeView() {
346 return core_handler_; 351 return core_handler_;
347 } 352 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 433 }
429 434
430 GaiaView* OobeUI::GetGaiaScreenView() { 435 GaiaView* OobeUI::GetGaiaScreenView() {
431 return GetView<GaiaScreenHandler>(); 436 return GetView<GaiaScreenHandler>();
432 } 437 }
433 438
434 UserBoardView* OobeUI::GetUserBoardView() { 439 UserBoardView* OobeUI::GetUserBoardView() {
435 return GetView<UserBoardScreenHandler>(); 440 return GetView<UserBoardScreenHandler>();
436 } 441 }
437 442
443 void OobeUI::OnDisplayAdded(const display::Display& new_display) {}
444
445 void OobeUI::OnDisplayRemoved(const display::Display& old_display) {}
446
447 void OobeUI::OnDisplayMetricsChanged(const display::Display& display,
448 uint32_t changed_metrics) {
449 display::Display primary_display =
450 display::Screen::GetScreen()->GetPrimaryDisplay();
451 if (display.id() != primary_display.id() ||
452 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) {
453 return;
454 }
455
456 const gfx::Size& size = primary_display.size();
457 GetCoreOobeView()->SetClientAreaSize(size.width(), size.height());
458 }
459
438 void OobeUI::OnShutdownPolicyChanged(bool reboot_on_shutdown) { 460 void OobeUI::OnShutdownPolicyChanged(bool reboot_on_shutdown) {
439 core_handler_->UpdateShutdownAndRebootVisibility(reboot_on_shutdown); 461 core_handler_->UpdateShutdownAndRebootVisibility(reboot_on_shutdown);
440 } 462 }
441 463
442 AppLaunchSplashScreenView* OobeUI::GetAppLaunchSplashScreenView() { 464 AppLaunchSplashScreenView* OobeUI::GetAppLaunchSplashScreenView() {
443 return GetView<AppLaunchSplashScreenHandler>(); 465 return GetView<AppLaunchSplashScreenHandler>();
444 } 466 }
445 467
446 ArcKioskSplashScreenView* OobeUI::GetArcKioskSplashScreenView() { 468 ArcKioskSplashScreenView* OobeUI::GetArcKioskSplashScreenView() {
447 return GetView<ArcKioskSplashScreenHandler>(); 469 return GetView<ArcKioskSplashScreenHandler>();
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 g_browser_process->local_state()->GetBoolean(prefs::kOobeMdMode)) { 618 g_browser_process->local_state()->GetBoolean(prefs::kOobeMdMode)) {
597 return; 619 return;
598 } 620 }
599 621
600 base::DictionaryValue localized_strings; 622 base::DictionaryValue localized_strings;
601 GetLocalizedStrings(&localized_strings); 623 GetLocalizedStrings(&localized_strings);
602 static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings); 624 static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings);
603 } 625 }
604 626
605 } // namespace chromeos 627 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/oobe_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698