| Index: chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
|
| diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
|
| index 20a8b4cf9631cab794c8968e589c03196ed142ce..eabd42fee30dc05238729bf5f868ebf2592c8bba 100644
|
| --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
|
| +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
|
| @@ -4,8 +4,6 @@
|
|
|
| #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
|
|
|
| -#include <string>
|
| -
|
| #include "ash/ash_switches.h"
|
| #include "base/command_line.h"
|
| #include "base/logging.h"
|
| @@ -54,8 +52,19 @@ namespace chromeos {
|
|
|
| namespace {
|
|
|
| -// Path for a stripped down login page that does not have OOBE elements.
|
| -const char kLoginPath[] = "login#login";
|
| +// List of known types of OobeUI. Type added as path in chrome://oobe url, for
|
| +// example chrome://oobe/user-adding.
|
| +const char kOobeDisplay[] = "oobe";
|
| +const char kLoginDisplay[] = "login";
|
| +const char kLockDisplay[] = "lock";
|
| +const char kUserAddingDisplay[] = "user-adding";
|
| +
|
| +const char* kKnownDisplayTypes[] = {
|
| + kOobeDisplay,
|
| + kLoginDisplay,
|
| + kLockDisplay,
|
| + kUserAddingDisplay
|
| +};
|
|
|
| const char kStringsJSPath[] = "strings.js";
|
| const char kLoginJSPath[] = "login.js";
|
| @@ -86,7 +95,8 @@ bool HandleRequestCallback(
|
|
|
| // Creates a WebUIDataSource for chrome://oobe
|
| content::WebUIDataSource* CreateOobeUIDataSource(
|
| - const base::DictionaryValue& localized_strings) {
|
| + const base::DictionaryValue& localized_strings,
|
| + const std::string& display_type) {
|
| content::WebUIDataSource* source =
|
| content::WebUIDataSource::Create(chrome::kChromeUIOobeHost);
|
| source->SetUseJsonJSFormatV2();
|
| @@ -95,35 +105,40 @@ content::WebUIDataSource* CreateOobeUIDataSource(
|
|
|
| if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) {
|
| source->SetDefaultResource(IDR_DEMO_USER_LOGIN_HTML);
|
| - source->AddResourcePath(kDemoUserLoginJSPath,
|
| - IDR_DEMO_USER_LOGIN_JS);
|
| + source->AddResourcePath(kDemoUserLoginJSPath, IDR_DEMO_USER_LOGIN_JS);
|
| return source;
|
| }
|
| -
|
| - source->SetDefaultResource(IDR_OOBE_HTML);
|
| - source->AddResourcePath(kOobeJSPath,
|
| - IDR_OOBE_JS);
|
| - source->AddResourcePath(kLoginPath,
|
| - IDR_LOGIN_HTML);
|
| - source->AddResourcePath(kLoginJSPath,
|
| - IDR_LOGIN_JS);
|
| - source->AddResourcePath(kKeyboardUtilsJSPath,
|
| - IDR_KEYBOARD_UTILS_JS);
|
| + if (display_type == kOobeDisplay) {
|
| + source->SetDefaultResource(IDR_OOBE_HTML);
|
| + source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS);
|
| + } else {
|
| + source->SetDefaultResource(IDR_LOGIN_HTML);
|
| + source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS);
|
| + }
|
| + source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS);
|
| source->OverrideContentSecurityPolicyFrameSrc(
|
| "frame-src chrome://terms/ "
|
| "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/;");
|
|
|
| // Serve deferred resources.
|
| - source->AddResourcePath(kEnrollmentHTMLPath,
|
| - IDR_OOBE_ENROLLMENT_HTML);
|
| - source->AddResourcePath(kEnrollmentCSSPath,
|
| - IDR_OOBE_ENROLLMENT_CSS);
|
| - source->AddResourcePath(kEnrollmentJSPath,
|
| - IDR_OOBE_ENROLLMENT_JS);
|
| + source->AddResourcePath(kEnrollmentHTMLPath, IDR_OOBE_ENROLLMENT_HTML);
|
| + source->AddResourcePath(kEnrollmentCSSPath, IDR_OOBE_ENROLLMENT_CSS);
|
| + source->AddResourcePath(kEnrollmentJSPath, IDR_OOBE_ENROLLMENT_JS);
|
|
|
| return source;
|
| }
|
|
|
| +std::string GetDisplayType(const GURL& url) {
|
| + std::string path = url.path().size() ? url.path().substr(1) : "";
|
| + if (std::find(kKnownDisplayTypes,
|
| + kKnownDisplayTypes + arraysize(kKnownDisplayTypes),
|
| + path) == kKnownDisplayTypes + arraysize(kKnownDisplayTypes)) {
|
| + LOG(ERROR) << "Unknown display type '" << path << "'. Setting default.";
|
| + return kLoginDisplay;
|
| + }
|
| + return path;
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -144,7 +159,7 @@ const char OobeUI::kScreenManagedUserCreationFlow[]
|
| const char OobeUI::kScreenTermsOfService[] = "terms-of-service";
|
| const char OobeUI::kScreenWrongHWID[] = "wrong-hwid";
|
|
|
| -OobeUI::OobeUI(content::WebUI* web_ui)
|
| +OobeUI::OobeUI(content::WebUI* web_ui, const GURL& url)
|
| : WebUIController(web_ui),
|
| core_handler_(NULL),
|
| network_dropdown_handler_(NULL),
|
| @@ -163,6 +178,7 @@ OobeUI::OobeUI(content::WebUI* web_ui)
|
| kiosk_app_menu_handler_(NULL),
|
| current_screen_(SCREEN_UNKNOWN),
|
| ready_(false) {
|
| + display_type_ = GetDisplayType(url);
|
| InitializeScreenMaps();
|
|
|
| network_state_informer_ = new NetworkStateInformer();
|
| @@ -179,10 +195,12 @@ OobeUI::OobeUI(content::WebUI* web_ui)
|
| AddScreenHandler(update_screen_handler_);
|
| network_dropdown_handler_->AddObserver(update_screen_handler_);
|
|
|
| - NetworkScreenHandler* network_screen_handler =
|
| - new NetworkScreenHandler(core_handler_);
|
| - network_screen_actor_ = network_screen_handler;
|
| - AddScreenHandler(network_screen_handler);
|
| + if (display_type_ == kOobeDisplay) {
|
| + NetworkScreenHandler* network_screen_handler =
|
| + new NetworkScreenHandler(core_handler_);
|
| + network_screen_actor_ = network_screen_handler;
|
| + AddScreenHandler(network_screen_handler);
|
| + }
|
|
|
| EulaScreenHandler* eula_screen_handler = new EulaScreenHandler(core_handler_);
|
| eula_screen_actor_ = eula_screen_handler;
|
| @@ -256,7 +274,8 @@ OobeUI::OobeUI(content::WebUI* web_ui)
|
|
|
| // Set up the chrome://oobe/ source.
|
| content::WebUIDataSource::Add(profile,
|
| - CreateOobeUIDataSource(localized_strings));
|
| + CreateOobeUIDataSource(localized_strings,
|
| + display_type_));
|
|
|
| // Set up the chrome://userimage/ source.
|
| options::UserImageSource* user_image_source =
|
|
|