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

Side by Side Diff: chrome/browser/net/net_error_tab_helper.h

Issue 2465623002: Add chrome namespace to chrome/common/network_diagnostics.mojom (Closed)
Patch Set: Add chrome namespace to chrome/common/network_diagnostics.mojom Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/net/net_error_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_
6 #define CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ 6 #define CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/public/browser/web_contents_user_data.h" 22 #include "content/public/browser/web_contents_user_data.h"
23 23
24 namespace chrome_browser_net { 24 namespace chrome_browser_net {
25 25
26 // A TabHelper that monitors loads for certain types of network errors and 26 // A TabHelper that monitors loads for certain types of network errors and
27 // does interesting things with them. Currently, starts DNS probes using the 27 // does interesting things with them. Currently, starts DNS probes using the
28 // DnsProbeService whenever a page fails to load with a DNS-related error. 28 // DnsProbeService whenever a page fails to load with a DNS-related error.
29 class NetErrorTabHelper 29 class NetErrorTabHelper
30 : public content::WebContentsObserver, 30 : public content::WebContentsObserver,
31 public content::WebContentsUserData<NetErrorTabHelper>, 31 public content::WebContentsUserData<NetErrorTabHelper>,
32 public mojom::NetworkDiagnostics { 32 public chrome::mojom::NetworkDiagnostics {
33 public: 33 public:
34 enum TestingState { 34 enum TestingState {
35 TESTING_DEFAULT, 35 TESTING_DEFAULT,
36 TESTING_FORCE_DISABLED, 36 TESTING_FORCE_DISABLED,
37 TESTING_FORCE_ENABLED 37 TESTING_FORCE_ENABLED
38 }; 38 };
39 39
40 typedef base::Callback<void(error_page::DnsProbeStatus)> 40 typedef base::Callback<void(error_page::DnsProbeStatus)>
41 DnsProbeStatusSnoopCallback; 41 DnsProbeStatusSnoopCallback;
42 42
(...skipping 23 matching lines...) Expand all
66 // attached to. 66 // attached to.
67 explicit NetErrorTabHelper(content::WebContents* contents); 67 explicit NetErrorTabHelper(content::WebContents* contents);
68 virtual void StartDnsProbe(); 68 virtual void StartDnsProbe();
69 virtual void SendInfo(); 69 virtual void SendInfo();
70 void OnDnsProbeFinished(error_page::DnsProbeStatus result); 70 void OnDnsProbeFinished(error_page::DnsProbeStatus result);
71 71
72 error_page::DnsProbeStatus dns_probe_status() const { 72 error_page::DnsProbeStatus dns_probe_status() const {
73 return dns_probe_status_; 73 return dns_probe_status_;
74 } 74 }
75 75
76 content::WebContentsFrameBindingSet<mojom::NetworkDiagnostics>& 76 content::WebContentsFrameBindingSet<chrome::mojom::NetworkDiagnostics>&
77 network_diagnostics_bindings_for_testing() { 77 network_diagnostics_bindings_for_testing() {
78 return network_diagnostics_bindings_; 78 return network_diagnostics_bindings_;
79 } 79 }
80 80
81 private: 81 private:
82 friend class content::WebContentsUserData<NetErrorTabHelper>; 82 friend class content::WebContentsUserData<NetErrorTabHelper>;
83 83
84 void OnMainFrameDnsError(); 84 void OnMainFrameDnsError();
85 85
86 void InitializePref(content::WebContents* contents); 86 void InitializePref(content::WebContents* contents);
87 bool ProbesAllowed() const; 87 bool ProbesAllowed() const;
88 88
89 // mojom::NetworkDiagnostics: 89 // chrome::mojom::NetworkDiagnostics:
90 void RunNetworkDiagnostics(const GURL& url) override; 90 void RunNetworkDiagnostics(const GURL& url) override;
91 91
92 // Shows the diagnostics dialog after its been sanitized, virtual for 92 // Shows the diagnostics dialog after its been sanitized, virtual for
93 // testing. 93 // testing.
94 virtual void RunNetworkDiagnosticsHelper(const std::string& sanitized_url); 94 virtual void RunNetworkDiagnosticsHelper(const std::string& sanitized_url);
95 95
96 // Relates to offline pages handling. 96 // Relates to offline pages handling.
97 #if BUILDFLAG(ANDROID_JAVA_UI) 97 #if BUILDFLAG(ANDROID_JAVA_UI)
98 void UpdateHasOfflinePages(int frame_tree_node_id); 98 void UpdateHasOfflinePages(int frame_tree_node_id);
99 void SetHasOfflinePages(int frame_tree_node_id, bool has_offline_pages); 99 void SetHasOfflinePages(int frame_tree_node_id, bool has_offline_pages);
100 void ShowOfflinePages(); 100 void ShowOfflinePages();
101 bool IsFromErrorPage() const; 101 bool IsFromErrorPage() const;
102 #endif // BUILDFLAG(ANDROID_JAVA_UI) 102 #endif // BUILDFLAG(ANDROID_JAVA_UI)
103 103
104 content::WebContentsFrameBindingSet<mojom::NetworkDiagnostics> 104 content::WebContentsFrameBindingSet<chrome::mojom::NetworkDiagnostics>
105 network_diagnostics_bindings_; 105 network_diagnostics_bindings_;
106 106
107 // True if the last provisional load that started was for an error page. 107 // True if the last provisional load that started was for an error page.
108 bool is_error_page_; 108 bool is_error_page_;
109 109
110 // True if the helper has seen a main frame page load fail with a DNS error, 110 // True if the helper has seen a main frame page load fail with a DNS error,
111 // but has not yet seen a new page commit successfully afterwards. 111 // but has not yet seen a new page commit successfully afterwards.
112 bool dns_error_active_; 112 bool dns_error_active_;
113 113
114 // True if the helper has seen an error page commit while |dns_error_active_| 114 // True if the helper has seen an error page commit while |dns_error_active_|
(...skipping 13 matching lines...) Expand all
128 BooleanPrefMember resolve_errors_with_web_service_; 128 BooleanPrefMember resolve_errors_with_web_service_;
129 129
130 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_; 130 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_;
131 131
132 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper); 132 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper);
133 }; 133 };
134 134
135 } // namespace chrome_browser_net 135 } // namespace chrome_browser_net
136 136
137 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ 137 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/net_error_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698