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