Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: chrome/renderer/net/net_error_helper.h

Issue 13270005: Display DNS probe results. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/common/net/net_error_info.h" 8 #include "chrome/common/net/net_error_info.h"
9 #include "chrome/common/net/net_error_tracker.h" 9 #include "chrome/common/net/net_error_tracker.h"
10 #include "content/public/renderer/render_view_observer.h" 10 #include "content/public/renderer/render_view_observer.h"
11 #include "googleurl/src/gurl.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h"
13
14 namespace base {
15 class DictionaryValue;
16 }
11 17
12 namespace WebKit { 18 namespace WebKit {
13 class WebFrame; 19 class WebFrame;
14 } 20 }
15 21
16 class NetErrorHelper : public content::RenderViewObserver { 22 class NetErrorHelper : public content::RenderViewObserver {
17 public: 23 public:
18 explicit NetErrorHelper(content::RenderView* render_view); 24 explicit NetErrorHelper(content::RenderView* render_view);
19 virtual ~NetErrorHelper(); 25 virtual ~NetErrorHelper();
20 26
21 // RenderViewObserver implementation. 27 // RenderViewObserver implementation.
22 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) OVERRIDE; 28 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) OVERRIDE;
23 virtual void DidFailProvisionalLoad( 29 virtual void DidFailProvisionalLoad(
24 WebKit::WebFrame* frame, 30 WebKit::WebFrame* frame,
25 const WebKit::WebURLError& error) OVERRIDE; 31 const WebKit::WebURLError& error) OVERRIDE;
26 virtual void DidCommitProvisionalLoad( 32 virtual void DidCommitProvisionalLoad(
27 WebKit::WebFrame* frame, 33 WebKit::WebFrame* frame,
28 bool is_new_navigation) OVERRIDE; 34 bool is_new_navigation) OVERRIDE;
29 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; 35 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE;
30 36
31 // IPC::Listener implementation. 37 // IPC::Listener implementation.
32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
33 39
40 static bool GetErrorStringsForDnsProbe(
41 const WebKit::WebURLError& error,
42 base::DictionaryValue* strings,
43 const std::string& locale);
44
34 private: 45 private:
35 void OnNetErrorInfo(int dns_probe_result); 46 enum State {
36 void TrackerCallback(NetErrorTracker::DnsErrorPageState state); 47 IDLE, // Helper is not currently handling a DNS error
37 void UpdateErrorPage(chrome_common_net::DnsProbeResult dns_probe_result); 48 AWAITING_LOAD, // Helper is waiting for error page load to finish
49 AWAITING_INITIAL_IPC, // Helper is awaiting STARTED or NOT_RUN IPC
50 AWAITING_PROBE_RESULT // Helper is awaiting FINISHED IPC to update page
51 };
52
53 void TrackerCallback(
54 NetErrorTracker::DnsErrorPageState state);
55 void OnNetErrorInfo(int status, int result);
56
57 void UpdateErrorPage();
58 WebKit::WebURLError MakeUpdatedError();
59
60 State state_;
61
62 WebKit::WebURLError last_error_;
63 chrome_common_net::DnsProbeStatus last_status_;
64 chrome_common_net::DnsProbeResult last_result_;
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698