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

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

Issue 2647323010: [Chromecast] Add proxy server support to chromecast (Closed)
Patch Set: Fixing test break. Created 3 years, 10 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 | « chromecast/net/DEPS ('k') | 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 <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/observer_list_threadsafe.h" 12 #include "base/observer_list_threadsafe.h"
13 13
14 namespace base { 14 namespace base {
15 class SingleThreadTaskRunner; 15 class SingleThreadTaskRunner;
16 } 16 }
17 17
18 namespace net {
19 class URLRequestContextGetter;
20 }
21
18 namespace chromecast { 22 namespace chromecast {
19 23
20 // Checks if internet connectivity is available. 24 // Checks if internet connectivity is available.
21 class ConnectivityChecker 25 class ConnectivityChecker
22 : public base::RefCountedThreadSafe<ConnectivityChecker> { 26 : public base::RefCountedThreadSafe<ConnectivityChecker> {
23 public: 27 public:
24 class ConnectivityObserver { 28 class ConnectivityObserver {
25 public: 29 public:
26 // Will be called when internet connectivity changes. 30 // Will be called when internet connectivity changes.
27 virtual void OnConnectivityChanged(bool connected) = 0; 31 virtual void OnConnectivityChanged(bool connected) = 0;
28 32
29 protected: 33 protected:
30 ConnectivityObserver() {} 34 ConnectivityObserver() {}
31 virtual ~ConnectivityObserver() {} 35 virtual ~ConnectivityObserver() {}
32 36
33 private: 37 private:
34 DISALLOW_COPY_AND_ASSIGN(ConnectivityObserver); 38 DISALLOW_COPY_AND_ASSIGN(ConnectivityObserver);
35 }; 39 };
36 40
37 static scoped_refptr<ConnectivityChecker> Create( 41 static scoped_refptr<ConnectivityChecker> Create(
38 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 42 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
43 net::URLRequestContextGetter* url_request_context_getter);
39 44
40 ConnectivityChecker(); 45 ConnectivityChecker();
41 46
42 void AddConnectivityObserver(ConnectivityObserver* observer); 47 void AddConnectivityObserver(ConnectivityObserver* observer);
43 void RemoveConnectivityObserver(ConnectivityObserver* observer); 48 void RemoveConnectivityObserver(ConnectivityObserver* observer);
44 49
45 // Returns if there is internet connectivity. 50 // Returns if there is internet connectivity.
46 virtual bool Connected() const = 0; 51 virtual bool Connected() const = 0;
47 52
48 // Checks for connectivity. 53 // Checks for connectivity.
(...skipping 10 matching lines...) Expand all
59 64
60 const scoped_refptr<base::ObserverListThreadSafe<ConnectivityObserver>> 65 const scoped_refptr<base::ObserverListThreadSafe<ConnectivityObserver>>
61 connectivity_observer_list_; 66 connectivity_observer_list_;
62 67
63 DISALLOW_COPY_AND_ASSIGN(ConnectivityChecker); 68 DISALLOW_COPY_AND_ASSIGN(ConnectivityChecker);
64 }; 69 };
65 70
66 } // namespace chromecast 71 } // namespace chromecast
67 72
68 #endif // CHROMECAST_NET_CONNECTIVITY_CHECKER_H_ 73 #endif // CHROMECAST_NET_CONNECTIVITY_CHECKER_H_
OLDNEW
« no previous file with comments | « chromecast/net/DEPS ('k') | chromecast/net/connectivity_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698