| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h" | 56 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h" |
| 57 #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h" | 57 #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h" |
| 58 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" | 58 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" |
| 59 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h" | 59 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h" |
| 60 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" | 60 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" |
| 61 #include "chrome/browser/ui/webui/settings/md_settings_localized_strings_provide
r.h" | 61 #include "chrome/browser/ui/webui/settings/md_settings_localized_strings_provide
r.h" |
| 62 #include "chrome/browser/ui/webui/test_files_request_filter.h" | 62 #include "chrome/browser/ui/webui/test_files_request_filter.h" |
| 63 #include "chrome/browser/ui/webui/theme_source.h" | 63 #include "chrome/browser/ui/webui/theme_source.h" |
| 64 #include "chrome/common/chrome_constants.h" | 64 #include "chrome/common/chrome_constants.h" |
| 65 #include "chrome/common/chrome_switches.h" | 65 #include "chrome/common/chrome_switches.h" |
| 66 #include "chrome/common/pref_names.h" |
| 66 #include "chrome/common/url_constants.h" | 67 #include "chrome/common/url_constants.h" |
| 67 #include "chrome/grit/browser_resources.h" | 68 #include "chrome/grit/browser_resources.h" |
| 68 #include "chrome/grit/chrome_unscaled_resources.h" | 69 #include "chrome/grit/chrome_unscaled_resources.h" |
| 69 #include "chromeos/chromeos_switches.h" | 70 #include "chromeos/chromeos_switches.h" |
| 70 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 71 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 72 #include "components/prefs/pref_service.h" |
| 71 #include "content/public/browser/web_ui.h" | 73 #include "content/public/browser/web_ui.h" |
| 72 #include "content/public/browser/web_ui_data_source.h" | 74 #include "content/public/browser/web_ui_data_source.h" |
| 73 #include "content/public/common/content_switches.h" | 75 #include "content/public/common/content_switches.h" |
| 74 #include "ui/base/resource/resource_bundle.h" | 76 #include "ui/base/resource/resource_bundle.h" |
| 75 #include "ui/base/webui/web_ui_util.h" | 77 #include "ui/base/webui/web_ui_util.h" |
| 76 | 78 |
| 77 namespace chromeos { | 79 namespace chromeos { |
| 78 | 80 |
| 79 namespace { | 81 namespace { |
| 80 | 82 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 std::string path = url.path().size() ? url.path().substr(1) : ""; | 177 std::string path = url.path().size() ? url.path().substr(1) : ""; |
| 176 if (std::find(kKnownDisplayTypes, | 178 if (std::find(kKnownDisplayTypes, |
| 177 kKnownDisplayTypes + arraysize(kKnownDisplayTypes), | 179 kKnownDisplayTypes + arraysize(kKnownDisplayTypes), |
| 178 path) == kKnownDisplayTypes + arraysize(kKnownDisplayTypes)) { | 180 path) == kKnownDisplayTypes + arraysize(kKnownDisplayTypes)) { |
| 179 LOG(ERROR) << "Unknown display type '" << path << "'. Setting default."; | 181 LOG(ERROR) << "Unknown display type '" << path << "'. Setting default."; |
| 180 return OobeUI::kLoginDisplay; | 182 return OobeUI::kLoginDisplay; |
| 181 } | 183 } |
| 182 return path; | 184 return path; |
| 183 } | 185 } |
| 184 | 186 |
| 185 bool UseMDOobe() { | |
| 186 return base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 187 chromeos::switches::kEnableMdOobe); | |
| 188 } | |
| 189 | |
| 190 } // namespace | 187 } // namespace |
| 191 | 188 |
| 192 // static | 189 // static |
| 193 const char OobeUI::kOobeDisplay[] = "oobe"; | 190 const char OobeUI::kOobeDisplay[] = "oobe"; |
| 194 const char OobeUI::kLoginDisplay[] = "login"; | 191 const char OobeUI::kLoginDisplay[] = "login"; |
| 195 const char OobeUI::kLockDisplay[] = "lock"; | 192 const char OobeUI::kLockDisplay[] = "lock"; |
| 196 const char OobeUI::kUserAddingDisplay[] = "user-adding"; | 193 const char OobeUI::kUserAddingDisplay[] = "user-adding"; |
| 197 const char OobeUI::kAppLaunchSplashDisplay[] = "app-launch-splash"; | 194 const char OobeUI::kAppLaunchSplashDisplay[] = "app-launch-splash"; |
| 198 | 195 |
| 199 OobeUI::OobeUI(content::WebUI* web_ui, const GURL& url) | 196 OobeUI::OobeUI(content::WebUI* web_ui, const GURL& url) |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 484 } |
| 488 | 485 |
| 489 bool keyboard_driven_oobe = | 486 bool keyboard_driven_oobe = |
| 490 system::InputDeviceSettings::Get()->ForceKeyboardDrivenUINavigation(); | 487 system::InputDeviceSettings::Get()->ForceKeyboardDrivenUINavigation(); |
| 491 localized_strings->SetString("highlightStrength", | 488 localized_strings->SetString("highlightStrength", |
| 492 keyboard_driven_oobe ? "strong" : "normal"); | 489 keyboard_driven_oobe ? "strong" : "normal"); |
| 493 | 490 |
| 494 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); | 491 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); |
| 495 localized_strings->SetString("newKioskUI", new_kiosk_ui ? "on" : "off"); | 492 localized_strings->SetString("newKioskUI", new_kiosk_ui ? "on" : "off"); |
| 496 localized_strings->SetString( | 493 localized_strings->SetString( |
| 497 "newOobeUI", (md_oobe_enabled_ && UseMDOobe()) ? "on" : "off"); | 494 "newOobeUI", |
| 495 g_browser_process->local_state()->GetBoolean(prefs::kOobeMdMode) ? "on" |
| 496 : "off"); |
| 498 } | 497 } |
| 499 | 498 |
| 500 void OobeUI::AddScreenHandler(BaseScreenHandler* handler) { | 499 void OobeUI::AddScreenHandler(BaseScreenHandler* handler) { |
| 501 web_ui()->AddMessageHandler(handler); | 500 web_ui()->AddMessageHandler(handler); |
| 502 handlers_.push_back(handler); | 501 handlers_.push_back(handler); |
| 503 } | 502 } |
| 504 | 503 |
| 505 void OobeUI::InitializeHandlers() { | 504 void OobeUI::InitializeHandlers() { |
| 506 ready_ = true; | 505 ready_ = true; |
| 507 for (size_t i = 0; i < ready_callbacks_.size(); ++i) | 506 for (size_t i = 0; i < ready_callbacks_.size(); ++i) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 } else { | 592 } else { |
| 594 NOTIMPLEMENTED(); | 593 NOTIMPLEMENTED(); |
| 595 } | 594 } |
| 596 | 595 |
| 597 current_screen_ = new_screen; | 596 current_screen_ = new_screen; |
| 598 FOR_EACH_OBSERVER(Observer, | 597 FOR_EACH_OBSERVER(Observer, |
| 599 observer_list_, | 598 observer_list_, |
| 600 OnCurrentScreenChanged(current_screen_, new_screen)); | 599 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 601 } | 600 } |
| 602 | 601 |
| 603 void OobeUI::EnableMdOobe() { | |
| 604 md_oobe_enabled_ = true; | |
| 605 } | |
| 606 | |
| 607 } // namespace chromeos | 602 } // namespace chromeos |
| OLD | NEW |