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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 OobeUI::kUserAddingDisplay, | 76 OobeUI::kUserAddingDisplay, |
77 OobeUI::kAppLaunchSplashDisplay | 77 OobeUI::kAppLaunchSplashDisplay |
78 }; | 78 }; |
79 | 79 |
80 const char kStringsJSPath[] = "strings.js"; | 80 const char kStringsJSPath[] = "strings.js"; |
81 const char kLoginJSPath[] = "login.js"; | 81 const char kLoginJSPath[] = "login.js"; |
82 const char kOobeJSPath[] = "oobe.js"; | 82 const char kOobeJSPath[] = "oobe.js"; |
83 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; | 83 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; |
84 const char kCustomElementsHTMLPath[] = "custom_elements.html"; | 84 const char kCustomElementsHTMLPath[] = "custom_elements.html"; |
85 const char kCustomElementsJSPath[] = "custom_elements.js"; | 85 const char kCustomElementsJSPath[] = "custom_elements.js"; |
| 86 const char kPolymerConfigJSPath[] = "polymer_config.js"; |
86 | 87 |
87 // Paths for deferred resource loading. | 88 // Paths for deferred resource loading. |
88 const char kEnrollmentHTMLPath[] = "enrollment.html"; | 89 const char kEnrollmentHTMLPath[] = "enrollment.html"; |
89 const char kEnrollmentCSSPath[] = "enrollment.css"; | 90 const char kEnrollmentCSSPath[] = "enrollment.css"; |
90 const char kEnrollmentJSPath[] = "enrollment.js"; | 91 const char kEnrollmentJSPath[] = "enrollment.js"; |
91 | 92 |
92 // Creates a WebUIDataSource for chrome://oobe | 93 // Creates a WebUIDataSource for chrome://oobe |
93 content::WebUIDataSource* CreateOobeUIDataSource( | 94 content::WebUIDataSource* CreateOobeUIDataSource( |
94 const base::DictionaryValue& localized_strings, | 95 const base::DictionaryValue& localized_strings, |
95 const std::string& display_type) { | 96 const std::string& display_type) { |
96 content::WebUIDataSource* source = | 97 content::WebUIDataSource* source = |
97 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | 98 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); |
98 source->AddLocalizedStrings(localized_strings); | 99 source->AddLocalizedStrings(localized_strings); |
99 source->SetJsonPath(kStringsJSPath); | 100 source->SetJsonPath(kStringsJSPath); |
100 | 101 |
101 if (display_type == OobeUI::kOobeDisplay) { | 102 if (display_type == OobeUI::kOobeDisplay) { |
102 source->SetDefaultResource(IDR_OOBE_HTML); | 103 source->SetDefaultResource(IDR_OOBE_HTML); |
103 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); | 104 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); |
104 source->AddResourcePath(kCustomElementsHTMLPath, | 105 source->AddResourcePath(kCustomElementsHTMLPath, |
105 IDR_CUSTOM_ELEMENTS_OOBE_HTML); | 106 IDR_CUSTOM_ELEMENTS_OOBE_HTML); |
106 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); | 107 source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); |
107 } else { | 108 } else { |
108 source->SetDefaultResource(IDR_LOGIN_HTML); | 109 source->SetDefaultResource(IDR_LOGIN_HTML); |
109 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); | 110 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); |
110 source->AddResourcePath(kCustomElementsHTMLPath, | 111 source->AddResourcePath(kCustomElementsHTMLPath, |
111 IDR_CUSTOM_ELEMENTS_LOGIN_HTML); | 112 IDR_CUSTOM_ELEMENTS_LOGIN_HTML); |
112 source->AddResourcePath(kCustomElementsJSPath, | 113 source->AddResourcePath(kCustomElementsJSPath, |
113 IDR_CUSTOM_ELEMENTS_LOGIN_JS); | 114 IDR_CUSTOM_ELEMENTS_LOGIN_JS); |
114 } | 115 } |
| 116 source->AddResourcePath(kPolymerConfigJSPath, IDR_POLYMER_CONFIG_JS); |
115 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); | 117 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); |
116 source->OverrideContentSecurityPolicyFrameSrc( | 118 source->OverrideContentSecurityPolicyFrameSrc( |
117 base::StringPrintf( | 119 base::StringPrintf( |
118 "frame-src chrome://terms/ %s/;", | 120 "frame-src chrome://terms/ %s/;", |
119 extensions::kGaiaAuthExtensionOrigin)); | 121 extensions::kGaiaAuthExtensionOrigin)); |
120 source->OverrideContentSecurityPolicyObjectSrc("object-src *;"); | 122 source->OverrideContentSecurityPolicyObjectSrc("object-src *;"); |
121 bool is_webview_signin_enabled = StartupUtils::IsWebviewSigninEnabled(); | 123 bool is_webview_signin_enabled = StartupUtils::IsWebviewSigninEnabled(); |
122 source->AddResourcePath("gaia_auth_host.js", is_webview_signin_enabled ? | 124 source->AddResourcePath("gaia_auth_host.js", is_webview_signin_enabled ? |
123 IDR_GAIA_AUTH_AUTHENTICATOR_JS : IDR_GAIA_AUTH_HOST_JS); | 125 IDR_GAIA_AUTH_AUTHENTICATOR_JS : IDR_GAIA_AUTH_HOST_JS); |
124 | 126 |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 DCHECK(screen_ids_.count(screen)) | 645 DCHECK(screen_ids_.count(screen)) |
644 << "Screen should be registered in InitializeScreenMaps()"; | 646 << "Screen should be registered in InitializeScreenMaps()"; |
645 Screen new_screen = screen_ids_[screen]; | 647 Screen new_screen = screen_ids_[screen]; |
646 FOR_EACH_OBSERVER(Observer, | 648 FOR_EACH_OBSERVER(Observer, |
647 observer_list_, | 649 observer_list_, |
648 OnCurrentScreenChanged(current_screen_, new_screen)); | 650 OnCurrentScreenChanged(current_screen_, new_screen)); |
649 current_screen_ = new_screen; | 651 current_screen_ = new_screen; |
650 } | 652 } |
651 | 653 |
652 } // namespace chromeos | 654 } // namespace chromeos |
OLD | NEW |