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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 nsh->AddObserver(this, FROM_HERE); | 516 nsh->AddObserver(this, FROM_HERE); |
517 // Update the network status and notify the webui. This is the initial | 517 // Update the network status and notify the webui. This is the initial |
518 // network state so the webui should be notified no matter what. | 518 // network state so the webui should be notified no matter what. |
519 UpdatePortalReachability(network, | 519 UpdatePortalReachability(network, |
520 true /* force notification */); | 520 true /* force notification */); |
521 } else { | 521 } else { |
522 type_ = TYPE_PORTAL; | 522 type_ = TYPE_PORTAL; |
523 // For non-LTE networks network state is ignored, so report the portal is | 523 // For non-LTE networks network state is ignored, so report the portal is |
524 // reachable, so it gets shown. | 524 // reachable, so it gets shown. |
525 web_ui()->CallJavascriptFunctionUnsafe(kJsConnectivityChangedCallback, | 525 web_ui()->CallJavascriptFunctionUnsafe(kJsConnectivityChangedCallback, |
526 base::FundamentalValue(true)); | 526 base::Value(true)); |
527 } | 527 } |
528 } | 528 } |
529 | 529 |
530 NetworkHandler::Get()->network_configuration_handler()->GetShillProperties( | 530 NetworkHandler::Get()->network_configuration_handler()->GetShillProperties( |
531 network->path(), | 531 network->path(), |
532 base::Bind(&MobileSetupHandler::GetPropertiesAndCallGetDeviceInfo, | 532 base::Bind(&MobileSetupHandler::GetPropertiesAndCallGetDeviceInfo, |
533 weak_ptr_factory_.GetWeakPtr()), | 533 weak_ptr_factory_.GetWeakPtr()), |
534 base::Bind(&MobileSetupHandler::GetPropertiesFailure, | 534 base::Bind(&MobileSetupHandler::GetPropertiesFailure, |
535 weak_ptr_factory_.GetWeakPtr(), network->path(), | 535 weak_ptr_factory_.GetWeakPtr(), network->path(), |
536 kJsGetDeviceInfoCallback)); | 536 kJsGetDeviceInfoCallback)); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 DCHECK_EQ(type_, TYPE_PORTAL_LTE); | 596 DCHECK_EQ(type_, TYPE_PORTAL_LTE); |
597 | 597 |
598 chromeos::NetworkStateHandler* nsh = | 598 chromeos::NetworkStateHandler* nsh = |
599 NetworkHandler::Get()->network_state_handler(); | 599 NetworkHandler::Get()->network_state_handler(); |
600 bool portal_reachable = | 600 bool portal_reachable = |
601 (network->IsConnectedState() || | 601 (network->IsConnectedState() || |
602 (nsh->DefaultNetwork() && | 602 (nsh->DefaultNetwork() && |
603 nsh->DefaultNetwork()->connection_state() == shill::kStateOnline)); | 603 nsh->DefaultNetwork()->connection_state() == shill::kStateOnline)); |
604 | 604 |
605 if (force_notification || portal_reachable != lte_portal_reachable_) { | 605 if (force_notification || portal_reachable != lte_portal_reachable_) { |
606 web_ui()->CallJavascriptFunctionUnsafe( | 606 web_ui()->CallJavascriptFunctionUnsafe(kJsConnectivityChangedCallback, |
607 kJsConnectivityChangedCallback, | 607 base::Value(portal_reachable)); |
608 base::FundamentalValue(portal_reachable)); | |
609 } | 608 } |
610 | 609 |
611 lte_portal_reachable_ = portal_reachable; | 610 lte_portal_reachable_ = portal_reachable; |
612 } | 611 } |
613 | 612 |
614 //////////////////////////////////////////////////////////////////////////////// | 613 //////////////////////////////////////////////////////////////////////////////// |
615 // | 614 // |
616 // MobileSetupUI | 615 // MobileSetupUI |
617 // | 616 // |
618 //////////////////////////////////////////////////////////////////////////////// | 617 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 12 matching lines...) Expand all Loading... |
631 | 630 |
632 void MobileSetupUI::DidFinishNavigation( | 631 void MobileSetupUI::DidFinishNavigation( |
633 content::NavigationHandle* navigation_handle) { | 632 content::NavigationHandle* navigation_handle) { |
634 if (!navigation_handle->HasCommitted() || | 633 if (!navigation_handle->HasCommitted() || |
635 navigation_handle->GetRenderFrameHost()->GetFrameName() != | 634 navigation_handle->GetRenderFrameHost()->GetFrameName() != |
636 "paymentForm") { | 635 "paymentForm") { |
637 return; | 636 return; |
638 } | 637 } |
639 | 638 |
640 if (navigation_handle->IsErrorPage()) { | 639 if (navigation_handle->IsErrorPage()) { |
641 base::FundamentalValue result_value(-navigation_handle->GetNetErrorCode()); | 640 base::Value result_value(-navigation_handle->GetNetErrorCode()); |
642 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadFailedCallback, | 641 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadFailedCallback, |
643 result_value); | 642 result_value); |
644 return; | 643 return; |
645 } | 644 } |
646 | 645 |
647 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadCompletedCallback); | 646 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadCompletedCallback); |
648 } | 647 } |
OLD | NEW |