Chromium Code Reviews| 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 int offline_page_status, |
| 87 scoped_ptr<error_page::ErrorPageParams> params, | 87 scoped_ptr<error_page::ErrorPageParams> params, |
| 88 bool* reload_button_shown, | 88 bool* reload_button_shown, |
| 89 bool* show_saved_copy_button_shown, | 89 bool* show_saved_copy_button_shown, |
| 90 bool* show_cached_copy_button_shown, | 90 bool* show_cached_copy_button_shown, |
| 91 bool* show_saved_pages_button_shown, | 91 bool* show_offline_pages_button_shown, |
| 92 bool* show_offline_copy_button_shown, | |
| 92 std::string* html) const override; | 93 std::string* html) const override; |
| 93 void LoadErrorPage(const std::string& html, const GURL& failed_url) override; | 94 void LoadErrorPage(const std::string& html, const GURL& failed_url) override; |
| 94 void EnablePageHelperFunctions() override; | 95 void EnablePageHelperFunctions() override; |
| 95 void UpdateErrorPage(const blink::WebURLError& error, | 96 void UpdateErrorPage(const blink::WebURLError& error, |
| 96 bool is_failed_post, | 97 bool is_failed_post, |
| 97 bool can_use_local_diagnostics_service, | 98 bool can_use_local_diagnostics_service, |
| 98 bool has_offline_pages) override; | 99 int offline_page_status) override; |
| 99 void FetchNavigationCorrections( | 100 void FetchNavigationCorrections( |
| 100 const GURL& navigation_correction_url, | 101 const GURL& navigation_correction_url, |
| 101 const std::string& navigation_correction_request_body) override; | 102 const std::string& navigation_correction_request_body) override; |
| 102 void CancelFetchNavigationCorrections() override; | 103 void CancelFetchNavigationCorrections() override; |
| 103 void SendTrackingRequest(const GURL& tracking_url, | 104 void SendTrackingRequest(const GURL& tracking_url, |
| 104 const std::string& tracking_request_body) override; | 105 const std::string& tracking_request_body) override; |
| 105 void ReloadPage(bool ignore_cache) override; | 106 void ReloadPage(bool ignore_cache) override; |
| 106 void LoadPageFromCache(const GURL& page_url) override; | 107 void LoadPageFromCache(const GURL& page_url) override; |
| 107 void DiagnoseError(const GURL& page_url) override; | 108 void DiagnoseError(const GURL& page_url) override; |
| 108 void ShowOfflinePages() override; | 109 void ShowOfflinePages() override; |
| 110 void LoadOfflineCopy(const GURL& page_url) override; | |
| 109 | 111 |
| 110 void OnNetErrorInfo(int status); | 112 void OnNetErrorInfo(int status); |
| 111 void OnSetCanShowNetworkDiagnosticsDialog( | 113 void OnSetCanShowNetworkDiagnosticsDialog( |
| 112 bool can_use_local_diagnostics_service); | 114 bool can_use_local_diagnostics_service); |
| 113 void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url, | 115 void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url, |
| 114 const std::string& language, | 116 const std::string& language, |
| 115 const std::string& country_code, | 117 const std::string& country_code, |
| 116 const std::string& api_key, | 118 const std::string& api_key, |
| 117 const GURL& search_url); | 119 const GURL& search_url); |
| 118 | 120 |
| 119 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, | 121 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, |
| 120 const std::string& data); | 122 const std::string& data); |
| 121 | 123 |
| 122 void OnTrackingRequestComplete(const blink::WebURLResponse& response, | 124 void OnTrackingRequestComplete(const blink::WebURLResponse& response, |
| 123 const std::string& data); | 125 const std::string& data); |
| 126 | |
| 127 // Called to set the status of the offline pages that will be used to decide | |
| 128 // if offline related button will be provided in the error page. | |
|
nasko
2015/11/13 23:55:13
Comment should be included in the #if defined sect
jianli
2015/11/14 00:26:05
Done.
| |
| 124 #if defined(OS_ANDROID) | 129 #if defined(OS_ANDROID) |
| 125 void OnSetHasOfflinePages(bool has_offline_pages); | 130 void OnSetOfflinePageInfo(int offline_page_status); |
| 126 #endif | 131 #endif |
| 127 | 132 |
| 128 scoped_ptr<content::ResourceFetcher> correction_fetcher_; | 133 scoped_ptr<content::ResourceFetcher> correction_fetcher_; |
| 129 scoped_ptr<content::ResourceFetcher> tracking_fetcher_; | 134 scoped_ptr<content::ResourceFetcher> tracking_fetcher_; |
| 130 | 135 |
| 131 scoped_ptr<error_page::NetErrorHelperCore> core_; | 136 scoped_ptr<error_page::NetErrorHelperCore> core_; |
| 132 | 137 |
| 133 // Weak factory for vending a weak pointer to a NetErrorPageController. Weak | 138 // Weak factory for vending a weak pointer to a NetErrorPageController. Weak |
| 134 // pointers are invalidated on each commit, to prevent getting messages from | 139 // pointers are invalidated on each commit, to prevent getting messages from |
| 135 // Controllers used for the previous commit that haven't yet been cleaned up. | 140 // Controllers used for the previous commit that haven't yet been cleaned up. |
| 136 base::WeakPtrFactory<NetErrorPageController::Delegate> | 141 base::WeakPtrFactory<NetErrorPageController::Delegate> |
| 137 weak_controller_delegate_factory_; | 142 weak_controller_delegate_factory_; |
| 138 | 143 |
| 139 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); | 144 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); |
| 140 }; | 145 }; |
| 141 | 146 |
| 142 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 147 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
| OLD | NEW |