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