| 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 nsh->AddObserver(this, FROM_HERE); | 514 nsh->AddObserver(this, FROM_HERE); |
| 515 // Update the network status and notify the webui. This is the initial | 515 // Update the network status and notify the webui. This is the initial |
| 516 // network state so the webui should be notified no matter what. | 516 // network state so the webui should be notified no matter what. |
| 517 UpdatePortalReachability(network, | 517 UpdatePortalReachability(network, |
| 518 true /* force notification */); | 518 true /* force notification */); |
| 519 } else { | 519 } else { |
| 520 type_ = TYPE_PORTAL; | 520 type_ = TYPE_PORTAL; |
| 521 // For non-LTE networks network state is ignored, so report the portal is | 521 // For non-LTE networks network state is ignored, so report the portal is |
| 522 // reachable, so it gets shown. | 522 // reachable, so it gets shown. |
| 523 web_ui()->CallJavascriptFunctionUnsafe(kJsConnectivityChangedCallback, | 523 web_ui()->CallJavascriptFunctionUnsafe(kJsConnectivityChangedCallback, |
| 524 base::FundamentalValue(true)); | 524 base::Value(true)); |
| 525 } | 525 } |
| 526 } | 526 } |
| 527 | 527 |
| 528 NetworkHandler::Get()->network_configuration_handler()->GetShillProperties( | 528 NetworkHandler::Get()->network_configuration_handler()->GetShillProperties( |
| 529 network->path(), | 529 network->path(), |
| 530 base::Bind(&MobileSetupHandler::GetPropertiesAndCallGetDeviceInfo, | 530 base::Bind(&MobileSetupHandler::GetPropertiesAndCallGetDeviceInfo, |
| 531 weak_ptr_factory_.GetWeakPtr()), | 531 weak_ptr_factory_.GetWeakPtr()), |
| 532 base::Bind(&MobileSetupHandler::GetPropertiesFailure, | 532 base::Bind(&MobileSetupHandler::GetPropertiesFailure, |
| 533 weak_ptr_factory_.GetWeakPtr(), network->path(), | 533 weak_ptr_factory_.GetWeakPtr(), network->path(), |
| 534 kJsGetDeviceInfoCallback)); | 534 kJsGetDeviceInfoCallback)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 chromeos::NetworkStateHandler* nsh = | 596 chromeos::NetworkStateHandler* nsh = |
| 597 NetworkHandler::Get()->network_state_handler(); | 597 NetworkHandler::Get()->network_state_handler(); |
| 598 bool portal_reachable = | 598 bool portal_reachable = |
| 599 (network->IsConnectedState() || | 599 (network->IsConnectedState() || |
| 600 (nsh->DefaultNetwork() && | 600 (nsh->DefaultNetwork() && |
| 601 nsh->DefaultNetwork()->connection_state() == shill::kStateOnline)); | 601 nsh->DefaultNetwork()->connection_state() == shill::kStateOnline)); |
| 602 | 602 |
| 603 if (force_notification || portal_reachable != lte_portal_reachable_) { | 603 if (force_notification || portal_reachable != lte_portal_reachable_) { |
| 604 web_ui()->CallJavascriptFunctionUnsafe( | 604 web_ui()->CallJavascriptFunctionUnsafe( |
| 605 kJsConnectivityChangedCallback, | 605 kJsConnectivityChangedCallback, |
| 606 base::FundamentalValue(portal_reachable)); | 606 base::Value(portal_reachable)); |
| 607 } | 607 } |
| 608 | 608 |
| 609 lte_portal_reachable_ = portal_reachable; | 609 lte_portal_reachable_ = portal_reachable; |
| 610 } | 610 } |
| 611 | 611 |
| 612 //////////////////////////////////////////////////////////////////////////////// | 612 //////////////////////////////////////////////////////////////////////////////// |
| 613 // | 613 // |
| 614 // MobileSetupUI | 614 // MobileSetupUI |
| 615 // | 615 // |
| 616 //////////////////////////////////////////////////////////////////////////////// | 616 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 22 matching lines...) Expand all Loading... |
| 639 | 639 |
| 640 void MobileSetupUI::DidFailProvisionalLoad( | 640 void MobileSetupUI::DidFailProvisionalLoad( |
| 641 content::RenderFrameHost* render_frame_host, | 641 content::RenderFrameHost* render_frame_host, |
| 642 const GURL& validated_url, | 642 const GURL& validated_url, |
| 643 int error_code, | 643 int error_code, |
| 644 const base::string16& error_description, | 644 const base::string16& error_description, |
| 645 bool was_ignored_by_handler) { | 645 bool was_ignored_by_handler) { |
| 646 if (render_frame_host->GetFrameName() != "paymentForm") | 646 if (render_frame_host->GetFrameName() != "paymentForm") |
| 647 return; | 647 return; |
| 648 | 648 |
| 649 base::FundamentalValue result_value(-error_code); | 649 base::Value result_value(-error_code); |
| 650 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadFailedCallback, | 650 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadFailedCallback, |
| 651 result_value); | 651 result_value); |
| 652 } | 652 } |
| OLD | NEW |