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/mobile_setup_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 ~MobileSetupUIHTMLSource() override {} | 162 ~MobileSetupUIHTMLSource() override {} |
163 | 163 |
164 void GetPropertiesAndStartDataRequest( | 164 void GetPropertiesAndStartDataRequest( |
165 const content::URLDataSource::GotDataCallback& callback, | 165 const content::URLDataSource::GotDataCallback& callback, |
166 const std::string& service_path, | 166 const std::string& service_path, |
167 const base::DictionaryValue& properties); | 167 const base::DictionaryValue& properties); |
168 void GetPropertiesFailure( | 168 void GetPropertiesFailure( |
169 const content::URLDataSource::GotDataCallback& callback, | 169 const content::URLDataSource::GotDataCallback& callback, |
170 const std::string& service_path, | 170 const std::string& service_path, |
171 const std::string& error_name, | 171 const std::string& error_name, |
172 scoped_ptr<base::DictionaryValue> error_data); | 172 std::unique_ptr<base::DictionaryValue> error_data); |
173 | 173 |
174 base::WeakPtrFactory<MobileSetupUIHTMLSource> weak_ptr_factory_; | 174 base::WeakPtrFactory<MobileSetupUIHTMLSource> weak_ptr_factory_; |
175 | 175 |
176 DISALLOW_COPY_AND_ASSIGN(MobileSetupUIHTMLSource); | 176 DISALLOW_COPY_AND_ASSIGN(MobileSetupUIHTMLSource); |
177 }; | 177 }; |
178 | 178 |
179 // The handler for Javascript messages related to the "register" view. | 179 // The handler for Javascript messages related to the "register" view. |
180 class MobileSetupHandler | 180 class MobileSetupHandler |
181 : public WebUIMessageHandler, | 181 : public WebUIMessageHandler, |
182 public MobileActivator::Observer, | 182 public MobileActivator::Observer, |
(...skipping 26 matching lines...) Expand all Loading... |
209 | 209 |
210 // Callbacks for NetworkConfigurationHandler::GetProperties. | 210 // Callbacks for NetworkConfigurationHandler::GetProperties. |
211 void GetPropertiesAndCallStatusChanged( | 211 void GetPropertiesAndCallStatusChanged( |
212 MobileActivator::PlanActivationState state, | 212 MobileActivator::PlanActivationState state, |
213 const std::string& error_description, | 213 const std::string& error_description, |
214 const std::string& service_path, | 214 const std::string& service_path, |
215 const base::DictionaryValue& properties); | 215 const base::DictionaryValue& properties); |
216 void GetPropertiesAndCallGetDeviceInfo( | 216 void GetPropertiesAndCallGetDeviceInfo( |
217 const std::string& service_path, | 217 const std::string& service_path, |
218 const base::DictionaryValue& properties); | 218 const base::DictionaryValue& properties); |
219 void GetPropertiesFailure( | 219 void GetPropertiesFailure(const std::string& service_path, |
220 const std::string& service_path, | 220 const std::string& callback_name, |
221 const std::string& callback_name, | 221 const std::string& error_name, |
222 const std::string& error_name, | 222 std::unique_ptr<base::DictionaryValue> error_data); |
223 scoped_ptr<base::DictionaryValue> error_data); | |
224 | 223 |
225 // Handlers for JS WebUI messages. | 224 // Handlers for JS WebUI messages. |
226 void HandleSetTransactionStatus(const base::ListValue* args); | 225 void HandleSetTransactionStatus(const base::ListValue* args); |
227 void HandleStartActivation(const base::ListValue* args); | 226 void HandleStartActivation(const base::ListValue* args); |
228 void HandlePaymentPortalLoad(const base::ListValue* args); | 227 void HandlePaymentPortalLoad(const base::ListValue* args); |
229 void HandleGetDeviceInfo(const base::ListValue* args); | 228 void HandleGetDeviceInfo(const base::ListValue* args); |
230 | 229 |
231 // NetworkStateHandlerObserver implementation. | 230 // NetworkStateHandlerObserver implementation. |
232 void NetworkConnectionStateChanged(const NetworkState* network) override; | 231 void NetworkConnectionStateChanged(const NetworkState* network) override; |
233 void DefaultNetworkChanged(const NetworkState* default_network) override; | 232 void DefaultNetworkChanged(const NetworkState* default_network) override; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 full_html = webui::GetI18nTemplateHtml(html_for_non_activated, &strings); | 351 full_html = webui::GetI18nTemplateHtml(html_for_non_activated, &strings); |
353 } | 352 } |
354 | 353 |
355 callback.Run(base::RefCountedString::TakeString(&full_html)); | 354 callback.Run(base::RefCountedString::TakeString(&full_html)); |
356 } | 355 } |
357 | 356 |
358 void MobileSetupUIHTMLSource::GetPropertiesFailure( | 357 void MobileSetupUIHTMLSource::GetPropertiesFailure( |
359 const content::URLDataSource::GotDataCallback& callback, | 358 const content::URLDataSource::GotDataCallback& callback, |
360 const std::string& service_path, | 359 const std::string& service_path, |
361 const std::string& error_name, | 360 const std::string& error_name, |
362 scoped_ptr<base::DictionaryValue> error_data) { | 361 std::unique_ptr<base::DictionaryValue> error_data) { |
363 DataRequestFailed(service_path, callback); | 362 DataRequestFailed(service_path, callback); |
364 } | 363 } |
365 | 364 |
366 //////////////////////////////////////////////////////////////////////////////// | 365 //////////////////////////////////////////////////////////////////////////////// |
367 // | 366 // |
368 // MobileSetupHandler | 367 // MobileSetupHandler |
369 // | 368 // |
370 //////////////////////////////////////////////////////////////////////////////// | 369 //////////////////////////////////////////////////////////////////////////////// |
371 MobileSetupHandler::MobileSetupHandler() | 370 MobileSetupHandler::MobileSetupHandler() |
372 : type_(TYPE_UNDETERMINED), | 371 : type_(TYPE_UNDETERMINED), |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 const base::DictionaryValue& properties) { | 540 const base::DictionaryValue& properties) { |
542 base::DictionaryValue device_info; | 541 base::DictionaryValue device_info; |
543 GetDeviceInfo(properties, &device_info); | 542 GetDeviceInfo(properties, &device_info); |
544 web_ui()->CallJavascriptFunction(kJsGetDeviceInfoCallback, device_info); | 543 web_ui()->CallJavascriptFunction(kJsGetDeviceInfoCallback, device_info); |
545 } | 544 } |
546 | 545 |
547 void MobileSetupHandler::GetPropertiesFailure( | 546 void MobileSetupHandler::GetPropertiesFailure( |
548 const std::string& service_path, | 547 const std::string& service_path, |
549 const std::string& callback_name, | 548 const std::string& callback_name, |
550 const std::string& error_name, | 549 const std::string& error_name, |
551 scoped_ptr<base::DictionaryValue> error_data) { | 550 std::unique_ptr<base::DictionaryValue> error_data) { |
552 NET_LOG_ERROR("MobileActivator GetProperties Failed: " + error_name, | 551 NET_LOG_ERROR("MobileActivator GetProperties Failed: " + error_name, |
553 service_path); | 552 service_path); |
554 // Invoke |callback_name| with an empty dictionary. | 553 // Invoke |callback_name| with an empty dictionary. |
555 base::DictionaryValue device_dict; | 554 base::DictionaryValue device_dict; |
556 web_ui()->CallJavascriptFunction(callback_name, device_dict); | 555 web_ui()->CallJavascriptFunction(callback_name, device_dict); |
557 } | 556 } |
558 | 557 |
559 void MobileSetupHandler::DefaultNetworkChanged( | 558 void MobileSetupHandler::DefaultNetworkChanged( |
560 const NetworkState* default_network) { | 559 const NetworkState* default_network) { |
561 if (!web_ui()) | 560 if (!web_ui()) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 int error_code, | 644 int error_code, |
646 const base::string16& error_description, | 645 const base::string16& error_description, |
647 bool was_ignored_by_handler) { | 646 bool was_ignored_by_handler) { |
648 if (render_frame_host->GetFrameName() != "paymentForm") | 647 if (render_frame_host->GetFrameName() != "paymentForm") |
649 return; | 648 return; |
650 | 649 |
651 base::FundamentalValue result_value(-error_code); | 650 base::FundamentalValue result_value(-error_code); |
652 web_ui()->CallJavascriptFunction(kJsPortalFrameLoadFailedCallback, | 651 web_ui()->CallJavascriptFunction(kJsPortalFrameLoadFailedCallback, |
653 result_value); | 652 result_value); |
654 } | 653 } |
OLD | NEW |