| 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 web_ui->AddMessageHandler(base::MakeUnique<MobileSetupHandler>()); | 621 web_ui->AddMessageHandler(base::MakeUnique<MobileSetupHandler>()); |
| 622 MobileSetupUIHTMLSource* html_source = new MobileSetupUIHTMLSource(); | 622 MobileSetupUIHTMLSource* html_source = new MobileSetupUIHTMLSource(); |
| 623 | 623 |
| 624 // Set up the chrome://mobilesetup/ source. | 624 // Set up the chrome://mobilesetup/ source. |
| 625 Profile* profile = Profile::FromWebUI(web_ui); | 625 Profile* profile = Profile::FromWebUI(web_ui); |
| 626 content::URLDataSource::Add(profile, html_source); | 626 content::URLDataSource::Add(profile, html_source); |
| 627 | 627 |
| 628 content::WebContentsObserver::Observe(web_ui->GetWebContents()); | 628 content::WebContentsObserver::Observe(web_ui->GetWebContents()); |
| 629 } | 629 } |
| 630 | 630 |
| 631 bool MobileSetupUI::AllowCaching() const { |
| 632 // Should not be cached to reflect dynamically-generated contents. |
| 633 return false; |
| 634 } |
| 635 |
| 631 void MobileSetupUI::DidFinishNavigation( | 636 void MobileSetupUI::DidFinishNavigation( |
| 632 content::NavigationHandle* navigation_handle) { | 637 content::NavigationHandle* navigation_handle) { |
| 633 if (!navigation_handle->HasCommitted() || | 638 if (!navigation_handle->HasCommitted() || |
| 634 navigation_handle->GetRenderFrameHost()->GetFrameName() != | 639 navigation_handle->GetRenderFrameHost()->GetFrameName() != |
| 635 "paymentForm") { | 640 "paymentForm") { |
| 636 return; | 641 return; |
| 637 } | 642 } |
| 638 | 643 |
| 639 if (navigation_handle->IsErrorPage()) { | 644 if (navigation_handle->IsErrorPage()) { |
| 640 base::Value result_value(-navigation_handle->GetNetErrorCode()); | 645 base::Value result_value(-navigation_handle->GetNetErrorCode()); |
| 641 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadFailedCallback, | 646 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadFailedCallback, |
| 642 result_value); | 647 result_value); |
| 643 return; | 648 return; |
| 644 } | 649 } |
| 645 | 650 |
| 646 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadCompletedCallback); | 651 web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadCompletedCallback); |
| 647 } | 652 } |
| OLD | NEW |