| 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 "chrome/common/net/net_error_info.h" | 10 #include "chrome/common/net/net_error_info.h" |
| 11 #include "chrome/renderer/net/net_error_helper_core.h" | 11 #include "chrome/renderer/net/net_error_helper_core.h" |
| 12 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_frame_observer.h" |
| 13 #include "content/public/renderer/render_view_observer_tracker.h" | 13 #include "content/public/renderer/render_frame_observer_tracker.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class ResourceFetcher; | 18 class ResourceFetcher; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 class WebFrame; | 22 class WebFrame; |
| 23 class WebURLResponse; | 23 class WebURLResponse; |
| 24 struct WebURLError; | 24 struct WebURLError; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // Listens for NetErrorInfo messages from the NetErrorTabHelper on the | 27 // Listens for NetErrorInfo messages from the NetErrorTabHelper on the |
| 28 // browser side and updates the error page with more details (currently, just | 28 // browser side and updates the error page with more details (currently, just |
| 29 // DNS probe results) if/when available. | 29 // DNS probe results) if/when available. |
| 30 class NetErrorHelper | 30 class NetErrorHelper |
| 31 : public content::RenderViewObserver, | 31 : public content::RenderFrameObserver, |
| 32 public content::RenderViewObserverTracker<NetErrorHelper>, | 32 public content::RenderFrameObserverTracker<NetErrorHelper>, |
| 33 public NetErrorHelperCore::Delegate { | 33 public NetErrorHelperCore::Delegate { |
| 34 public: | 34 public: |
| 35 explicit NetErrorHelper(content::RenderView* render_view); | 35 explicit NetErrorHelper(content::RenderFrame* render_view); |
| 36 virtual ~NetErrorHelper(); | 36 virtual ~NetErrorHelper(); |
| 37 | 37 |
| 38 // RenderViewObserver implementation. | 38 // RenderFrameObserver implementation. |
| 39 virtual void DidStartProvisionalLoad(blink::WebFrame* frame) OVERRIDE; | 39 virtual void DidStartProvisionalLoad() OVERRIDE; |
| 40 virtual void DidCommitProvisionalLoad(blink::WebFrame* frame, | 40 virtual void DidCommitProvisionalLoad(bool is_new_navigation) OVERRIDE; |
| 41 bool is_new_navigation) OVERRIDE; | 41 virtual void DidFinishLoad() OVERRIDE; |
| 42 virtual void DidFinishLoad(blink::WebFrame* frame) OVERRIDE; | |
| 43 virtual void OnStop() OVERRIDE; | 42 virtual void OnStop() OVERRIDE; |
| 44 | 43 |
| 45 // IPC::Listener implementation. | 44 // IPC::Listener implementation. |
| 46 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 45 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 47 | 46 |
| 48 // Examines |frame| and |error| to see if this is an error worthy of a DNS | 47 // Examines |frame| and |error| to see if this is an error worthy of a DNS |
| 49 // probe. If it is, initializes |error_strings| based on |error|, | 48 // probe. If it is, initializes |error_strings| based on |error|, |
| 50 // |is_failed_post|, and |locale| with suitable strings and returns true. | 49 // |is_failed_post|, and |locale| with suitable strings and returns true. |
| 51 // If not, returns false, in which case the caller should look up error | 50 // If not, returns false, in which case the caller should look up error |
| 52 // strings directly using LocalizedError::GetNavigationErrorStrings. | 51 // strings directly using LocalizedError::GetNavigationErrorStrings. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 75 | 74 |
| 76 void OnAlternateErrorPageRetrieved(const blink::WebURLResponse& response, | 75 void OnAlternateErrorPageRetrieved(const blink::WebURLResponse& response, |
| 77 const std::string& data); | 76 const std::string& data); |
| 78 | 77 |
| 79 scoped_ptr<content::ResourceFetcher> alt_error_page_fetcher_; | 78 scoped_ptr<content::ResourceFetcher> alt_error_page_fetcher_; |
| 80 | 79 |
| 81 NetErrorHelperCore core_; | 80 NetErrorHelperCore core_; |
| 82 }; | 81 }; |
| 83 | 82 |
| 84 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 83 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
| OLD | NEW |