Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/oobe_ui.cc

Issue 1933913002: Add a very basic PIN UI implementation that is shared between lock and settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fix tests by removing a previously unused import that started getting used b/c of resource loader c… Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 const char kStringsJSPath[] = "strings.js"; 96 const char kStringsJSPath[] = "strings.js";
97 const char kLockJSPath[] = "lock.js"; 97 const char kLockJSPath[] = "lock.js";
98 const char kLoginJSPath[] = "login.js"; 98 const char kLoginJSPath[] = "login.js";
99 const char kOobeJSPath[] = "oobe.js"; 99 const char kOobeJSPath[] = "oobe.js";
100 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; 100 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js";
101 const char kCustomElementsHTMLPath[] = "custom_elements.html"; 101 const char kCustomElementsHTMLPath[] = "custom_elements.html";
102 const char kCustomElementsJSPath[] = "custom_elements.js"; 102 const char kCustomElementsJSPath[] = "custom_elements.js";
103 103
104 // Paths for deferred resource loading. 104 // Paths for deferred resource loading.
105 const char kCustomElementsPinKeyboardHTMLPath[] =
106 "custom_elements/pin_keyboard.html";
107 const char kCustomElementsPinKeyboardJSPath[] =
108 "custom_elements/pin_keyboard.js";
105 const char kEnrollmentHTMLPath[] = "enrollment.html"; 109 const char kEnrollmentHTMLPath[] = "enrollment.html";
106 const char kEnrollmentCSSPath[] = "enrollment.css"; 110 const char kEnrollmentCSSPath[] = "enrollment.css";
107 const char kEnrollmentJSPath[] = "enrollment.js"; 111 const char kEnrollmentJSPath[] = "enrollment.js";
108 112
113 // Shared parameter with JS that enables or disables the PIN screen. This needs
114 // to stay synchronized with the JS definition.
115 const char kShowPinKey[] = "showPin";
116
109 // Creates a WebUIDataSource for chrome://oobe 117 // Creates a WebUIDataSource for chrome://oobe
110 content::WebUIDataSource* CreateOobeUIDataSource( 118 content::WebUIDataSource* CreateOobeUIDataSource(
111 const base::DictionaryValue& localized_strings, 119 const base::DictionaryValue& localized_strings,
112 const std::string& display_type) { 120 const std::string& display_type) {
113 content::WebUIDataSource* source = 121 content::WebUIDataSource* source =
114 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); 122 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost);
115 source->AddLocalizedStrings(localized_strings); 123 source->AddLocalizedStrings(localized_strings);
116 source->SetJsonPath(kStringsJSPath); 124 source->SetJsonPath(kStringsJSPath);
117 125
118 if (display_type == OobeUI::kOobeDisplay) { 126 if (display_type == OobeUI::kOobeDisplay) {
119 source->SetDefaultResource(IDR_OOBE_HTML); 127 source->SetDefaultResource(IDR_OOBE_HTML);
120 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); 128 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS);
121 source->AddResourcePath(kCustomElementsHTMLPath, 129 source->AddResourcePath(kCustomElementsHTMLPath,
122 IDR_CUSTOM_ELEMENTS_OOBE_HTML); 130 IDR_CUSTOM_ELEMENTS_OOBE_HTML);
123 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); 131 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS);
124 } else if (display_type == OobeUI::kLockDisplay) { 132 } else if (display_type == OobeUI::kLockDisplay) {
125 source->SetDefaultResource(IDR_LOCK_HTML); 133 source->SetDefaultResource(IDR_LOCK_HTML);
126 source->AddResourcePath(kLockJSPath, IDR_LOCK_JS); 134 source->AddResourcePath(kLockJSPath, IDR_LOCK_JS);
127 source->AddResourcePath(kCustomElementsHTMLPath, 135 source->AddResourcePath(kCustomElementsHTMLPath,
128 IDR_CUSTOM_ELEMENTS_LOCK_HTML); 136 IDR_CUSTOM_ELEMENTS_LOCK_HTML);
129 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS); 137 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS);
138 source->AddResourcePath(kCustomElementsPinKeyboardHTMLPath,
139 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML);
140 source->AddResourcePath(kCustomElementsPinKeyboardJSPath,
141 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS);
142
143 // TODO(jdufault): Dynamically show pin when it is enabled.
144 source->AddBoolean(kShowPinKey, false);
130 } else { 145 } else {
131 source->SetDefaultResource(IDR_LOGIN_HTML); 146 source->SetDefaultResource(IDR_LOGIN_HTML);
132 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); 147 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS);
133 source->AddResourcePath(kCustomElementsHTMLPath, 148 source->AddResourcePath(kCustomElementsHTMLPath,
134 IDR_CUSTOM_ELEMENTS_LOGIN_HTML); 149 IDR_CUSTOM_ELEMENTS_LOGIN_HTML);
135 source->AddResourcePath(kCustomElementsJSPath, 150 source->AddResourcePath(kCustomElementsJSPath,
136 IDR_CUSTOM_ELEMENTS_LOGIN_JS); 151 IDR_CUSTOM_ELEMENTS_LOGIN_JS);
137 } 152 }
138 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); 153 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS);
139 source->OverrideContentSecurityPolicyFrameSrc( 154 source->OverrideContentSecurityPolicyFrameSrc(
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 NOTIMPLEMENTED(); 599 NOTIMPLEMENTED();
585 } 600 }
586 601
587 FOR_EACH_OBSERVER(Observer, 602 FOR_EACH_OBSERVER(Observer,
588 observer_list_, 603 observer_list_,
589 OnCurrentScreenChanged(current_screen_, new_screen)); 604 OnCurrentScreenChanged(current_screen_, new_screen));
590 current_screen_ = new_screen; 605 current_screen_ = new_screen;
591 } 606 }
592 607
593 } // namespace chromeos 608 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698