diff options
author | mmenke <mmenke@chromium.org> | 2015-10-27 14:06:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-27 21:07:26 +0000 |
commit | f1c777e3f97a16cc6a3aa922a23602fa59412989 (patch) | |
tree | 99b77b34eca35570c99966e478d58e5f24fdafe7 /components/error_page | |
parent | ee261f306c3c66e96339aa1026d62a6d953302fe (diff) | |
download | chromium_src-f1c777e3f97a16cc6a3aa922a23602fa59412989.zip chromium_src-f1c777e3f97a16cc6a3aa922a23602fa59412989.tar.gz chromium_src-f1c777e3f97a16cc6a3aa922a23602fa59412989.tar.bz2 |
Make NetErrorHelper more OOPIF-friendly.
Now create one per frame instead of creating them only for main frames,
and get the WebFrame directly from a WebFrame rather than by going
through the RenderView.
BUG=543226,529976
Review URL: https://codereview.chromium.org/1406303002
Cr-Commit-Position: refs/heads/master@{#356395}
Diffstat (limited to 'components/error_page')
3 files changed, 9 insertions, 16 deletions
diff --git a/components/error_page/renderer/net_error_helper_core.cc b/components/error_page/renderer/net_error_helper_core.cc index 60e2eeaf..e193073 100644 --- a/components/error_page/renderer/net_error_helper_core.cc +++ b/components/error_page/renderer/net_error_helper_core.cc @@ -790,9 +790,8 @@ void NetErrorHelperCore::OnNavigationCorrectionsFetched( // TODO(mmenke): Once the new API is in place, look into replacing this // double page load by just updating the error page, like DNS // probes do. - delegate_->LoadErrorPageInMainFrame( - error_html, - pending_error_page_info_->error.unreachableURL); + delegate_->LoadErrorPage(error_html, + pending_error_page_info_->error.unreachableURL); } blink::WebURLError NetErrorHelperCore::GetUpdatedError( diff --git a/components/error_page/renderer/net_error_helper_core.h b/components/error_page/renderer/net_error_helper_core.h index be88ccc..6a3dc7b 100644 --- a/components/error_page/renderer/net_error_helper_core.h +++ b/components/error_page/renderer/net_error_helper_core.h @@ -67,9 +67,9 @@ class NetErrorHelperCore { bool* show_cached_copy_button_shown, std::string* html) const = 0; - // Loads the given HTML in the main frame for use as an error page. - virtual void LoadErrorPageInMainFrame(const std::string& html, - const GURL& failed_url) = 0; + // Loads the given HTML in the frame for use as an error page. + virtual void LoadErrorPage(const std::string& html, + const GURL& failed_url) = 0; // Create extra Javascript bindings in the error page. Will only be invoked // after an error page has finished loading. @@ -131,14 +131,9 @@ class NetErrorHelperCore { bool is_visible); ~NetErrorHelperCore(); - // Examines |frame| and |error| to see if this is an error worthy of a DNS - // probe. If it is, initializes |error_strings| based on |error|, - // |is_failed_post|, and |locale| with suitable strings and returns true. - // If not, returns false, in which case the caller should look up error - // strings directly using LocalizedError::GetNavigationErrorStrings. - // - // Updates the NetErrorHelper with the assumption the page will be loaded - // immediately. + // Initializes |error_html| with the HTML of an error page in response to + // |error|. Updates internals state with the assumption the page will be + // loaded immediately. void GetErrorHTML(FrameType frame_type, const blink::WebURLError& error, bool is_failed_post, diff --git a/components/error_page/renderer/net_error_helper_core_unittest.cc b/components/error_page/renderer/net_error_helper_core_unittest.cc index 20ccb91..6fa8caf 100644 --- a/components/error_page/renderer/net_error_helper_core_unittest.cc +++ b/components/error_page/renderer/net_error_helper_core_unittest.cc @@ -334,8 +334,7 @@ class NetErrorHelperCoreTest : public testing::Test, *html = ErrorToString(error, is_failed_post); } - void LoadErrorPageInMainFrame(const std::string& html, - const GURL& failed_url) override { + void LoadErrorPage(const std::string& html, const GURL& failed_url) override { error_html_update_count_++; last_error_html_ = html; } |