| OLD | NEW |
| 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 |
| 11 #include "ash/common/shell_window_ids.h" | |
| 12 #include "ash/wm/screen_dimmer.h" | 11 #include "ash/wm/screen_dimmer.h" |
| 13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 14 #include "base/logging.h" | 13 #include "base/logging.h" |
| 15 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/browser_process_platform_part.h" | 19 #include "chrome/browser/browser_process_platform_part.h" |
| 20 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_
actor.h" | 20 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_
actor.h" |
| 21 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" | 21 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" |
| 22 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 22 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
| 23 #include "chrome/browser/chromeos/login/startup_utils.h" | 23 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 24 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 24 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 25 #include "chrome/browser/chromeos/login/wizard_controller.h" | 25 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 content::URLDataSource::Add(profile, user_image_source); | 354 content::URLDataSource::Add(profile, user_image_source); |
| 355 | 355 |
| 356 // TabHelper is required for OOBE webui to make webview working on it. | 356 // TabHelper is required for OOBE webui to make webview working on it. |
| 357 content::WebContents* contents = web_ui->GetWebContents(); | 357 content::WebContents* contents = web_ui->GetWebContents(); |
| 358 extensions::TabHelper::CreateForWebContents(contents); | 358 extensions::TabHelper::CreateForWebContents(contents); |
| 359 } | 359 } |
| 360 | 360 |
| 361 OobeUI::~OobeUI() { | 361 OobeUI::~OobeUI() { |
| 362 core_handler_->SetDelegate(nullptr); | 362 core_handler_->SetDelegate(nullptr); |
| 363 network_dropdown_handler_->RemoveObserver(error_screen_handler_); | 363 network_dropdown_handler_->RemoveObserver(error_screen_handler_); |
| 364 if (!chrome::IsRunningInMash()) { | 364 if (chrome::IsRunningInMash()) { |
| 365 ash::ScreenDimmer::GetForContainer( | 365 // TODO: Ash needs to expose screen dimming api. See |
| 366 ash::kShellWindowId_LockScreenContainersContainer) | 366 // http://crbug.com/646034. |
| 367 ->SetDimming(false); | |
| 368 } else { | |
| 369 NOTIMPLEMENTED(); | 367 NOTIMPLEMENTED(); |
| 370 } | 368 } |
| 371 } | 369 } |
| 372 | 370 |
| 373 CoreOobeActor* OobeUI::GetCoreOobeActor() { | 371 CoreOobeActor* OobeUI::GetCoreOobeActor() { |
| 374 return core_handler_; | 372 return core_handler_; |
| 375 } | 373 } |
| 376 | 374 |
| 377 NetworkView* OobeUI::GetNetworkView() { | 375 NetworkView* OobeUI::GetNetworkView() { |
| 378 return network_view_; | 376 return network_view_; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 | 581 |
| 584 void OobeUI::OnCurrentScreenChanged(const std::string& screen) { | 582 void OobeUI::OnCurrentScreenChanged(const std::string& screen) { |
| 585 previous_screen_ = current_screen_; | 583 previous_screen_ = current_screen_; |
| 586 OobeScreen new_screen = GetOobeScreenFromName(screen); | 584 OobeScreen new_screen = GetOobeScreenFromName(screen); |
| 587 | 585 |
| 588 const bool should_dim = | 586 const bool should_dim = |
| 589 std::find(std::begin(kDimOverlayScreenIds), | 587 std::find(std::begin(kDimOverlayScreenIds), |
| 590 std::end(kDimOverlayScreenIds), | 588 std::end(kDimOverlayScreenIds), |
| 591 new_screen) != std::end(kDimOverlayScreenIds); | 589 new_screen) != std::end(kDimOverlayScreenIds); |
| 592 if (!chrome::IsRunningInMash()) { | 590 if (!chrome::IsRunningInMash()) { |
| 593 ash::ScreenDimmer* screen_dimmer = ash::ScreenDimmer::GetForContainer( | 591 if (!screen_dimmer_) { |
| 594 ash::kShellWindowId_LockScreenContainersContainer); | 592 screen_dimmer_ = base::MakeUnique<ash::ScreenDimmer>( |
| 595 screen_dimmer->set_at_bottom(true); | 593 ash::ScreenDimmer::Container::LOCK_SCREEN); |
| 596 screen_dimmer->SetDimming(should_dim); | 594 } |
| 595 screen_dimmer_->set_at_bottom(true); |
| 596 screen_dimmer_->SetDimming(should_dim); |
| 597 } else { | 597 } else { |
| 598 // TODO: Ash needs to expose screen dimming api. See |
| 599 // http://crbug.com/646034. |
| 598 NOTIMPLEMENTED(); | 600 NOTIMPLEMENTED(); |
| 599 } | 601 } |
| 600 | 602 |
| 601 current_screen_ = new_screen; | 603 current_screen_ = new_screen; |
| 602 FOR_EACH_OBSERVER(Observer, | 604 FOR_EACH_OBSERVER(Observer, |
| 603 observer_list_, | 605 observer_list_, |
| 604 OnCurrentScreenChanged(current_screen_, new_screen)); | 606 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 605 } | 607 } |
| 606 | 608 |
| 607 } // namespace chromeos | 609 } // namespace chromeos |
| OLD | NEW |