Commit 59b23b0b authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Remove protalFrameLoad messages to mobile setup ui

Stop observing paymentPortal iframe load in MobileSetupUI - MobileSetupUI
sends portal load status messages to the mobile setup webui, but webui
merely ignores them. The paymentPortal load status is observed directly
in webui by using webview APIs, so messages from the MobileSetupUI are
not needed anymore.

Change-Id: Ic757e786d4b7efbc3242544f0f9db90226fc8ffa
Reviewed-on: https://chromium-review.googlesource.com/c/1318850Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605779}
parent 4756a23a
...@@ -444,10 +444,6 @@ cr.define('mobile', function() { ...@@ -444,10 +444,6 @@ cr.define('mobile', function() {
MobileSetup.getInstance().updateDeviceStatus_(deviceInfo); MobileSetup.getInstance().updateDeviceStatus_(deviceInfo);
}; };
MobileSetup.portalFrameLoadError = function(errorCode) {};
MobileSetup.portalFrameLoadCompleted = function() {};
MobileSetup.loadPage = function() { MobileSetup.loadPage = function() {
mobile.MobileSetup.getInstance().initialize( mobile.MobileSetup.getInstance().initialize(
mobile.MobileSetup.ACTIVATION_PAGE_URL); mobile.MobileSetup.ACTIVATION_PAGE_URL);
......
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#include "components/device_event_log/device_event_log.h" #include "components/device_event_log/device_event_log.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "content/public/browser/browser_thread.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/url_data_source.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
...@@ -65,10 +63,6 @@ const char kJsApiResultOK[] = "ok"; ...@@ -65,10 +63,6 @@ const char kJsApiResultOK[] = "ok";
const char kJsDeviceStatusChangedCallback[] = const char kJsDeviceStatusChangedCallback[] =
"mobile.MobileSetup.deviceStateChanged"; "mobile.MobileSetup.deviceStateChanged";
const char kJsPortalFrameLoadFailedCallback[] =
"mobile.MobileSetup.portalFrameLoadError";
const char kJsPortalFrameLoadCompletedCallback[] =
"mobile.MobileSetup.portalFrameLoadCompleted";
const char kJsGetDeviceInfoCallback[] = const char kJsGetDeviceInfoCallback[] =
"mobile.MobileSetupPortal.onGotDeviceInfo"; "mobile.MobileSetupPortal.onGotDeviceInfo";
const char kJsConnectivityChangedCallback[] = const char kJsConnectivityChangedCallback[] =
...@@ -631,33 +625,8 @@ MobileSetupUI::MobileSetupUI(content::WebUI* web_ui) : ui::WebDialogUI(web_ui) { ...@@ -631,33 +625,8 @@ MobileSetupUI::MobileSetupUI(content::WebUI* web_ui) : ui::WebDialogUI(web_ui) {
// Set up the chrome://mobilesetup/ source. // Set up the chrome://mobilesetup/ source.
content::URLDataSource::Add(Profile::FromWebUI(web_ui), content::URLDataSource::Add(Profile::FromWebUI(web_ui),
std::make_unique<MobileSetupUIHTMLSource>()); std::make_unique<MobileSetupUIHTMLSource>());
content::WebContentsObserver::Observe(web_ui->GetWebContents());
} }
MobileSetupUI::~MobileSetupUI() = default; MobileSetupUI::~MobileSetupUI() = default;
void MobileSetupUI::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
NET_LOG(EVENT) << "MobileSetupUI: DidFinishNavigation. Committed: "
<< navigation_handle->HasCommitted() << " Frame: "
<< navigation_handle->GetRenderFrameHost()->GetFrameName();
if (!navigation_handle->HasCommitted() ||
navigation_handle->GetRenderFrameHost()->GetFrameName() !=
"paymentForm") {
return;
}
if (navigation_handle->IsErrorPage()) {
NET_LOG(ERROR) << "MobileSetupUI: Error: "
<< navigation_handle->GetNetErrorCode();
base::Value result_value(-navigation_handle->GetNetErrorCode());
web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadFailedCallback,
result_value);
return;
}
web_ui()->CallJavascriptFunctionUnsafe(kJsPortalFrameLoadCompletedCallback);
}
} // namespace chromeos } // namespace chromeos
...@@ -12,17 +12,12 @@ namespace chromeos { ...@@ -12,17 +12,12 @@ namespace chromeos {
// A custom WebUI that defines datasource for mobile setup registration page // A custom WebUI that defines datasource for mobile setup registration page
// that is used in Chrome OS activate modem and perform plan subscription tasks. // that is used in Chrome OS activate modem and perform plan subscription tasks.
class MobileSetupUI : public ui::WebDialogUI, class MobileSetupUI : public ui::WebDialogUI {
public content::WebContentsObserver {
public: public:
explicit MobileSetupUI(content::WebUI* web_ui); explicit MobileSetupUI(content::WebUI* web_ui);
~MobileSetupUI() override; ~MobileSetupUI() override;
private: private:
// content::WebContentsObserver overrides.
void DidFinishNavigation(
content::NavigationHandle* navigation_handle) override;
DISALLOW_COPY_AND_ASSIGN(MobileSetupUI); DISALLOW_COPY_AND_ASSIGN(MobileSetupUI);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment