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