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" | |
13 #include "chrome/common/net/net_error_info.h" | 12 #include "chrome/common/net/net_error_info.h" |
14 #include "chrome/renderer/net/net_error_helper_core.h" | 13 #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 content { | 20 namespace content { |
22 class ResourceFetcher; | 21 class ResourceFetcher; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const blink::WebURLError& error, | 63 const blink::WebURLError& error, |
65 bool is_failed_post, | 64 bool is_failed_post, |
66 std::string* error_html); | 65 std::string* error_html); |
67 | 66 |
68 // Returns whether a load for |url| in |frame| should have its error page | 67 // Returns whether a load for |url| in |frame| should have its error page |
69 // suppressed. | 68 // suppressed. |
70 bool ShouldSuppressErrorPage(blink::WebFrame* frame, const GURL& url); | 69 bool ShouldSuppressErrorPage(blink::WebFrame* frame, const GURL& url); |
71 | 70 |
72 private: | 71 private: |
73 // NetErrorHelperCore::Delegate implementation: | 72 // NetErrorHelperCore::Delegate implementation: |
74 virtual void GenerateLocalizedErrorPage( | 73 virtual void GenerateLocalizedErrorPage(const blink::WebURLError& error, |
75 const blink::WebURLError& error, | 74 bool is_failed_post, |
76 bool is_failed_post, | 75 std::string* html) const OVERRIDE; |
77 scoped_ptr<LocalizedError::ErrorPageParams> params, | |
78 std::string* html) const OVERRIDE; | |
79 virtual void LoadErrorPageInMainFrame(const std::string& html, | 76 virtual void LoadErrorPageInMainFrame(const std::string& html, |
80 const GURL& failed_url) OVERRIDE; | 77 const GURL& failed_url) OVERRIDE; |
81 virtual void EnableStaleLoadBindings(const GURL& page_url) OVERRIDE; | 78 virtual void EnableStaleLoadBindings(const GURL& page_url) OVERRIDE; |
82 virtual void UpdateErrorPage(const blink::WebURLError& error, | 79 virtual void UpdateErrorPage(const blink::WebURLError& error, |
83 bool is_failed_post) OVERRIDE; | 80 bool is_failed_post) OVERRIDE; |
84 virtual void FetchNavigationCorrections( | 81 virtual void FetchErrorPage(const GURL& url) OVERRIDE; |
85 const GURL& navigation_correction_url, | 82 virtual void CancelFetchErrorPage() OVERRIDE; |
86 const std::string& navigation_correction_request_body) OVERRIDE; | |
87 virtual void CancelFetchNavigationCorrections() OVERRIDE; | |
88 virtual void ReloadPage() OVERRIDE; | 83 virtual void ReloadPage() OVERRIDE; |
89 | 84 |
90 void OnNetErrorInfo(int status); | 85 void OnNetErrorInfo(int status); |
91 void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url, | 86 void OnSetAltErrorPageURL(const GURL& alternate_error_page_url); |
92 const std::string& language, | |
93 const std::string& country_code, | |
94 const std::string& api_key, | |
95 const GURL& search_url); | |
96 | 87 |
97 void OnNavigationCorrectionsFetched(const blink::WebURLResponse& response, | 88 void OnAlternateErrorPageRetrieved(const blink::WebURLResponse& response, |
98 const std::string& data); | 89 const std::string& data); |
99 | 90 |
100 scoped_ptr<content::ResourceFetcher> correction_fetcher_; | 91 scoped_ptr<content::ResourceFetcher> alt_error_page_fetcher_; |
101 | 92 |
102 NetErrorHelperCore core_; | 93 NetErrorHelperCore core_; |
103 | 94 |
104 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); | 95 DISALLOW_COPY_AND_ASSIGN(NetErrorHelper); |
105 }; | 96 }; |
106 | 97 |
107 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 98 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
OLD | NEW |