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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 shill::kPaymentPortalURL, &payment_url); | 101 shill::kPaymentPortalURL, &payment_url); |
102 payment_dict->GetStringWithoutPathExpansion( | 102 payment_dict->GetStringWithoutPathExpansion( |
103 shill::kPaymentPortalMethod, &post_method); | 103 shill::kPaymentPortalMethod, &post_method); |
104 payment_dict->GetStringWithoutPathExpansion( | 104 payment_dict->GetStringWithoutPathExpansion( |
105 shill::kPaymentPortalPostData, &post_data); | 105 shill::kPaymentPortalPostData, &post_data); |
106 } | 106 } |
107 | 107 |
108 value->SetString("activation_type", activation_type); | 108 value->SetString("activation_type", activation_type); |
109 value->SetString("carrier", name); | 109 value->SetString("carrier", name); |
110 value->SetString("payment_url", payment_url); | 110 value->SetString("payment_url", payment_url); |
111 if (LowerCaseEqualsASCII(post_method, "post") && !post_data.empty()) | 111 if (base::LowerCaseEqualsASCII(post_method, "post") && !post_data.empty()) |
112 value->SetString("post_data", post_data); | 112 value->SetString("post_data", post_data); |
113 | 113 |
114 // Use the cached DeviceState properties. | 114 // Use the cached DeviceState properties. |
115 std::string device_path; | 115 std::string device_path; |
116 if (!properties.GetStringWithoutPathExpansion( | 116 if (!properties.GetStringWithoutPathExpansion( |
117 shill::kDeviceProperty, &device_path) || | 117 shill::kDeviceProperty, &device_path) || |
118 device_path.empty()) { | 118 device_path.empty()) { |
119 return; | 119 return; |
120 } | 120 } |
121 const chromeos::DeviceState* device = | 121 const chromeos::DeviceState* device = |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 457 |
458 const size_t kSetTransactionStatusParamCount = 1; | 458 const size_t kSetTransactionStatusParamCount = 1; |
459 if (args->GetSize() != kSetTransactionStatusParamCount) | 459 if (args->GetSize() != kSetTransactionStatusParamCount) |
460 return; | 460 return; |
461 // Get change callback function name. | 461 // Get change callback function name. |
462 std::string status; | 462 std::string status; |
463 if (!args->GetString(0, &status)) | 463 if (!args->GetString(0, &status)) |
464 return; | 464 return; |
465 | 465 |
466 MobileActivator::GetInstance()->OnSetTransactionStatus( | 466 MobileActivator::GetInstance()->OnSetTransactionStatus( |
467 LowerCaseEqualsASCII(status, kJsApiResultOK)); | 467 base::LowerCaseEqualsASCII(status, kJsApiResultOK)); |
468 } | 468 } |
469 | 469 |
470 void MobileSetupHandler::HandlePaymentPortalLoad(const base::ListValue* args) { | 470 void MobileSetupHandler::HandlePaymentPortalLoad(const base::ListValue* args) { |
471 // Only activation flow webui is interested in these events. | 471 // Only activation flow webui is interested in these events. |
472 if (type_ != TYPE_ACTIVATION || !web_ui()) | 472 if (type_ != TYPE_ACTIVATION || !web_ui()) |
473 return; | 473 return; |
474 | 474 |
475 const size_t kPaymentPortalLoadParamCount = 1; | 475 const size_t kPaymentPortalLoadParamCount = 1; |
476 if (args->GetSize() != kPaymentPortalLoadParamCount) | 476 if (args->GetSize() != kPaymentPortalLoadParamCount) |
477 return; | 477 return; |
478 // Get change callback function name. | 478 // Get change callback function name. |
479 std::string result; | 479 std::string result; |
480 if (!args->GetString(0, &result)) | 480 if (!args->GetString(0, &result)) |
481 return; | 481 return; |
482 | 482 |
483 MobileActivator::GetInstance()->OnPortalLoaded( | 483 MobileActivator::GetInstance()->OnPortalLoaded( |
484 LowerCaseEqualsASCII(result, kJsApiResultOK)); | 484 base::LowerCaseEqualsASCII(result, kJsApiResultOK)); |
485 } | 485 } |
486 | 486 |
487 void MobileSetupHandler::HandleGetDeviceInfo(const base::ListValue* args) { | 487 void MobileSetupHandler::HandleGetDeviceInfo(const base::ListValue* args) { |
488 DCHECK_NE(TYPE_ACTIVATION, type_); | 488 DCHECK_NE(TYPE_ACTIVATION, type_); |
489 if (!web_ui()) | 489 if (!web_ui()) |
490 return; | 490 return; |
491 | 491 |
492 std::string path = web_ui()->GetWebContents()->GetURL().path(); | 492 std::string path = web_ui()->GetWebContents()->GetURL().path(); |
493 if (path.empty()) | 493 if (path.empty()) |
494 return; | 494 return; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 const GURL& validated_url, | 641 const GURL& validated_url, |
642 int error_code, | 642 int error_code, |
643 const base::string16& error_description) { | 643 const base::string16& error_description) { |
644 if (render_frame_host->GetFrameName() != "paymentForm") | 644 if (render_frame_host->GetFrameName() != "paymentForm") |
645 return; | 645 return; |
646 | 646 |
647 base::FundamentalValue result_value(-error_code); | 647 base::FundamentalValue result_value(-error_code); |
648 web_ui()->CallJavascriptFunction(kJsPortalFrameLoadFailedCallback, | 648 web_ui()->CallJavascriptFunction(kJsPortalFrameLoadFailedCallback, |
649 result_value); | 649 result_value); |
650 } | 650 } |
OLD | NEW |