| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/common/localized_error.h" | 12 #include "components/error_page/common/net_error_info.h" |
| 13 #include "chrome/common/net/net_error_info.h" | 13 #include "components/error_page/renderer/net_error_helper_core.h" |
| 14 #include "chrome/renderer/net/net_error_helper_core.h" | |
| 15 #include "content/public/renderer/render_frame_observer.h" | 14 #include "content/public/renderer/render_frame_observer.h" |
| 16 #include "content/public/renderer/render_frame_observer_tracker.h" | 15 #include "content/public/renderer/render_frame_observer_tracker.h" |
| 17 #include "content/public/renderer/render_process_observer.h" | 16 #include "content/public/renderer/render_process_observer.h" |
| 18 | 17 |
| 19 class GURL; | 18 class GURL; |
| 20 | 19 |
| 21 namespace blink { | 20 namespace blink { |
| 22 class WebFrame; | 21 class WebFrame; |
| 23 class WebURLResponse; | 22 class WebURLResponse; |
| 24 struct WebURLError; | 23 struct WebURLError; |
| 25 } | 24 } |
| 26 | 25 |
| 27 namespace content { | 26 namespace content { |
| 28 class ResourceFetcher; | 27 class ResourceFetcher; |
| 29 } | 28 } |
| 30 | 29 |
| 30 namespace error_page { |
| 31 struct ErrorPageParams; |
| 32 } |
| 33 |
| 31 // Listens for NetErrorInfo messages from the NetErrorTabHelper on the | 34 // Listens for NetErrorInfo messages from the NetErrorTabHelper on the |
| 32 // browser side and updates the error page with more details (currently, just | 35 // browser side and updates the error page with more details (currently, just |
| 33 // DNS probe results) if/when available. | 36 // DNS probe results) if/when available. |
| 34 class NetErrorHelper | 37 class NetErrorHelper |
| 35 : public content::RenderFrameObserver, | 38 : public content::RenderFrameObserver, |
| 36 public content::RenderFrameObserverTracker<NetErrorHelper>, | 39 public content::RenderFrameObserverTracker<NetErrorHelper>, |
| 37 public content::RenderProcessObserver, | 40 public content::RenderProcessObserver, |
| 38 public NetErrorHelperCore::Delegate { | 41 public error_page::NetErrorHelperCore::Delegate { |
| 39 public: | 42 public: |
| 40 explicit NetErrorHelper(content::RenderFrame* render_view); | 43 explicit NetErrorHelper(content::RenderFrame* render_view); |
| 41 virtual ~NetErrorHelper(); | 44 virtual ~NetErrorHelper(); |
| 42 | 45 |
| 43 // Button press notification from error page. | 46 // Button press notification from error page. |
| 44 void ReloadButtonPressed(); | 47 void ReloadButtonPressed(); |
| 45 void LoadStaleButtonPressed(); | 48 void LoadStaleButtonPressed(); |
| 46 void MoreButtonPressed(); | 49 void MoreButtonPressed(); |
| 47 | 50 |
| 48 // RenderFrameObserver implementation. | 51 // RenderFrameObserver implementation. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 77 bool ShouldSuppressErrorPage(blink::WebFrame* frame, const GURL& url); | 80 bool ShouldSuppressErrorPage(blink::WebFrame* frame, const GURL& url); |
| 78 | 81 |
| 79 // Called when a link with the given tracking ID is pressed. | 82 // Called when a link with the given tracking ID is pressed. |
| 80 void TrackClick(int tracking_id); | 83 void TrackClick(int tracking_id); |
| 81 | 84 |
| 82 private: | 85 private: |
| 83 // NetErrorHelperCore::Delegate implementation: | 86 // NetErrorHelperCore::Delegate implementation: |
| 84 virtual void GenerateLocalizedErrorPage( | 87 virtual void GenerateLocalizedErrorPage( |
| 85 const blink::WebURLError& error, | 88 const blink::WebURLError& error, |
| 86 bool is_failed_post, | 89 bool is_failed_post, |
| 87 scoped_ptr<LocalizedError::ErrorPageParams> params, | 90 scoped_ptr<error_page::ErrorPageParams> params, |
| 88 bool* reload_button_shown, | 91 bool* reload_button_shown, |
| 89 bool* load_stale_button_shown, | 92 bool* load_stale_button_shown, |
| 90 std::string* html) const OVERRIDE; | 93 std::string* html) const OVERRIDE; |
| 91 virtual void LoadErrorPageInMainFrame(const std::string& html, | 94 virtual void LoadErrorPageInMainFrame(const std::string& html, |
| 92 const GURL& failed_url) OVERRIDE; | 95 const GURL& failed_url) OVERRIDE; |
| 93 virtual void EnablePageHelperFunctions() OVERRIDE; | 96 virtual void EnablePageHelperFunctions() OVERRIDE; |
| 94 virtual void UpdateErrorPage(const blink::WebURLError& error, | 97 virtual void UpdateErrorPage(const blink::WebURLError& error, |
| 95 bool is_failed_post) OVERRIDE; | 98 bool is_failed_post) OVERRIDE; |
| 96 virtual void FetchNavigationCorrections( | 99 virtual void FetchNavigationCorrections( |
| 97 const GURL& navigation_correction_url, | 100 const GURL& navigation_correction_url, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 112 | 115 |
| 113 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, | 116 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, |
| 114 const std::string& data); | 117 const std::string& data); |
| 115 | 118 |
| 116 void OnTrackingRequestComplete(const blink::WebURLResponse& response, | 119 void OnTrackingRequestComplete(const blink::WebURLResponse& response, |
| 117 const std::string& data); | 120 const std::string& data); |
| 118 | 121 |
| 119 scoped_ptr<content::ResourceFetcher> correction_fetcher_; | 122 scoped_ptr<content::ResourceFetcher> correction_fetcher_; |
| 120 scoped_ptr<content::ResourceFetcher> tracking_fetcher_; | 123 scoped_ptr<content::ResourceFetcher> tracking_fetcher_; |
| 121 | 124 |
| 122 scoped_ptr<NetErrorHelperCore> core_; | 125 scoped_ptr<error_page::NetErrorHelperCore> core_; |
| 123 | 126 |
| 124 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); | 127 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); |
| 125 }; | 128 }; |
| 126 | 129 |
| 127 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 130 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
| OLD | NEW |