OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/chromeos/login/wizard_controller.h" | 11 #include "chrome/browser/chromeos/login/wizard_controller.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
14 #include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h" | 14 #include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h" |
15 #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h" | |
15 #include "chrome/common/jstemplate_builder.h" | 16 #include "chrome/common/jstemplate_builder.h" |
16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
17 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
18 #include "grit/browser_resources.h" | 19 #include "grit/browser_resources.h" |
19 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
23 | 24 |
24 namespace { | 25 namespace { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 localized_strings->SetString("title", | 122 localized_strings->SetString("title", |
122 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)); | 123 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)); |
123 localized_strings->SetString("welcomeScreenTitle", | 124 localized_strings->SetString("welcomeScreenTitle", |
124 l10n_util::GetStringFUTF16(IDS_WELCOME_SCREEN_TITLE, | 125 l10n_util::GetStringFUTF16(IDS_WELCOME_SCREEN_TITLE, |
125 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); | 126 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); |
126 localized_strings->SetString("languageSelect", | 127 localized_strings->SetString("languageSelect", |
127 l10n_util::GetStringUTF16(IDS_LANGUAGE_SELECTION_SELECT)); | 128 l10n_util::GetStringUTF16(IDS_LANGUAGE_SELECTION_SELECT)); |
128 localized_strings->SetString("keyboardSelect", | 129 localized_strings->SetString("keyboardSelect", |
129 l10n_util::GetStringUTF16(IDS_KEYBOARD_SELECTION_SELECT)); | 130 l10n_util::GetStringUTF16(IDS_KEYBOARD_SELECTION_SELECT)); |
130 localized_strings->SetString("networkSelect", | 131 localized_strings->SetString("networkSelect", |
131 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_SELECT)); | 132 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_SELECT)); |
altimofeev
2011/06/07 17:02:22
duplication (you have already set it in NetworkScr
whywhat
2011/06/07 17:24:52
Done.
| |
132 localized_strings->SetString("continue", | 133 localized_strings->SetString("continue", |
133 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_CONTINUE_BUTTON)); | 134 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_CONTINUE_BUTTON)); |
134 } | 135 } |
135 | 136 |
136 void CoreOobeHandler::Initialize() { | 137 void CoreOobeHandler::Initialize() { |
137 } | 138 } |
138 | 139 |
139 void CoreOobeHandler::RegisterMessages() { | 140 void CoreOobeHandler::RegisterMessages() { |
140 web_ui_->RegisterMessageCallback(kJsApiScreenStateInitialize, | 141 web_ui_->RegisterMessageCallback(kJsApiScreenStateInitialize, |
141 NewCallback(this, &CoreOobeHandler::OnInitialized)); | 142 NewCallback(this, &CoreOobeHandler::OnInitialized)); |
142 } | 143 } |
143 | 144 |
144 void CoreOobeHandler::OnInitialized(const ListValue* args) { | 145 void CoreOobeHandler::OnInitialized(const ListValue* args) { |
145 oobe_ui_->InitializeHandlers(); | 146 oobe_ui_->InitializeHandlers(); |
146 } | 147 } |
147 | 148 |
148 // OobeUI ---------------------------------------------------------------------- | 149 // OobeUI ---------------------------------------------------------------------- |
149 | 150 |
150 OobeUI::OobeUI(TabContents* contents) | 151 OobeUI::OobeUI(TabContents* contents) |
151 : ChromeWebUI(contents), | 152 : ChromeWebUI(contents), |
152 update_screen_actor_(NULL), | 153 update_screen_actor_(NULL), |
153 network_screen_actor_(NULL), | 154 network_screen_actor_(NULL), |
154 eula_screen_actor_(NULL) { | 155 eula_screen_actor_(NULL) { |
155 scoped_ptr<DictionaryValue> localized_strings(new DictionaryValue); | 156 scoped_ptr<DictionaryValue> localized_strings(new DictionaryValue); |
156 | 157 |
157 AddOobeMessageHandler(new CoreOobeHandler(this), localized_strings.get()); | 158 AddOobeMessageHandler(new CoreOobeHandler(this), localized_strings.get()); |
158 | 159 |
160 NetworkScreenHandler* network_screen_handler = new NetworkScreenHandler; | |
161 network_screen_actor_ = network_screen_handler; | |
162 AddOobeMessageHandler(network_screen_handler, localized_strings.get()); | |
163 | |
159 EulaScreenHandler* eula_screen_handler = new EulaScreenHandler; | 164 EulaScreenHandler* eula_screen_handler = new EulaScreenHandler; |
160 eula_screen_actor_ = eula_screen_handler; | 165 eula_screen_actor_ = eula_screen_handler; |
161 AddOobeMessageHandler(eula_screen_handler, localized_strings.get()); | 166 AddOobeMessageHandler(eula_screen_handler, localized_strings.get()); |
162 | 167 |
163 OobeUIHTMLSource* html_source = | 168 OobeUIHTMLSource* html_source = |
164 new OobeUIHTMLSource(localized_strings.release()); | 169 new OobeUIHTMLSource(localized_strings.release()); |
165 // Set up the chrome://oobe/ source. | 170 // Set up the chrome://oobe/ source. |
166 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 171 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
167 } | 172 } |
168 | 173 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 return NULL; | 211 return NULL; |
207 } | 212 } |
208 | 213 |
209 void OobeUI::AddOobeMessageHandler(OobeMessageHandler* handler, | 214 void OobeUI::AddOobeMessageHandler(OobeMessageHandler* handler, |
210 DictionaryValue* localized_strings) { | 215 DictionaryValue* localized_strings) { |
211 AddMessageHandler(handler->Attach(this)); | 216 AddMessageHandler(handler->Attach(this)); |
212 handler->GetLocalizedSettings(localized_strings); | 217 handler->GetLocalizedSettings(localized_strings); |
213 } | 218 } |
214 | 219 |
215 void OobeUI::InitializeHandlers() { | 220 void OobeUI::InitializeHandlers() { |
216 std::vector<WebUIMessageHandler*>::iterator iter; | |
217 // Note, handlers_[0] is a GenericHandler used by the WebUI. | 221 // Note, handlers_[0] is a GenericHandler used by the WebUI. |
218 for (iter = handlers_.begin() + 1; iter != handlers_.end(); ++iter) { | 222 for (size_t i = 1; i < handlers_.size(); ++i) { |
219 (static_cast<OobeMessageHandler*>(*iter))->Initialize(); | 223 static_cast<OobeMessageHandler*>(handlers_[i])->Initialize(); |
220 } | 224 } |
221 } | 225 } |
222 | 226 |
223 } // namespace chromeos | 227 } // namespace chromeos |
OLD | NEW |