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> | |
9 | |
8 #include "chrome/common/net/net_error_info.h" | 10 #include "chrome/common/net/net_error_info.h" |
9 #include "chrome/common/net/net_error_tracker.h" | 11 #include "chrome/common/net/net_error_tracker.h" |
10 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_view_observer.h" |
13 #include "googleurl/src/gurl.h" | |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h" | |
15 | |
16 namespace base { | |
17 class DictionaryValue; | |
18 } | |
11 | 19 |
12 namespace WebKit { | 20 namespace WebKit { |
13 class WebFrame; | 21 class WebFrame; |
14 } | 22 } |
15 | 23 |
16 class NetErrorHelper : public content::RenderViewObserver { | 24 class NetErrorHelper : public content::RenderViewObserver { |
17 public: | 25 public: |
18 explicit NetErrorHelper(content::RenderView* render_view); | 26 explicit NetErrorHelper(content::RenderView* render_view); |
19 virtual ~NetErrorHelper(); | 27 virtual ~NetErrorHelper(); |
20 | 28 |
21 // RenderViewObserver implementation. | 29 // RenderViewObserver implementation. |
22 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) OVERRIDE; | 30 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) OVERRIDE; |
23 virtual void DidFailProvisionalLoad( | 31 virtual void DidFailProvisionalLoad( |
24 WebKit::WebFrame* frame, | 32 WebKit::WebFrame* frame, |
25 const WebKit::WebURLError& error) OVERRIDE; | 33 const WebKit::WebURLError& error) OVERRIDE; |
26 virtual void DidCommitProvisionalLoad( | 34 virtual void DidCommitProvisionalLoad( |
27 WebKit::WebFrame* frame, | 35 WebKit::WebFrame* frame, |
28 bool is_new_navigation) OVERRIDE; | 36 bool is_new_navigation) OVERRIDE; |
29 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; | 37 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; |
30 | 38 |
31 // IPC::Listener implementation. | 39 // IPC::Listener implementation. |
32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
33 | 41 |
42 static bool GetErrorStringsForDnsProbe( | |
43 const WebKit::WebURLError& error, | |
44 base::DictionaryValue* strings, | |
45 const std::string& locale); | |
46 | |
34 private: | 47 private: |
35 void OnNetErrorInfo(int dns_probe_result); | 48 enum State { |
36 void TrackerCallback(NetErrorTracker::DnsErrorPageState state); | 49 IDLE, // Helper is not currently handling a DNS error |
37 void UpdateErrorPage(chrome_common_net::DnsProbeResult dns_probe_result); | 50 AWAITING_INITIAL_IPC, // Helper is awaiting STARTED or NOT_RUN IPC |
51 AWAITING_PROBE_RESULT // Helper is awaiting FINISHED IPC to update page | |
52 }; | |
53 | |
54 void TrackerCallback( | |
55 NetErrorTracker::DnsErrorPageState state); | |
mmenke
2013/04/10 16:56:58
nit: Does this fit on single line?
Deprecated (see juliatuttle)
2013/04/10 23:42:32
Done.
| |
56 void OnNetErrorInfo(int status); | |
57 | |
58 void UpdateErrorPage(); | |
59 WebKit::WebURLError MakeUpdatedError(); | |
60 | |
61 State state_; | |
62 | |
63 WebKit::WebURLError last_error_; | |
64 chrome_common_net::DnsProbeStatus last_status_; | |
38 | 65 |
39 NetErrorTracker tracker_; | 66 NetErrorTracker tracker_; |
40 NetErrorTracker::DnsErrorPageState dns_error_page_state_; | |
41 bool updated_error_page_; | |
42 }; | 67 }; |
43 | 68 |
44 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ | 69 #endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
OLD | NEW |