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 22 matching lines...) Expand all Loading... |
33 // DNS probe results) if/when available. | 33 // DNS probe results) if/when available. |
34 class NetErrorHelper | 34 class NetErrorHelper |
35 : public content::RenderFrameObserver, | 35 : public content::RenderFrameObserver, |
36 public content::RenderFrameObserverTracker<NetErrorHelper>, | 36 public content::RenderFrameObserverTracker<NetErrorHelper>, |
37 public content::RenderProcessObserver, | 37 public content::RenderProcessObserver, |
38 public NetErrorHelperCore::Delegate { | 38 public NetErrorHelperCore::Delegate { |
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. |
| 44 void ReloadButtonPressed(); |
| 45 void LoadStaleButtonPressed(); |
| 46 void MoreButtonPressed(); |
| 47 |
43 // RenderFrameObserver implementation. | 48 // RenderFrameObserver implementation. |
44 virtual void DidStartProvisionalLoad() OVERRIDE; | 49 virtual void DidStartProvisionalLoad() OVERRIDE; |
45 virtual void DidCommitProvisionalLoad(bool is_new_navigation) OVERRIDE; | 50 virtual void DidCommitProvisionalLoad(bool is_new_navigation) OVERRIDE; |
46 virtual void DidFinishLoad() OVERRIDE; | 51 virtual void DidFinishLoad() OVERRIDE; |
47 virtual void OnStop() OVERRIDE; | 52 virtual void OnStop() OVERRIDE; |
48 | 53 |
49 // IPC::Listener implementation. | 54 // IPC::Listener implementation. |
50 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 55 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
51 | 56 |
52 // RenderProcessObserver implementation. | 57 // RenderProcessObserver implementation. |
(...skipping 15 matching lines...) Expand all Loading... |
68 // Returns whether a load for |url| in |frame| should have its error page | 73 // Returns whether a load for |url| in |frame| should have its error page |
69 // suppressed. | 74 // suppressed. |
70 bool ShouldSuppressErrorPage(blink::WebFrame* frame, const GURL& url); | 75 bool ShouldSuppressErrorPage(blink::WebFrame* frame, const GURL& url); |
71 | 76 |
72 private: | 77 private: |
73 // NetErrorHelperCore::Delegate implementation: | 78 // NetErrorHelperCore::Delegate implementation: |
74 virtual void GenerateLocalizedErrorPage( | 79 virtual void GenerateLocalizedErrorPage( |
75 const blink::WebURLError& error, | 80 const blink::WebURLError& error, |
76 bool is_failed_post, | 81 bool is_failed_post, |
77 scoped_ptr<LocalizedError::ErrorPageParams> params, | 82 scoped_ptr<LocalizedError::ErrorPageParams> params, |
| 83 bool* reload_button_shown, |
| 84 bool* load_stale_button_shown, |
78 std::string* html) const OVERRIDE; | 85 std::string* html) const OVERRIDE; |
79 virtual void LoadErrorPageInMainFrame(const std::string& html, | 86 virtual void LoadErrorPageInMainFrame(const std::string& html, |
80 const GURL& failed_url) OVERRIDE; | 87 const GURL& failed_url) OVERRIDE; |
81 virtual void EnableStaleLoadBindings(const GURL& page_url) OVERRIDE; | 88 virtual void EnablePageHelperFunctions() OVERRIDE; |
82 virtual void UpdateErrorPage(const blink::WebURLError& error, | 89 virtual void UpdateErrorPage(const blink::WebURLError& error, |
83 bool is_failed_post) OVERRIDE; | 90 bool is_failed_post) OVERRIDE; |
84 virtual void FetchNavigationCorrections( | 91 virtual void FetchNavigationCorrections( |
85 const GURL& navigation_correction_url, | 92 const GURL& navigation_correction_url, |
86 const std::string& navigation_correction_request_body) OVERRIDE; | 93 const std::string& navigation_correction_request_body) OVERRIDE; |
87 virtual void CancelFetchNavigationCorrections() OVERRIDE; | 94 virtual void CancelFetchNavigationCorrections() OVERRIDE; |
88 virtual void ReloadPage() OVERRIDE; | 95 virtual void ReloadPage() OVERRIDE; |
| 96 virtual void LoadPageFromCache(const GURL& page_url) OVERRIDE; |
89 | 97 |
90 void OnNetErrorInfo(int status); | 98 void OnNetErrorInfo(int status); |
91 void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url, | 99 void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url, |
92 const std::string& language, | 100 const std::string& language, |
93 const std::string& country_code, | 101 const std::string& country_code, |
94 const std::string& api_key, | 102 const std::string& api_key, |
95 const GURL& search_url); | 103 const GURL& search_url); |
96 | 104 |
97 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, | 105 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, |
98 const std::string& data); | 106 const std::string& data); |
99 | 107 |
100 scoped_ptr<content::ResourceFetcher> correction_fetcher_; | 108 scoped_ptr<content::ResourceFetcher> correction_fetcher_; |
101 | 109 |
102 NetErrorHelperCore core_; | 110 NetErrorHelperCore core_; |
103 | 111 |
104 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); | 112 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); |
105 }; | 113 }; |
106 | 114 |
107 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 115 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
OLD | NEW |