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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 namespace chromeos { | 68 namespace chromeos { |
69 | 69 |
70 namespace { | 70 namespace { |
71 | 71 |
72 const char* kKnownDisplayTypes[] = { | 72 const char* kKnownDisplayTypes[] = { |
73 OobeUI::kOobeDisplay, | 73 OobeUI::kOobeDisplay, |
74 OobeUI::kLoginDisplay, | 74 OobeUI::kLoginDisplay, |
75 OobeUI::kLockDisplay, | 75 OobeUI::kLockDisplay, |
76 OobeUI::kUserAddingDisplay, | 76 OobeUI::kUserAddingDisplay, |
77 OobeUI::kAppLaunchSplashDisplay, | 77 OobeUI::kAppLaunchSplashDisplay |
78 OobeUI::kNewOobeDisplay | |
79 }; | 78 }; |
80 | 79 |
81 const char kStringsJSPath[] = "strings.js"; | 80 const char kStringsJSPath[] = "strings.js"; |
82 const char kLoginJSPath[] = "login.js"; | 81 const char kLoginJSPath[] = "login.js"; |
83 const char kOobeJSPath[] = "oobe.js"; | 82 const char kOobeJSPath[] = "oobe.js"; |
84 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; | 83 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; |
85 const char kCustomElementsHTMLPath[] = "custom_elements.html"; | 84 const char kCustomElementsHTMLPath[] = "custom_elements.html"; |
86 const char kCustomElementsJSPath[] = "custom_elements.js"; | 85 const char kCustomElementsJSPath[] = "custom_elements.js"; |
87 | 86 |
88 // Paths for deferred resource loading. | 87 // Paths for deferred resource loading. |
89 const char kEnrollmentHTMLPath[] = "enrollment.html"; | 88 const char kEnrollmentHTMLPath[] = "enrollment.html"; |
90 const char kEnrollmentCSSPath[] = "enrollment.css"; | 89 const char kEnrollmentCSSPath[] = "enrollment.css"; |
91 const char kEnrollmentJSPath[] = "enrollment.js"; | 90 const char kEnrollmentJSPath[] = "enrollment.js"; |
92 | 91 |
93 content::WebUIDataSource* CreateNewOobeUIDataSource( | |
94 const base::DictionaryValue& localized_strings) { | |
95 content::WebUIDataSource* source = | |
96 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | |
97 source->AddLocalizedStrings(localized_strings); | |
98 source->SetJsonPath(kStringsJSPath); | |
99 source->SetDefaultResource(IDR_NEW_OOBE_HTML); | |
100 source->AddResourcePath(kOobeJSPath, IDR_NEW_OOBE_JS); | |
101 return source; | |
102 } | |
103 | |
104 // Creates a WebUIDataSource for chrome://oobe | 92 // Creates a WebUIDataSource for chrome://oobe |
105 content::WebUIDataSource* CreateOobeUIDataSource( | 93 content::WebUIDataSource* CreateOobeUIDataSource( |
106 const base::DictionaryValue& localized_strings, | 94 const base::DictionaryValue& localized_strings, |
107 const std::string& display_type) { | 95 const std::string& display_type) { |
108 if (display_type == OobeUI::kNewOobeDisplay) { | |
109 return CreateNewOobeUIDataSource(localized_strings); | |
110 } | |
111 content::WebUIDataSource* source = | 96 content::WebUIDataSource* source = |
112 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | 97 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); |
113 source->AddLocalizedStrings(localized_strings); | 98 source->AddLocalizedStrings(localized_strings); |
114 source->SetJsonPath(kStringsJSPath); | 99 source->SetJsonPath(kStringsJSPath); |
115 | 100 |
116 if (display_type == OobeUI::kOobeDisplay) { | 101 if (display_type == OobeUI::kOobeDisplay) { |
117 source->SetDefaultResource(IDR_OOBE_HTML); | 102 source->SetDefaultResource(IDR_OOBE_HTML); |
118 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); | 103 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); |
119 } else { | 104 } else { |
120 source->SetDefaultResource(IDR_LOGIN_HTML); | 105 source->SetDefaultResource(IDR_LOGIN_HTML); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 146 } |
162 | 147 |
163 } // namespace | 148 } // namespace |
164 | 149 |
165 // static | 150 // static |
166 const char OobeUI::kOobeDisplay[] = "oobe"; | 151 const char OobeUI::kOobeDisplay[] = "oobe"; |
167 const char OobeUI::kLoginDisplay[] = "login"; | 152 const char OobeUI::kLoginDisplay[] = "login"; |
168 const char OobeUI::kLockDisplay[] = "lock"; | 153 const char OobeUI::kLockDisplay[] = "lock"; |
169 const char OobeUI::kUserAddingDisplay[] = "user-adding"; | 154 const char OobeUI::kUserAddingDisplay[] = "user-adding"; |
170 const char OobeUI::kAppLaunchSplashDisplay[] = "app-launch-splash"; | 155 const char OobeUI::kAppLaunchSplashDisplay[] = "app-launch-splash"; |
171 const char OobeUI::kNewOobeDisplay[] = "new-oobe"; | |
172 | 156 |
173 // static | 157 // static |
174 const char OobeUI::kScreenOobeHIDDetection[] = "hid-detection"; | 158 const char OobeUI::kScreenOobeHIDDetection[] = "hid-detection"; |
175 const char OobeUI::kScreenOobeNetwork[] = "connect"; | 159 const char OobeUI::kScreenOobeNetwork[] = "connect"; |
176 const char OobeUI::kScreenOobeEnableDebugging[] = "debugging"; | 160 const char OobeUI::kScreenOobeEnableDebugging[] = "debugging"; |
177 const char OobeUI::kScreenOobeEula[] = "eula"; | 161 const char OobeUI::kScreenOobeEula[] = "eula"; |
178 const char OobeUI::kScreenOobeUpdate[] = "update"; | 162 const char OobeUI::kScreenOobeUpdate[] = "update"; |
179 const char OobeUI::kScreenOobeEnrollment[] = "oauth-enrollment"; | 163 const char OobeUI::kScreenOobeEnrollment[] = "oauth-enrollment"; |
180 const char OobeUI::kScreenOobeReset[] = "reset"; | 164 const char OobeUI::kScreenOobeReset[] = "reset"; |
181 const char OobeUI::kScreenGaiaSignin[] = "gaia-signin"; | 165 const char OobeUI::kScreenGaiaSignin[] = "gaia-signin"; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 AddScreenHandler(core_handler_); | 220 AddScreenHandler(core_handler_); |
237 core_handler_->SetDelegate(this); | 221 core_handler_->SetDelegate(this); |
238 | 222 |
239 network_dropdown_handler_ = new NetworkDropdownHandler(); | 223 network_dropdown_handler_ = new NetworkDropdownHandler(); |
240 AddScreenHandler(network_dropdown_handler_); | 224 AddScreenHandler(network_dropdown_handler_); |
241 | 225 |
242 update_screen_handler_ = new UpdateScreenHandler(); | 226 update_screen_handler_ = new UpdateScreenHandler(); |
243 AddScreenHandler(update_screen_handler_); | 227 AddScreenHandler(update_screen_handler_); |
244 network_dropdown_handler_->AddObserver(update_screen_handler_); | 228 network_dropdown_handler_->AddObserver(update_screen_handler_); |
245 | 229 |
246 if (display_type_ == kOobeDisplay || display_type_ == kNewOobeDisplay) { | 230 if (display_type_ == kOobeDisplay) { |
247 NetworkScreenHandler* network_screen_handler = | 231 NetworkScreenHandler* network_screen_handler = |
248 new NetworkScreenHandler(core_handler_); | 232 new NetworkScreenHandler(core_handler_); |
249 network_view_ = network_screen_handler; | 233 network_view_ = network_screen_handler; |
250 AddScreenHandler(network_screen_handler); | 234 AddScreenHandler(network_screen_handler); |
251 } | 235 } |
252 | 236 |
253 EnableDebuggingScreenHandler* debugging_screen_handler = | 237 EnableDebuggingScreenHandler* debugging_screen_handler = |
254 new EnableDebuggingScreenHandler(); | 238 new EnableDebuggingScreenHandler(); |
255 debugging_screen_actor_ = debugging_screen_handler; | 239 debugging_screen_actor_ = debugging_screen_handler; |
256 AddScreenHandler(debugging_screen_handler); | 240 AddScreenHandler(debugging_screen_handler); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 DCHECK(screen_ids_.count(screen)) | 639 DCHECK(screen_ids_.count(screen)) |
656 << "Screen should be registered in InitializeScreenMaps()"; | 640 << "Screen should be registered in InitializeScreenMaps()"; |
657 Screen new_screen = screen_ids_[screen]; | 641 Screen new_screen = screen_ids_[screen]; |
658 FOR_EACH_OBSERVER(Observer, | 642 FOR_EACH_OBSERVER(Observer, |
659 observer_list_, | 643 observer_list_, |
660 OnCurrentScreenChanged(current_screen_, new_screen)); | 644 OnCurrentScreenChanged(current_screen_, new_screen)); |
661 current_screen_ = new_screen; | 645 current_screen_ = new_screen; |
662 } | 646 } |
663 | 647 |
664 } // namespace chromeos | 648 } // namespace chromeos |
OLD | NEW |