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

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

Issue 2588253002: Enable download page action for error page (Closed)
Patch Set: set false in NetErrorTabHelper::DidFinishNavigation Created 3 years, 11 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) 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 static void set_state_for_testing(TestingState testing_state); 45 static void set_state_for_testing(TestingState testing_state);
46 46
47 // Sets a callback that will be called immediately after the helper sends 47 // Sets a callback that will be called immediately after the helper sends
48 // a NetErrorHelper IPC. (Used by the DNS probe browser test to know when to 48 // a NetErrorHelper IPC. (Used by the DNS probe browser test to know when to
49 // check the error page for updates, instead of polling.) 49 // check the error page for updates, instead of polling.)
50 void set_dns_probe_status_snoop_callback_for_testing( 50 void set_dns_probe_status_snoop_callback_for_testing(
51 const DnsProbeStatusSnoopCallback& dns_probe_status_snoop_callback) { 51 const DnsProbeStatusSnoopCallback& dns_probe_status_snoop_callback) {
52 dns_probe_status_snoop_callback_ = dns_probe_status_snoop_callback; 52 dns_probe_status_snoop_callback_ = dns_probe_status_snoop_callback;
53 } 53 }
54 54
55 #if BUILDFLAG(ANDROID_JAVA_UI)
56 bool is_showing_download_button_in_error_page() const {
57 return is_showing_download_button_in_error_page_;
58 }
59 #endif // BUILDFLAG(ANDROID_JAVA_
nasko 2017/01/10 17:40:22 nit: s/JAVA_/JAVA_UI)/
jianli 2017/01/10 21:35:26 Done.
60
55 // content::WebContentsObserver implementation. 61 // content::WebContentsObserver implementation.
56 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; 62 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
57 void DidStartNavigation( 63 void DidStartNavigation(
58 content::NavigationHandle* navigation_handle) override; 64 content::NavigationHandle* navigation_handle) override;
59 void DidFinishNavigation( 65 void DidFinishNavigation(
60 content::NavigationHandle* navigation_handle) override; 66 content::NavigationHandle* navigation_handle) override;
61 bool OnMessageReceived(const IPC::Message& message, 67 bool OnMessageReceived(const IPC::Message& message,
62 content::RenderFrameHost* render_frame_host) override; 68 content::RenderFrameHost* render_frame_host) override;
63 69
64 protected: 70 protected:
65 // |contents| is the WebContents of the tab this NetErrorTabHelper is 71 // |contents| is the WebContents of the tab this NetErrorTabHelper is
66 // attached to. 72 // attached to.
67 explicit NetErrorTabHelper(content::WebContents* contents); 73 explicit NetErrorTabHelper(content::WebContents* contents);
68 virtual void StartDnsProbe(); 74 virtual void StartDnsProbe();
69 virtual void SendInfo(); 75 virtual void SendInfo();
70 void OnDnsProbeFinished(error_page::DnsProbeStatus result); 76 void OnDnsProbeFinished(error_page::DnsProbeStatus result);
71 77
72 error_page::DnsProbeStatus dns_probe_status() const { 78 error_page::DnsProbeStatus dns_probe_status() const {
73 return dns_probe_status_; 79 return dns_probe_status_;
74 } 80 }
75 81
76 content::WebContentsFrameBindingSet<chrome::mojom::NetworkDiagnostics>& 82 content::WebContentsFrameBindingSet<chrome::mojom::NetworkDiagnostics>&
77 network_diagnostics_bindings_for_testing() { 83 network_diagnostics_bindings_for_testing() {
78 return network_diagnostics_bindings_; 84 return network_diagnostics_bindings_;
79 } 85 }
80 86
81 #if BUILDFLAG(ANDROID_JAVA_UI) 87 #if BUILDFLAG(ANDROID_JAVA_UI)
82 void DownloadPageLater(); 88 void OnDownloadPageLater();
89 void OnSetIsShowingDownloadButtonInErrorPage(bool is_showing_download_button);
83 #endif // BUILDFLAG(ANDROID_JAVA_UI) 90 #endif // BUILDFLAG(ANDROID_JAVA_UI)
84 91
85 private: 92 private:
86 friend class content::WebContentsUserData<NetErrorTabHelper>; 93 friend class content::WebContentsUserData<NetErrorTabHelper>;
87 94
88 void OnMainFrameDnsError(); 95 void OnMainFrameDnsError();
89 96
90 void InitializePref(content::WebContents* contents); 97 void InitializePref(content::WebContents* contents);
91 bool ProbesAllowed() const; 98 bool ProbesAllowed() const;
92 99
(...skipping 16 matching lines...) Expand all
109 bool is_error_page_; 116 bool is_error_page_;
110 117
111 // True if the helper has seen a main frame page load fail with a DNS error, 118 // True if the helper has seen a main frame page load fail with a DNS error,
112 // but has not yet seen a new page commit successfully afterwards. 119 // but has not yet seen a new page commit successfully afterwards.
113 bool dns_error_active_; 120 bool dns_error_active_;
114 121
115 // True if the helper has seen an error page commit while |dns_error_active_| 122 // True if the helper has seen an error page commit while |dns_error_active_|
116 // is true. (This should never be true if |dns_error_active_| is false.) 123 // is true. (This should never be true if |dns_error_active_| is false.)
117 bool dns_error_page_committed_; 124 bool dns_error_page_committed_;
118 125
126 #if BUILDFLAG(ANDROID_JAVA_UI)
127 // True if download button is being shown when the error page commits.
128 bool is_showing_download_button_in_error_page_;
129 #endif // BUILDFLAG(ANDROID_JAVA_UI
nasko 2017/01/10 17:40:22 nit: Still unmatched parenthesis here.
jianli 2017/01/10 21:35:26 Done.
130
119 // The status of a DNS probe that may or may not have started or finished. 131 // The status of a DNS probe that may or may not have started or finished.
120 // Since the renderer can change out from under the helper (in cross-process 132 // Since the renderer can change out from under the helper (in cross-process
121 // navigations), it re-sends the status whenever an error page commits. 133 // navigations), it re-sends the status whenever an error page commits.
122 error_page::DnsProbeStatus dns_probe_status_; 134 error_page::DnsProbeStatus dns_probe_status_;
123 135
124 // Optional callback for browser test to snoop on outgoing NetErrorInfo IPCs. 136 // Optional callback for browser test to snoop on outgoing NetErrorInfo IPCs.
125 DnsProbeStatusSnoopCallback dns_probe_status_snoop_callback_; 137 DnsProbeStatusSnoopCallback dns_probe_status_snoop_callback_;
126 138
127 // "Use a web service to resolve navigation errors" preference is required 139 // "Use a web service to resolve navigation errors" preference is required
128 // to allow probes. 140 // to allow probes.
129 BooleanPrefMember resolve_errors_with_web_service_; 141 BooleanPrefMember resolve_errors_with_web_service_;
130 142
131 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_; 143 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_;
132 144
133 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper); 145 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper);
134 }; 146 };
135 147
136 } // namespace chrome_browser_net 148 } // namespace chrome_browser_net
137 149
138 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ 150 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698