| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 5 #ifndef CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
| 6 #define CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 6 #define CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 public: | 39 public: |
| 40 explicit NetErrorHelper(content::RenderFrame* render_view); | 40 explicit NetErrorHelper(content::RenderFrame* render_view); |
| 41 virtual ~NetErrorHelper(); | 41 virtual ~NetErrorHelper(); |
| 42 | 42 |
| 43 // Button press notification from error page. | 43 // Button press notification from error page. |
| 44 void ReloadButtonPressed(); | 44 void ReloadButtonPressed(); |
| 45 void LoadStaleButtonPressed(); | 45 void LoadStaleButtonPressed(); |
| 46 void MoreButtonPressed(); | 46 void MoreButtonPressed(); |
| 47 | 47 |
| 48 // RenderFrameObserver implementation. | 48 // RenderFrameObserver implementation. |
| 49 virtual void DidStartProvisionalLoad() OVERRIDE; | 49 virtual void DidStartProvisionalLoad() override; |
| 50 virtual void DidCommitProvisionalLoad(bool is_new_navigation) OVERRIDE; | 50 virtual void DidCommitProvisionalLoad(bool is_new_navigation) override; |
| 51 virtual void DidFinishLoad() OVERRIDE; | 51 virtual void DidFinishLoad() override; |
| 52 virtual void OnStop() OVERRIDE; | 52 virtual void OnStop() override; |
| 53 virtual void WasShown() OVERRIDE; | 53 virtual void WasShown() override; |
| 54 virtual void WasHidden() OVERRIDE; | 54 virtual void WasHidden() override; |
| 55 | 55 |
| 56 // IPC::Listener implementation. | 56 // IPC::Listener implementation. |
| 57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 57 virtual bool OnMessageReceived(const IPC::Message& message) override; |
| 58 | 58 |
| 59 // RenderProcessObserver implementation. | 59 // RenderProcessObserver implementation. |
| 60 virtual void NetworkStateChanged(bool online) OVERRIDE; | 60 virtual void NetworkStateChanged(bool online) override; |
| 61 | 61 |
| 62 // Examines |frame| and |error| to see if this is an error worthy of a DNS | 62 // Examines |frame| and |error| to see if this is an error worthy of a DNS |
| 63 // probe. If it is, initializes |error_strings| based on |error|, | 63 // probe. If it is, initializes |error_strings| based on |error|, |
| 64 // |is_failed_post|, and |locale| with suitable strings and returns true. | 64 // |is_failed_post|, and |locale| with suitable strings and returns true. |
| 65 // If not, returns false, in which case the caller should look up error | 65 // If not, returns false, in which case the caller should look up error |
| 66 // strings directly using LocalizedError::GetNavigationErrorStrings. | 66 // strings directly using LocalizedError::GetNavigationErrorStrings. |
| 67 // | 67 // |
| 68 // Updates the NetErrorHelper with the assumption the page will be loaded | 68 // Updates the NetErrorHelper with the assumption the page will be loaded |
| 69 // immediately. | 69 // immediately. |
| 70 void GetErrorHTML(blink::WebFrame* frame, | 70 void GetErrorHTML(blink::WebFrame* frame, |
| 71 const blink::WebURLError& error, | 71 const blink::WebURLError& error, |
| 72 bool is_failed_post, | 72 bool is_failed_post, |
| 73 std::string* error_html); | 73 std::string* error_html); |
| 74 | 74 |
| 75 // Returns whether a load for |url| in |frame| should have its error page | 75 // Returns whether a load for |url| in |frame| should have its error page |
| 76 // suppressed. | 76 // suppressed. |
| 77 bool ShouldSuppressErrorPage(blink::WebFrame* frame, const GURL& url); | 77 bool ShouldSuppressErrorPage(blink::WebFrame* frame, const GURL& url); |
| 78 | 78 |
| 79 // Called when a link with the given tracking ID is pressed. | 79 // Called when a link with the given tracking ID is pressed. |
| 80 void TrackClick(int tracking_id); | 80 void TrackClick(int tracking_id); |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 // NetErrorHelperCore::Delegate implementation: | 83 // NetErrorHelperCore::Delegate implementation: |
| 84 virtual void GenerateLocalizedErrorPage( | 84 virtual void GenerateLocalizedErrorPage( |
| 85 const blink::WebURLError& error, | 85 const blink::WebURLError& error, |
| 86 bool is_failed_post, | 86 bool is_failed_post, |
| 87 scoped_ptr<LocalizedError::ErrorPageParams> params, | 87 scoped_ptr<LocalizedError::ErrorPageParams> params, |
| 88 bool* reload_button_shown, | 88 bool* reload_button_shown, |
| 89 bool* load_stale_button_shown, | 89 bool* load_stale_button_shown, |
| 90 std::string* html) const OVERRIDE; | 90 std::string* html) const override; |
| 91 virtual void LoadErrorPageInMainFrame(const std::string& html, | 91 virtual void LoadErrorPageInMainFrame(const std::string& html, |
| 92 const GURL& failed_url) OVERRIDE; | 92 const GURL& failed_url) override; |
| 93 virtual void EnablePageHelperFunctions() OVERRIDE; | 93 virtual void EnablePageHelperFunctions() override; |
| 94 virtual void UpdateErrorPage(const blink::WebURLError& error, | 94 virtual void UpdateErrorPage(const blink::WebURLError& error, |
| 95 bool is_failed_post) OVERRIDE; | 95 bool is_failed_post) override; |
| 96 virtual void FetchNavigationCorrections( | 96 virtual void FetchNavigationCorrections( |
| 97 const GURL& navigation_correction_url, | 97 const GURL& navigation_correction_url, |
| 98 const std::string& navigation_correction_request_body) OVERRIDE; | 98 const std::string& navigation_correction_request_body) override; |
| 99 virtual void CancelFetchNavigationCorrections() OVERRIDE; | 99 virtual void CancelFetchNavigationCorrections() override; |
| 100 virtual void SendTrackingRequest( | 100 virtual void SendTrackingRequest( |
| 101 const GURL& tracking_url, | 101 const GURL& tracking_url, |
| 102 const std::string& tracking_request_body) OVERRIDE; | 102 const std::string& tracking_request_body) override; |
| 103 virtual void ReloadPage() OVERRIDE; | 103 virtual void ReloadPage() override; |
| 104 virtual void LoadPageFromCache(const GURL& page_url) OVERRIDE; | 104 virtual void LoadPageFromCache(const GURL& page_url) override; |
| 105 | 105 |
| 106 void OnNetErrorInfo(int status); | 106 void OnNetErrorInfo(int status); |
| 107 void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url, | 107 void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url, |
| 108 const std::string& language, | 108 const std::string& language, |
| 109 const std::string& country_code, | 109 const std::string& country_code, |
| 110 const std::string& api_key, | 110 const std::string& api_key, |
| 111 const GURL& search_url); | 111 const GURL& search_url); |
| 112 | 112 |
| 113 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, | 113 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, |
| 114 const std::string& data); | 114 const std::string& data); |
| 115 | 115 |
| 116 void OnTrackingRequestComplete(const blink::WebURLResponse& response, | 116 void OnTrackingRequestComplete(const blink::WebURLResponse& response, |
| 117 const std::string& data); | 117 const std::string& data); |
| 118 | 118 |
| 119 scoped_ptr<content::ResourceFetcher> correction_fetcher_; | 119 scoped_ptr<content::ResourceFetcher> correction_fetcher_; |
| 120 scoped_ptr<content::ResourceFetcher> tracking_fetcher_; | 120 scoped_ptr<content::ResourceFetcher> tracking_fetcher_; |
| 121 | 121 |
| 122 scoped_ptr<NetErrorHelperCore> core_; | 122 scoped_ptr<NetErrorHelperCore> core_; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); | 124 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 127 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
| OLD | NEW |