| 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 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 std::string path = url.path().size() ? url.path().substr(1) : ""; | 219 std::string path = url.path().size() ? url.path().substr(1) : ""; |
| 220 if (std::find(kKnownDisplayTypes, | 220 if (std::find(kKnownDisplayTypes, |
| 221 kKnownDisplayTypes + arraysize(kKnownDisplayTypes), | 221 kKnownDisplayTypes + arraysize(kKnownDisplayTypes), |
| 222 path) == kKnownDisplayTypes + arraysize(kKnownDisplayTypes)) { | 222 path) == kKnownDisplayTypes + arraysize(kKnownDisplayTypes)) { |
| 223 LOG(ERROR) << "Unknown display type '" << path << "'. Setting default."; | 223 LOG(ERROR) << "Unknown display type '" << path << "'. Setting default."; |
| 224 return OobeUI::kLoginDisplay; | 224 return OobeUI::kLoginDisplay; |
| 225 } | 225 } |
| 226 return path; | 226 return path; |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool IsKeyboardConnected() { | 229 bool IsRemoraRequisitioned() { |
| 230 const std::vector<ui::InputDevice>& keyboards = | 230 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
| 231 ui::InputDeviceManager::GetInstance()->GetKeyboardDevices(); | 231 g_browser_process->platform_part() |
| 232 for (const ui::InputDevice& keyboard : keyboards) { | 232 ->browser_policy_connector_chromeos() |
| 233 if (keyboard.type == ui::INPUT_DEVICE_INTERNAL || | 233 ->GetDeviceCloudPolicyManager(); |
| 234 keyboard.type == ui::INPUT_DEVICE_EXTERNAL) { | 234 return policy_manager && policy_manager->IsRemoraRequisition(); |
| 235 return true; | |
| 236 } | |
| 237 } | |
| 238 | |
| 239 return false; | |
| 240 } | 235 } |
| 241 | 236 |
| 242 } // namespace | 237 } // namespace |
| 243 | 238 |
| 244 // static | 239 // static |
| 245 const char OobeUI::kOobeDisplay[] = "oobe"; | 240 const char OobeUI::kOobeDisplay[] = "oobe"; |
| 246 const char OobeUI::kLoginDisplay[] = "login"; | 241 const char OobeUI::kLoginDisplay[] = "login"; |
| 247 const char OobeUI::kLockDisplay[] = "lock"; | 242 const char OobeUI::kLockDisplay[] = "lock"; |
| 248 const char OobeUI::kUserAddingDisplay[] = "user-adding"; | 243 const char OobeUI::kUserAddingDisplay[] = "user-adding"; |
| 249 const char OobeUI::kAppLaunchSplashDisplay[] = "app-launch-splash"; | 244 const char OobeUI::kAppLaunchSplashDisplay[] = "app-launch-splash"; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 options::UserImageSource* user_image_source = | 364 options::UserImageSource* user_image_source = |
| 370 new options::UserImageSource(); | 365 new options::UserImageSource(); |
| 371 content::URLDataSource::Add(profile, user_image_source); | 366 content::URLDataSource::Add(profile, user_image_source); |
| 372 | 367 |
| 373 // TabHelper is required for OOBE webui to make webview working on it. | 368 // TabHelper is required for OOBE webui to make webview working on it. |
| 374 content::WebContents* contents = web_ui->GetWebContents(); | 369 content::WebContents* contents = web_ui->GetWebContents(); |
| 375 extensions::TabHelper::CreateForWebContents(contents); | 370 extensions::TabHelper::CreateForWebContents(contents); |
| 376 | 371 |
| 377 // TODO(felixe): Display iteration and primary display selection not supported | 372 // TODO(felixe): Display iteration and primary display selection not supported |
| 378 // in Mash. See http://crbug.com/720917. | 373 // in Mash. See http://crbug.com/720917. |
| 379 if (!ash_util::IsRunningInMash() && !IsKeyboardConnected()) | 374 if (!ash_util::IsRunningInMash() && IsRemoraRequisitioned()) |
| 380 oobe_display_chooser_ = base::MakeUnique<OobeDisplayChooser>(); | 375 oobe_display_chooser_ = base::MakeUnique<OobeDisplayChooser>(); |
| 381 } | 376 } |
| 382 | 377 |
| 383 OobeUI::~OobeUI() { | 378 OobeUI::~OobeUI() { |
| 384 network_dropdown_handler_->RemoveObserver(GetView<ErrorScreenHandler>()); | 379 network_dropdown_handler_->RemoveObserver(GetView<ErrorScreenHandler>()); |
| 385 if (ash_util::IsRunningInMash()) { | 380 if (ash_util::IsRunningInMash()) { |
| 386 // TODO: Ash needs to expose screen dimming api. See | 381 // TODO: Ash needs to expose screen dimming api. See |
| 387 // http://crbug.com/646034. | 382 // http://crbug.com/646034. |
| 388 NOTIMPLEMENTED(); | 383 NOTIMPLEMENTED(); |
| 389 } | 384 } |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 GetLocalizedStrings(&localized_strings); | 661 GetLocalizedStrings(&localized_strings); |
| 667 static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings); | 662 static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings); |
| 668 } | 663 } |
| 669 | 664 |
| 670 void OobeUI::OnDisplayConfigurationChanged() { | 665 void OobeUI::OnDisplayConfigurationChanged() { |
| 671 if (oobe_display_chooser_) | 666 if (oobe_display_chooser_) |
| 672 oobe_display_chooser_->TryToPlaceUiOnTouchDisplay(); | 667 oobe_display_chooser_->TryToPlaceUiOnTouchDisplay(); |
| 673 } | 668 } |
| 674 | 669 |
| 675 } // namespace chromeos | 670 } // namespace chromeos |
| OLD | NEW |