Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc |
| diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc |
| index 237cb793ffbdc6360ebbf6c1123477a8073f3aab..46e4edeac4b5af7474888eb566783277c196fcec 100644 |
| --- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc |
| +++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc |
| @@ -40,6 +40,7 @@ |
| #include "chromeos/network/network_state_handler_observer.h" |
| #include "components/strings/grit/components_strings.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "content/public/browser/navigation_handle.h" |
| #include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/url_data_source.h" |
| #include "content/public/browser/web_contents.h" |
| @@ -628,26 +629,19 @@ MobileSetupUI::MobileSetupUI(content::WebUI* web_ui) |
| content::WebContentsObserver::Observe(web_ui->GetWebContents()); |
| } |
| -void MobileSetupUI::DidCommitProvisionalLoadForFrame( |
| - content::RenderFrameHost* render_frame_host, |
| - const GURL& url, |
| - ui::PageTransition transition_type) { |
| - if (render_frame_host->GetFrameName() != "paymentForm") |
| - return; |
| - |
| - web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadCompletedCallback); |
| -} |
| - |
| -void MobileSetupUI::DidFailProvisionalLoad( |
| - content::RenderFrameHost* render_frame_host, |
| - const GURL& validated_url, |
| - int error_code, |
| - const base::string16& error_description, |
| - bool was_ignored_by_handler) { |
| - if (render_frame_host->GetFrameName() != "paymentForm") |
| +void MobileSetupUI::DidFinishNavigation( |
| + content::NavigationHandle* navigation_handle) { |
| + if (!navigation_handle->HasCommitted() || |
| + navigation_handle->GetRenderFrameHost()->GetFrameName() != |
| + "paymentForm") { |
| return; |
| + } |
| - base::FundamentalValue result_value(-error_code); |
| - web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadFailedCallback, |
| - result_value); |
| + if (navigation_handle->IsErrorPage()) { |
| + base::FundamentalValue result_value(-navigation_handle->GetNetErrorCode()); |
| + web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadFailedCallback, |
| + result_value); |
|
achuithb
2017/01/27 01:14:59
Early return on error seems preferable instead of
jam
2017/01/27 04:06:23
Done.
|
| + } else { |
| + web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadCompletedCallback); |
| + } |
| } |