| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // Paths for deferred resource loading. | 105 // Paths for deferred resource loading. |
| 106 const char kCustomElementsPinKeyboardHTMLPath[] = | 106 const char kCustomElementsPinKeyboardHTMLPath[] = |
| 107 "custom_elements/pin_keyboard.html"; | 107 "custom_elements/pin_keyboard.html"; |
| 108 const char kCustomElementsPinKeyboardJSPath[] = | 108 const char kCustomElementsPinKeyboardJSPath[] = |
| 109 "custom_elements/pin_keyboard.js"; | 109 "custom_elements/pin_keyboard.js"; |
| 110 const char kEnrollmentHTMLPath[] = "enrollment.html"; | 110 const char kEnrollmentHTMLPath[] = "enrollment.html"; |
| 111 const char kEnrollmentCSSPath[] = "enrollment.css"; | 111 const char kEnrollmentCSSPath[] = "enrollment.css"; |
| 112 const char kEnrollmentJSPath[] = "enrollment.js"; | 112 const char kEnrollmentJSPath[] = "enrollment.js"; |
| 113 | 113 |
| 114 // Shared parameter with JS that enables or disables the PIN screen. This needs | |
| 115 // to stay synchronized with the JS definition. | |
| 116 const char kShowPinKey[] = "showPin"; | |
| 117 | |
| 118 // Creates a WebUIDataSource for chrome://oobe | 114 // Creates a WebUIDataSource for chrome://oobe |
| 119 content::WebUIDataSource* CreateOobeUIDataSource( | 115 content::WebUIDataSource* CreateOobeUIDataSource( |
| 120 const base::DictionaryValue& localized_strings, | 116 const base::DictionaryValue& localized_strings, |
| 121 const std::string& display_type) { | 117 const std::string& display_type) { |
| 122 content::WebUIDataSource* source = | 118 content::WebUIDataSource* source = |
| 123 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | 119 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); |
| 124 source->AddLocalizedStrings(localized_strings); | 120 source->AddLocalizedStrings(localized_strings); |
| 125 source->SetJsonPath(kStringsJSPath); | 121 source->SetJsonPath(kStringsJSPath); |
| 126 | 122 |
| 127 if (display_type == OobeUI::kOobeDisplay) { | 123 if (display_type == OobeUI::kOobeDisplay) { |
| 128 source->SetDefaultResource(IDR_OOBE_HTML); | 124 source->SetDefaultResource(IDR_OOBE_HTML); |
| 129 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); | 125 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); |
| 130 source->AddResourcePath(kCustomElementsHTMLPath, | 126 source->AddResourcePath(kCustomElementsHTMLPath, |
| 131 IDR_CUSTOM_ELEMENTS_OOBE_HTML); | 127 IDR_CUSTOM_ELEMENTS_OOBE_HTML); |
| 132 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); | 128 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); |
| 133 } else if (display_type == OobeUI::kLockDisplay) { | 129 } else if (display_type == OobeUI::kLockDisplay) { |
| 134 source->SetDefaultResource(IDR_LOCK_HTML); | 130 source->SetDefaultResource(IDR_LOCK_HTML); |
| 135 source->AddResourcePath(kLockJSPath, IDR_LOCK_JS); | 131 source->AddResourcePath(kLockJSPath, IDR_LOCK_JS); |
| 136 source->AddResourcePath(kCustomElementsHTMLPath, | 132 source->AddResourcePath(kCustomElementsHTMLPath, |
| 137 IDR_CUSTOM_ELEMENTS_LOCK_HTML); | 133 IDR_CUSTOM_ELEMENTS_LOCK_HTML); |
| 138 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS); | 134 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS); |
| 139 source->AddResourcePath(kCustomElementsPinKeyboardHTMLPath, | 135 source->AddResourcePath(kCustomElementsPinKeyboardHTMLPath, |
| 140 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML); | 136 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML); |
| 141 source->AddResourcePath(kCustomElementsPinKeyboardJSPath, | 137 source->AddResourcePath(kCustomElementsPinKeyboardJSPath, |
| 142 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS); | 138 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS); |
| 143 | |
| 144 // TODO(jdufault): Dynamically show pin when it is enabled. | |
| 145 source->AddBoolean(kShowPinKey, false); | |
| 146 } else { | 139 } else { |
| 147 source->SetDefaultResource(IDR_LOGIN_HTML); | 140 source->SetDefaultResource(IDR_LOGIN_HTML); |
| 148 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); | 141 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); |
| 149 source->AddResourcePath(kCustomElementsHTMLPath, | 142 source->AddResourcePath(kCustomElementsHTMLPath, |
| 150 IDR_CUSTOM_ELEMENTS_LOGIN_HTML); | 143 IDR_CUSTOM_ELEMENTS_LOGIN_HTML); |
| 151 source->AddResourcePath(kCustomElementsJSPath, | 144 source->AddResourcePath(kCustomElementsJSPath, |
| 152 IDR_CUSTOM_ELEMENTS_LOGIN_JS); | 145 IDR_CUSTOM_ELEMENTS_LOGIN_JS); |
| 153 } | 146 } |
| 154 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); | 147 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); |
| 155 source->OverrideContentSecurityPolicyFrameSrc( | 148 source->OverrideContentSecurityPolicyFrameSrc( |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 NOTIMPLEMENTED(); | 600 NOTIMPLEMENTED(); |
| 608 } | 601 } |
| 609 | 602 |
| 610 FOR_EACH_OBSERVER(Observer, | 603 FOR_EACH_OBSERVER(Observer, |
| 611 observer_list_, | 604 observer_list_, |
| 612 OnCurrentScreenChanged(current_screen_, new_screen)); | 605 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 613 current_screen_ = new_screen; | 606 current_screen_ = new_screen; |
| 614 } | 607 } |
| 615 | 608 |
| 616 } // namespace chromeos | 609 } // namespace chromeos |
| OLD | NEW |