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

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

Issue 2855883005: cros: Selectively fork login assets. (Closed)
Patch Set: Created 3 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const char kEnrollmentJSPath[] = "enrollment.js"; 117 const char kEnrollmentJSPath[] = "enrollment.js";
118 const char kArcPlaystoreCSSPath[] = "playstore.css"; 118 const char kArcPlaystoreCSSPath[] = "playstore.css";
119 const char kArcPlaystoreJSPath[] = "playstore.js"; 119 const char kArcPlaystoreJSPath[] = "playstore.js";
120 const char kArcPlaystoreLogoPath[] = "playstore.svg"; 120 const char kArcPlaystoreLogoPath[] = "playstore.svg";
121 const char kProductLogoPath[] = "product-logo.png"; 121 const char kProductLogoPath[] = "product-logo.png";
122 122
123 // Creates a WebUIDataSource for chrome://oobe 123 // Creates a WebUIDataSource for chrome://oobe
124 content::WebUIDataSource* CreateOobeUIDataSource( 124 content::WebUIDataSource* CreateOobeUIDataSource(
125 const base::DictionaryValue& localized_strings, 125 const base::DictionaryValue& localized_strings,
126 const std::string& display_type) { 126 const std::string& display_type) {
127 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
128
127 content::WebUIDataSource* source = 129 content::WebUIDataSource* source =
128 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); 130 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost);
129 source->AddLocalizedStrings(localized_strings); 131 source->AddLocalizedStrings(localized_strings);
130 source->SetJsonPath(kStringsJSPath); 132 source->SetJsonPath(kStringsJSPath);
131 133
132 if (display_type == OobeUI::kOobeDisplay) { 134 if (display_type == OobeUI::kOobeDisplay) {
133 source->SetDefaultResource(IDR_OOBE_HTML); 135 source->SetDefaultResource(IDR_OOBE_HTML);
134 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); 136 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS);
135 source->AddResourcePath(kCustomElementsHTMLPath, 137 source->AddResourcePath(kCustomElementsHTMLPath,
136 IDR_CUSTOM_ELEMENTS_OOBE_HTML); 138 IDR_CUSTOM_ELEMENTS_OOBE_HTML);
137 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); 139 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS);
138 } else if (display_type == OobeUI::kLockDisplay) { 140 } else if (display_type == OobeUI::kLockDisplay) {
139 source->SetDefaultResource(IDR_LOCK_HTML); 141 source->SetDefaultResource(IDR_LOCK_HTML);
140 source->AddResourcePath(kLockJSPath, IDR_LOCK_JS); 142 source->AddResourcePath(kLockJSPath, IDR_LOCK_JS);
141 source->AddResourcePath(kCustomElementsHTMLPath, 143 source->AddResourcePath(kCustomElementsHTMLPath,
142 IDR_CUSTOM_ELEMENTS_LOCK_HTML); 144 IDR_CUSTOM_ELEMENTS_LOCK_HTML);
143 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS); 145 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS);
144 source->AddResourcePath(kCustomElementsPinKeyboardHTMLPath, 146 source->AddResourcePath(kCustomElementsPinKeyboardHTMLPath,
145 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML); 147 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML);
146 source->AddResourcePath(kCustomElementsPinKeyboardJSPath, 148 source->AddResourcePath(kCustomElementsPinKeyboardJSPath,
147 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS); 149 IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS);
148 source->AddResourcePath(kCustomElementsUserPodHTMLPath, 150 source->AddResourcePath(kCustomElementsUserPodHTMLPath,
149 IDR_CUSTOM_ELEMENTS_USER_POD_HTML); 151 IDR_CUSTOM_ELEMENTS_USER_POD_HTML);
150 } else { 152 } else {
151 source->SetDefaultResource(IDR_LOGIN_HTML); 153 if (command_line->HasSwitch(chromeos::switches::kShowMdLogin)) {
152 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); 154 source->SetDefaultResource(IDR_MD_LOGIN_HTML);
155 source->AddResourcePath(kLoginJSPath, IDR_MD_LOGIN_JS);
156 } else {
157 source->SetDefaultResource(IDR_LOGIN_HTML);
158 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS);
159 }
153 source->AddResourcePath(kCustomElementsHTMLPath, 160 source->AddResourcePath(kCustomElementsHTMLPath,
154 IDR_CUSTOM_ELEMENTS_LOGIN_HTML); 161 IDR_CUSTOM_ELEMENTS_LOGIN_HTML);
155 source->AddResourcePath(kCustomElementsJSPath, 162 source->AddResourcePath(kCustomElementsJSPath,
156 IDR_CUSTOM_ELEMENTS_LOGIN_JS); 163 IDR_CUSTOM_ELEMENTS_LOGIN_JS);
157 source->AddResourcePath(kCustomElementsUserPodHTMLPath, 164 source->AddResourcePath(kCustomElementsUserPodHTMLPath,
158 IDR_CUSTOM_ELEMENTS_USER_POD_HTML); 165 IDR_CUSTOM_ELEMENTS_USER_POD_HTML);
159 } 166 }
160 167
161 // Required for postprocessing of Goolge PlayStore Terms. 168 // Required for postprocessing of Goolge PlayStore Terms.
162 source->AddResourcePath(kArcPlaystoreCSSPath, IDR_ARC_SUPPORT_PLAYSTORE_CSS); 169 source->AddResourcePath(kArcPlaystoreCSSPath, IDR_ARC_SUPPORT_PLAYSTORE_CSS);
(...skipping 11 matching lines...) Expand all
174 extensions::kGaiaAuthExtensionOrigin)); 181 extensions::kGaiaAuthExtensionOrigin));
175 source->OverrideContentSecurityPolicyObjectSrc( 182 source->OverrideContentSecurityPolicyObjectSrc(
176 "object-src chrome:;"); 183 "object-src chrome:;");
177 184
178 // Serve deferred resources. 185 // Serve deferred resources.
179 source->AddResourcePath(kEnrollmentHTMLPath, IDR_OOBE_ENROLLMENT_HTML); 186 source->AddResourcePath(kEnrollmentHTMLPath, IDR_OOBE_ENROLLMENT_HTML);
180 source->AddResourcePath(kEnrollmentCSSPath, IDR_OOBE_ENROLLMENT_CSS); 187 source->AddResourcePath(kEnrollmentCSSPath, IDR_OOBE_ENROLLMENT_CSS);
181 source->AddResourcePath(kEnrollmentJSPath, IDR_OOBE_ENROLLMENT_JS); 188 source->AddResourcePath(kEnrollmentJSPath, IDR_OOBE_ENROLLMENT_JS);
182 189
183 // Only add a filter when runing as test. 190 // Only add a filter when runing as test.
184 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
185 const bool is_running_test = command_line->HasSwitch(::switches::kTestName) || 191 const bool is_running_test = command_line->HasSwitch(::switches::kTestName) ||
186 command_line->HasSwitch(::switches::kTestType); 192 command_line->HasSwitch(::switches::kTestType);
187 if (is_running_test) 193 if (is_running_test)
188 source->SetRequestFilter(::test::GetTestFilesRequestFilter()); 194 source->SetRequestFilter(::test::GetTestFilesRequestFilter());
189 195
190 return source; 196 return source;
191 } 197 }
192 198
193 std::string GetDisplayType(const GURL& url) { 199 std::string GetDisplayType(const GURL& url) {
194 std::string path = url.path().size() ? url.path().substr(1) : ""; 200 std::string path = url.path().size() ? url.path().substr(1) : "";
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 g_browser_process->local_state()->GetBoolean(prefs::kOobeMdMode)) { 602 g_browser_process->local_state()->GetBoolean(prefs::kOobeMdMode)) {
597 return; 603 return;
598 } 604 }
599 605
600 base::DictionaryValue localized_strings; 606 base::DictionaryValue localized_strings;
601 GetLocalizedStrings(&localized_strings); 607 GetLocalizedStrings(&localized_strings);
602 static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings); 608 static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings);
603 } 609 }
604 610
605 } // namespace chromeos 611 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/login/md_screen_container.html ('k') | chromeos/chromeos_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698