| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 const char kStringsJSPath[] = "strings.js"; | 95 const char kStringsJSPath[] = "strings.js"; |
| 96 const char kLockJSPath[] = "lock.js"; | 96 const char kLockJSPath[] = "lock.js"; |
| 97 const char kLoginJSPath[] = "login.js"; | 97 const char kLoginJSPath[] = "login.js"; |
| 98 const char kOobeJSPath[] = "oobe.js"; | 98 const char kOobeJSPath[] = "oobe.js"; |
| 99 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; | 99 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; |
| 100 const char kCustomElementsHTMLPath[] = "custom_elements.html"; | 100 const char kCustomElementsHTMLPath[] = "custom_elements.html"; |
| 101 const char kCustomElementsJSPath[] = "custom_elements.js"; | 101 const char kCustomElementsJSPath[] = "custom_elements.js"; |
| 102 | 102 |
| 103 // Paths for deferred resource loading. | 103 // Paths for deferred resource loading. |
| 104 const char kCustomElementsPinHTMLPath[] = "custom_elements/pin.html"; |
| 105 const char kCustomElementsPinCSSPath[] = "custom_elements/pin.css"; |
| 106 const char kCustomElementsPinJSPath[] = "custom_elements/pin.js"; |
| 104 const char kEnrollmentHTMLPath[] = "enrollment.html"; | 107 const char kEnrollmentHTMLPath[] = "enrollment.html"; |
| 105 const char kEnrollmentCSSPath[] = "enrollment.css"; | 108 const char kEnrollmentCSSPath[] = "enrollment.css"; |
| 106 const char kEnrollmentJSPath[] = "enrollment.js"; | 109 const char kEnrollmentJSPath[] = "enrollment.js"; |
| 107 | 110 |
| 111 // Shared parameter with JS that enables or disables the PIN screen. This needs |
| 112 // to stay synchronized with the JS definition. |
| 113 const char kShowPinKey[] = "showPin"; |
| 114 |
| 108 // Creates a WebUIDataSource for chrome://oobe | 115 // Creates a WebUIDataSource for chrome://oobe |
| 109 content::WebUIDataSource* CreateOobeUIDataSource( | 116 content::WebUIDataSource* CreateOobeUIDataSource( |
| 110 const base::DictionaryValue& localized_strings, | 117 const base::DictionaryValue& localized_strings, |
| 111 const std::string& display_type) { | 118 const std::string& display_type) { |
| 112 content::WebUIDataSource* source = | 119 content::WebUIDataSource* source = |
| 113 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | 120 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); |
| 114 source->AddLocalizedStrings(localized_strings); | 121 source->AddLocalizedStrings(localized_strings); |
| 115 source->SetJsonPath(kStringsJSPath); | 122 source->SetJsonPath(kStringsJSPath); |
| 116 | 123 |
| 117 if (display_type == OobeUI::kOobeDisplay) { | 124 if (display_type == OobeUI::kOobeDisplay) { |
| 118 source->SetDefaultResource(IDR_OOBE_HTML); | 125 source->SetDefaultResource(IDR_OOBE_HTML); |
| 119 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); | 126 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); |
| 120 source->AddResourcePath(kCustomElementsHTMLPath, | 127 source->AddResourcePath(kCustomElementsHTMLPath, |
| 121 IDR_CUSTOM_ELEMENTS_OOBE_HTML); | 128 IDR_CUSTOM_ELEMENTS_OOBE_HTML); |
| 122 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); | 129 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); |
| 123 } else if (display_type == OobeUI::kLockDisplay) { | 130 } else if (display_type == OobeUI::kLockDisplay) { |
| 124 source->SetDefaultResource(IDR_LOCK_HTML); | 131 source->SetDefaultResource(IDR_LOCK_HTML); |
| 125 source->AddResourcePath(kLockJSPath, IDR_LOCK_JS); | 132 source->AddResourcePath(kLockJSPath, IDR_LOCK_JS); |
| 126 source->AddResourcePath(kCustomElementsHTMLPath, | 133 source->AddResourcePath(kCustomElementsHTMLPath, |
| 127 IDR_CUSTOM_ELEMENTS_LOCK_HTML); | 134 IDR_CUSTOM_ELEMENTS_LOCK_HTML); |
| 128 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS); | 135 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS); |
| 136 source->AddResourcePath(kCustomElementsPinCSSPath, |
| 137 IDR_CUSTOM_ELEMENTS_PIN_CSS); |
| 138 source->AddResourcePath(kCustomElementsPinHTMLPath, |
| 139 IDR_CUSTOM_ELEMENTS_PIN_HTML); |
| 140 source->AddResourcePath(kCustomElementsPinJSPath, |
| 141 IDR_CUSTOM_ELEMENTS_PIN_JS); |
| 142 |
| 143 // TODO(jdufault): Dynamically show pin when it is enabled. |
| 144 source->AddBoolean(kShowPinKey, false); |
| 129 } else { | 145 } else { |
| 130 source->SetDefaultResource(IDR_LOGIN_HTML); | 146 source->SetDefaultResource(IDR_LOGIN_HTML); |
| 131 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); | 147 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); |
| 132 source->AddResourcePath(kCustomElementsHTMLPath, | 148 source->AddResourcePath(kCustomElementsHTMLPath, |
| 133 IDR_CUSTOM_ELEMENTS_LOGIN_HTML); | 149 IDR_CUSTOM_ELEMENTS_LOGIN_HTML); |
| 134 source->AddResourcePath(kCustomElementsJSPath, | 150 source->AddResourcePath(kCustomElementsJSPath, |
| 135 IDR_CUSTOM_ELEMENTS_LOGIN_JS); | 151 IDR_CUSTOM_ELEMENTS_LOGIN_JS); |
| 136 } | 152 } |
| 137 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); | 153 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); |
| 138 source->OverrideContentSecurityPolicyFrameSrc( | 154 source->OverrideContentSecurityPolicyFrameSrc( |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 screen_dimmer->set_at_bottom(true); | 591 screen_dimmer->set_at_bottom(true); |
| 576 screen_dimmer->SetDimming(should_dim); | 592 screen_dimmer->SetDimming(should_dim); |
| 577 | 593 |
| 578 FOR_EACH_OBSERVER(Observer, | 594 FOR_EACH_OBSERVER(Observer, |
| 579 observer_list_, | 595 observer_list_, |
| 580 OnCurrentScreenChanged(current_screen_, new_screen)); | 596 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 581 current_screen_ = new_screen; | 597 current_screen_ = new_screen; |
| 582 } | 598 } |
| 583 | 599 |
| 584 } // namespace chromeos | 600 } // namespace chromeos |
| OLD | NEW |