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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Returns whether a load for |url| in the |frame| the NetErrorHelper is | 75 // Returns whether a load for |url| in the |frame| the NetErrorHelper is |
76 // attached to should have its error page suppressed. | 76 // attached to should have its error page suppressed. |
77 bool ShouldSuppressErrorPage(const GURL& url); | 77 bool ShouldSuppressErrorPage(const GURL& url); |
78 | 78 |
79 private: | 79 private: |
80 // NetErrorHelperCore::Delegate implementation: | 80 // NetErrorHelperCore::Delegate implementation: |
81 void GenerateLocalizedErrorPage( | 81 void GenerateLocalizedErrorPage( |
82 const blink::WebURLError& error, | 82 const blink::WebURLError& error, |
83 bool is_failed_post, | 83 bool is_failed_post, |
84 bool can_use_local_diagnostics_service, | 84 bool can_use_local_diagnostics_service, |
| 85 bool has_offline_pages, |
85 scoped_ptr<error_page::ErrorPageParams> params, | 86 scoped_ptr<error_page::ErrorPageParams> params, |
86 bool* reload_button_shown, | 87 bool* reload_button_shown, |
87 bool* show_saved_copy_button_shown, | 88 bool* show_saved_copy_button_shown, |
88 bool* show_cached_copy_button_shown, | 89 bool* show_cached_copy_button_shown, |
| 90 bool* show_saved_pages_button_shown, |
89 std::string* html) const override; | 91 std::string* html) const override; |
90 void LoadErrorPage(const std::string& html, const GURL& failed_url) override; | 92 void LoadErrorPage(const std::string& html, const GURL& failed_url) override; |
91 void EnablePageHelperFunctions() override; | 93 void EnablePageHelperFunctions() override; |
92 void UpdateErrorPage(const blink::WebURLError& error, | 94 void UpdateErrorPage(const blink::WebURLError& error, |
93 bool is_failed_post, | 95 bool is_failed_post, |
94 bool can_use_local_diagnostics_service) override; | 96 bool can_use_local_diagnostics_service, |
| 97 bool has_offline_pages) override; |
95 void FetchNavigationCorrections( | 98 void FetchNavigationCorrections( |
96 const GURL& navigation_correction_url, | 99 const GURL& navigation_correction_url, |
97 const std::string& navigation_correction_request_body) override; | 100 const std::string& navigation_correction_request_body) override; |
98 void CancelFetchNavigationCorrections() override; | 101 void CancelFetchNavigationCorrections() override; |
99 void SendTrackingRequest(const GURL& tracking_url, | 102 void SendTrackingRequest(const GURL& tracking_url, |
100 const std::string& tracking_request_body) override; | 103 const std::string& tracking_request_body) override; |
101 void ReloadPage() override; | 104 void ReloadPage() override; |
102 void LoadPageFromCache(const GURL& page_url) override; | 105 void LoadPageFromCache(const GURL& page_url) override; |
103 void DiagnoseError(const GURL& page_url) override; | 106 void DiagnoseError(const GURL& page_url) override; |
| 107 void ShowOfflinePages() override; |
104 | 108 |
105 void OnNetErrorInfo(int status); | 109 void OnNetErrorInfo(int status); |
106 void OnSetCanShowNetworkDiagnosticsDialog( | 110 void OnSetCanShowNetworkDiagnosticsDialog( |
107 bool can_use_local_diagnostics_service); | 111 bool can_use_local_diagnostics_service); |
108 void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url, | 112 void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url, |
109 const std::string& language, | 113 const std::string& language, |
110 const std::string& country_code, | 114 const std::string& country_code, |
111 const std::string& api_key, | 115 const std::string& api_key, |
112 const GURL& search_url); | 116 const GURL& search_url); |
113 | 117 |
114 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, | 118 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, |
115 const std::string& data); | 119 const std::string& data); |
116 | 120 |
117 void OnTrackingRequestComplete(const blink::WebURLResponse& response, | 121 void OnTrackingRequestComplete(const blink::WebURLResponse& response, |
118 const std::string& data); | 122 const std::string& data); |
| 123 void OnSetHasOfflinePages(bool has_offline_pages); |
119 | 124 |
120 scoped_ptr<content::ResourceFetcher> correction_fetcher_; | 125 scoped_ptr<content::ResourceFetcher> correction_fetcher_; |
121 scoped_ptr<content::ResourceFetcher> tracking_fetcher_; | 126 scoped_ptr<content::ResourceFetcher> tracking_fetcher_; |
122 | 127 |
123 scoped_ptr<error_page::NetErrorHelperCore> core_; | 128 scoped_ptr<error_page::NetErrorHelperCore> core_; |
124 | 129 |
125 // Weak factory for vending a weak pointer to a NetErrorPageController. Weak | 130 // Weak factory for vending a weak pointer to a NetErrorPageController. Weak |
126 // pointers are invalidated on each commit, to prevent getting messages from | 131 // pointers are invalidated on each commit, to prevent getting messages from |
127 // Controllers used for the previous commit that haven't yet been cleaned up. | 132 // Controllers used for the previous commit that haven't yet been cleaned up. |
128 base::WeakPtrFactory<NetErrorPageController::Delegate> | 133 base::WeakPtrFactory<NetErrorPageController::Delegate> |
129 weak_controller_delegate_factory_; | 134 weak_controller_delegate_factory_; |
130 | 135 |
131 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); | 136 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); |
132 }; | 137 }; |
133 | 138 |
134 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 139 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
OLD | NEW |