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