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

Side by Side Diff: net/url_request/https_prober.h

Issue 6730034: Remove all "net::" prefixes under net/url_request for code that's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed indentation Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/url_request/https_prober.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 NET_BASE_HTTPS_PROBER_H_ 5 #ifndef NET_BASE_HTTPS_PROBER_H_
6 #define NET_BASE_HTTPS_PROBER_H_ 6 #define NET_BASE_HTTPS_PROBER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/task.h" 13 #include "base/task.h"
14 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
15 15
16 template <typename T> struct DefaultSingletonTraits; 16 template <typename T> struct DefaultSingletonTraits;
17 17
18 namespace net { 18 namespace net {
19 19
20 class URLRequestContext; 20 class URLRequestContext;
21 21
22 // This should be scoped inside HTTPSProber, but VC cannot compile 22 // This should be scoped inside HTTPSProber, but VC cannot compile
23 // HTTPProber::Delegate when HTTPSProber also inherits from 23 // HTTPProber::Delegate when HTTPSProber also inherits from
24 // net::URLRequest::Delegate. 24 // URLRequest::Delegate.
25 class HTTPSProberDelegate { 25 class HTTPSProberDelegate {
26 public: 26 public:
27 virtual void ProbeComplete(bool result) = 0; 27 virtual void ProbeComplete(bool result) = 0;
28 protected: 28 protected:
29 virtual ~HTTPSProberDelegate() {} 29 virtual ~HTTPSProberDelegate() {}
30 }; 30 };
31 31
32 // HTTPSProber is a singleton object that manages HTTPS probes. A HTTPS probe 32 // HTTPSProber is a singleton object that manages HTTPS probes. A HTTPS probe
33 // determines if we can connect to a given host over HTTPS. It's used when 33 // determines if we can connect to a given host over HTTPS. It's used when
34 // transparently upgrading from HTTP to HTTPS (for example, for SPDY). 34 // transparently upgrading from HTTP to HTTPS (for example, for SPDY).
35 class HTTPSProber : public net::URLRequest::Delegate { 35 class HTTPSProber : public URLRequest::Delegate {
36 public: 36 public:
37 // Returns the singleton instance. 37 // Returns the singleton instance.
38 static HTTPSProber* GetInstance(); 38 static HTTPSProber* GetInstance();
39 39
40 // HaveProbed returns true if the given host is known to have been probed 40 // HaveProbed returns true if the given host is known to have been probed
41 // since the browser was last started. 41 // since the browser was last started.
42 bool HaveProbed(const std::string& host) const; 42 bool HaveProbed(const std::string& host) const;
43 43
44 // InFlight returns true iff a probe for the given host is currently active. 44 // InFlight returns true iff a probe for the given host is currently active.
45 bool InFlight(const std::string& host) const; 45 bool InFlight(const std::string& host) const;
46 46
47 // ProbeHost starts a new probe for the given host. If the host is known to 47 // ProbeHost starts a new probe for the given host. If the host is known to
48 // have been probed since the browser was started, false is returned and no 48 // have been probed since the browser was started, false is returned and no
49 // other action is taken. If a probe to the given host in currently inflight, 49 // other action is taken. If a probe to the given host in currently inflight,
50 // false will be returned, and no other action is taken. Otherwise, a new 50 // false will be returned, and no other action is taken. Otherwise, a new
51 // probe is started, true is returned and the Delegate will be called with the 51 // probe is started, true is returned and the Delegate will be called with the
52 // results (true means a successful handshake). 52 // results (true means a successful handshake).
53 bool ProbeHost(const std::string& host, URLRequestContext* ctx, 53 bool ProbeHost(const std::string& host, URLRequestContext* ctx,
54 HTTPSProberDelegate* delegate); 54 HTTPSProberDelegate* delegate);
55 55
56 // Implementation of net::URLRequest::Delegate 56 // Implementation of URLRequest::Delegate
57 virtual void OnAuthRequired(net::URLRequest* request, 57 virtual void OnAuthRequired(URLRequest* request,
58 net::AuthChallengeInfo* auth_info); 58 AuthChallengeInfo* auth_info);
59 virtual void OnSSLCertificateError(net::URLRequest* request, 59 virtual void OnSSLCertificateError(URLRequest* request,
60 int cert_error, 60 int cert_error,
61 net::X509Certificate* cert); 61 X509Certificate* cert);
62 virtual void OnResponseStarted(net::URLRequest* request); 62 virtual void OnResponseStarted(URLRequest* request);
63 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); 63 virtual void OnReadCompleted(URLRequest* request, int bytes_read);
64 64
65 private: 65 private:
66 friend struct DefaultSingletonTraits<HTTPSProber>; 66 friend struct DefaultSingletonTraits<HTTPSProber>;
67 67
68 HTTPSProber(); 68 HTTPSProber();
69 ~HTTPSProber(); 69 ~HTTPSProber();
70 70
71 void Success(net::URLRequest* request); 71 void Success(URLRequest* request);
72 void Failure(net::URLRequest* request); 72 void Failure(URLRequest* request);
73 void DoCallback(net::URLRequest* request, bool result); 73 void DoCallback(URLRequest* request, bool result);
74 74
75 std::map<std::string, HTTPSProberDelegate*> inflight_probes_; 75 std::map<std::string, HTTPSProberDelegate*> inflight_probes_;
76 std::set<std::string> probed_; 76 std::set<std::string> probed_;
77 77
78 DISALLOW_COPY_AND_ASSIGN(HTTPSProber); 78 DISALLOW_COPY_AND_ASSIGN(HTTPSProber);
79 }; 79 };
80 80
81 } // namespace net 81 } // namespace net
82 82
83 #endif // NET_BASE_HTTPS_PROBER_H_ 83 #endif // NET_BASE_HTTPS_PROBER_H_
OLDNEW
« no previous file with comments | « no previous file | net/url_request/https_prober.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698