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

Side by Side Diff: chromecast/net/connectivity_checker.h

Issue 1145723004: Override OnSSLCertificateError() in connectivity_checker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle OnSSLCertificateError() in connectivity_checker. Created 5 years, 7 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
« no previous file with comments | « no previous file | chromecast/net/connectivity_checker.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROMECAST_NET_CONNECTIVITY_CHECKER_H_ 5 #ifndef CHROMECAST_NET_CONNECTIVITY_CHECKER_H_
6 #define CHROMECAST_NET_CONNECTIVITY_CHECKER_H_ 6 #define CHROMECAST_NET_CONNECTIVITY_CHECKER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "net/base/network_change_notifier.h" 11 #include "net/base/network_change_notifier.h"
12 #include "net/url_request/url_request.h" 12 #include "net/url_request/url_request.h"
13 13
14 class GURL; 14 class GURL;
15 15
16 namespace base { 16 namespace base {
17 class MessageLoopProxy; 17 class MessageLoopProxy;
18 } 18 }
19 19
20 namespace net { 20 namespace net {
21 class SSLInfo;
21 class URLRequestContext; 22 class URLRequestContext;
22 } 23 }
23 24
24 namespace chromecast { 25 namespace chromecast {
25 26
26 // Simple class to check network connectivity by sending a HEAD http request 27 // Simple class to check network connectivity by sending a HEAD http request
27 // to given url. 28 // to given url.
28 class ConnectivityChecker 29 class ConnectivityChecker
29 : public base::RefCountedThreadSafe<ConnectivityChecker>, 30 : public base::RefCountedThreadSafe<ConnectivityChecker>,
30 public net::URLRequest::Delegate, 31 public net::URLRequest::Delegate,
(...skipping 27 matching lines...) Expand all
58 59
59 protected: 60 protected:
60 ~ConnectivityChecker() override; 61 ~ConnectivityChecker() override;
61 62
62 private: 63 private:
63 friend class base::RefCountedThreadSafe<ConnectivityChecker>; 64 friend class base::RefCountedThreadSafe<ConnectivityChecker>;
64 65
65 // UrlRequest::Delegate implementation: 66 // UrlRequest::Delegate implementation:
66 void OnResponseStarted(net::URLRequest* request) override; 67 void OnResponseStarted(net::URLRequest* request) override;
67 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; 68 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
69 void OnSSLCertificateError(net::URLRequest* request,
70 const net::SSLInfo& ssl_info,
71 bool fatal) override;
68 72
69 // Initializes ConnectivityChecker 73 // Initializes ConnectivityChecker
70 void Initialize(); 74 void Initialize();
71 75
72 // NetworkChangeNotifier::ConnectionTypeObserver implementation: 76 // NetworkChangeNotifier::ConnectionTypeObserver implementation:
73 void OnConnectionTypeChanged( 77 void OnConnectionTypeChanged(
74 net::NetworkChangeNotifier::ConnectionType type) override; 78 net::NetworkChangeNotifier::ConnectionType type) override;
75 79
76 // net::NetworkChangeNotifier::IPAddressObserver implementation: 80 // net::NetworkChangeNotifier::IPAddressObserver implementation:
77 void OnIPAddressChanged() override; 81 void OnIPAddressChanged() override;
78 82
79 // Cancels current connectivity checking in progress. 83 // Cancels current connectivity checking in progress.
80 void Cancel(); 84 void Cancel();
81 85
82 // Sets connectivity and alerts observers if it has changed 86 // Sets connectivity and alerts observers if it has changed
83 void SetConnectivity(bool connected); 87 void SetConnectivity(bool connected);
84 88
89 // Called when URL request failed.
90 void OnUrlRequestError();
91
85 scoped_ptr<GURL> connectivity_check_url_; 92 scoped_ptr<GURL> connectivity_check_url_;
86 scoped_ptr<net::URLRequestContext> url_request_context_; 93 scoped_ptr<net::URLRequestContext> url_request_context_;
87 scoped_ptr<net::URLRequest> url_request_; 94 scoped_ptr<net::URLRequest> url_request_;
88 const scoped_refptr<ObserverListThreadSafe<ConnectivityObserver> > 95 const scoped_refptr<ObserverListThreadSafe<ConnectivityObserver> >
89 connectivity_observer_list_; 96 connectivity_observer_list_;
90 const scoped_refptr<base::MessageLoopProxy> loop_proxy_; 97 const scoped_refptr<base::MessageLoopProxy> loop_proxy_;
91 bool connected_; 98 bool connected_;
92 unsigned int bad_responses_; 99 // Number of connectivity check errors.
100 unsigned int check_errors_;
93 101
94 DISALLOW_COPY_AND_ASSIGN(ConnectivityChecker); 102 DISALLOW_COPY_AND_ASSIGN(ConnectivityChecker);
95 }; 103 };
96 104
97 } // namespace chromecast 105 } // namespace chromecast
98 106
99 #endif // CHROMECAST_NET_CONNECTIVITY_CHECKER_H_ 107 #endif // CHROMECAST_NET_CONNECTIVITY_CHECKER_H_
OLDNEW
« no previous file with comments | « no previous file | chromecast/net/connectivity_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698