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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 shill::kPaymentPortalURL, &payment_url); | 102 shill::kPaymentPortalURL, &payment_url); |
103 payment_dict->GetStringWithoutPathExpansion( | 103 payment_dict->GetStringWithoutPathExpansion( |
104 shill::kPaymentPortalMethod, &post_method); | 104 shill::kPaymentPortalMethod, &post_method); |
105 payment_dict->GetStringWithoutPathExpansion( | 105 payment_dict->GetStringWithoutPathExpansion( |
106 shill::kPaymentPortalPostData, &post_data); | 106 shill::kPaymentPortalPostData, &post_data); |
107 } | 107 } |
108 | 108 |
109 value->SetString("activation_type", activation_type); | 109 value->SetString("activation_type", activation_type); |
110 value->SetString("carrier", name); | 110 value->SetString("carrier", name); |
111 value->SetString("payment_url", payment_url); | 111 value->SetString("payment_url", payment_url); |
112 if (base::LowerCaseEqualsASCII(post_method, "post") && !post_data.empty()) | 112 if (LowerCaseEqualsASCII(post_method, "post") && !post_data.empty()) |
113 value->SetString("post_data", post_data); | 113 value->SetString("post_data", post_data); |
114 | 114 |
115 // Use the cached DeviceState properties. | 115 // Use the cached DeviceState properties. |
116 std::string device_path; | 116 std::string device_path; |
117 if (!properties.GetStringWithoutPathExpansion( | 117 if (!properties.GetStringWithoutPathExpansion( |
118 shill::kDeviceProperty, &device_path) || | 118 shill::kDeviceProperty, &device_path) || |
119 device_path.empty()) { | 119 device_path.empty()) { |
120 return; | 120 return; |
121 } | 121 } |
122 const chromeos::DeviceState* device = | 122 const chromeos::DeviceState* device = |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 466 |
467 const size_t kSetTransactionStatusParamCount = 1; | 467 const size_t kSetTransactionStatusParamCount = 1; |
468 if (args->GetSize() != kSetTransactionStatusParamCount) | 468 if (args->GetSize() != kSetTransactionStatusParamCount) |
469 return; | 469 return; |
470 // Get change callback function name. | 470 // Get change callback function name. |
471 std::string status; | 471 std::string status; |
472 if (!args->GetString(0, &status)) | 472 if (!args->GetString(0, &status)) |
473 return; | 473 return; |
474 | 474 |
475 MobileActivator::GetInstance()->OnSetTransactionStatus( | 475 MobileActivator::GetInstance()->OnSetTransactionStatus( |
476 base::LowerCaseEqualsASCII(status, kJsApiResultOK)); | 476 LowerCaseEqualsASCII(status, kJsApiResultOK)); |
477 } | 477 } |
478 | 478 |
479 void MobileSetupHandler::HandlePaymentPortalLoad(const base::ListValue* args) { | 479 void MobileSetupHandler::HandlePaymentPortalLoad(const base::ListValue* args) { |
480 // Only activation flow webui is interested in these events. | 480 // Only activation flow webui is interested in these events. |
481 if (type_ != TYPE_ACTIVATION || !web_ui()) | 481 if (type_ != TYPE_ACTIVATION || !web_ui()) |
482 return; | 482 return; |
483 | 483 |
484 const size_t kPaymentPortalLoadParamCount = 1; | 484 const size_t kPaymentPortalLoadParamCount = 1; |
485 if (args->GetSize() != kPaymentPortalLoadParamCount) | 485 if (args->GetSize() != kPaymentPortalLoadParamCount) |
486 return; | 486 return; |
487 // Get change callback function name. | 487 // Get change callback function name. |
488 std::string result; | 488 std::string result; |
489 if (!args->GetString(0, &result)) | 489 if (!args->GetString(0, &result)) |
490 return; | 490 return; |
491 | 491 |
492 MobileActivator::GetInstance()->OnPortalLoaded( | 492 MobileActivator::GetInstance()->OnPortalLoaded( |
493 base::LowerCaseEqualsASCII(result, kJsApiResultOK)); | 493 LowerCaseEqualsASCII(result, kJsApiResultOK)); |
494 } | 494 } |
495 | 495 |
496 void MobileSetupHandler::HandleGetDeviceInfo(const base::ListValue* args) { | 496 void MobileSetupHandler::HandleGetDeviceInfo(const base::ListValue* args) { |
497 DCHECK_NE(TYPE_ACTIVATION, type_); | 497 DCHECK_NE(TYPE_ACTIVATION, type_); |
498 if (!web_ui()) | 498 if (!web_ui()) |
499 return; | 499 return; |
500 | 500 |
501 std::string path = web_ui()->GetWebContents()->GetURL().path(); | 501 std::string path = web_ui()->GetWebContents()->GetURL().path(); |
502 if (path.empty()) | 502 if (path.empty()) |
503 return; | 503 return; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 const GURL& validated_url, | 651 const GURL& validated_url, |
652 int error_code, | 652 int error_code, |
653 const base::string16& error_description) { | 653 const base::string16& error_description) { |
654 if (render_frame_host->GetFrameName() != "paymentForm") | 654 if (render_frame_host->GetFrameName() != "paymentForm") |
655 return; | 655 return; |
656 | 656 |
657 base::FundamentalValue result_value(-error_code); | 657 base::FundamentalValue result_value(-error_code); |
658 web_ui()->CallJavascriptFunction(kJsPortalFrameLoadFailedCallback, | 658 web_ui()->CallJavascriptFunction(kJsPortalFrameLoadFailedCallback, |
659 result_value); | 659 result_value); |
660 } | 660 } |
OLD | NEW |