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

Side by Side Diff: net/http/http_network_layer.h

Issue 10959020: SystemMonitor refactoring: move power state monitor into a separate class called PowerMonitor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Revert using Singleton pattern for PowerMonitor Created 8 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
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 NET_HTTP_HTTP_NETWORK_LAYER_H_ 5 #ifndef NET_HTTP_HTTP_NETWORK_LAYER_H_
6 #define NET_HTTP_HTTP_NETWORK_LAYER_H_ 6 #define NET_HTTP_HTTP_NETWORK_LAYER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/system_monitor/system_monitor.h" 12 #include "base/power_monitor/power_observer.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
15 #include "net/http/http_transaction_factory.h" 15 #include "net/http/http_transaction_factory.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 class HttpNetworkSession; 19 class HttpNetworkSession;
20 20
21 class NET_EXPORT HttpNetworkLayer 21 class NET_EXPORT HttpNetworkLayer
22 : public HttpTransactionFactory, 22 : public HttpTransactionFactory,
23 public base::SystemMonitor::PowerObserver, 23 public base::PowerObserver,
24 NON_EXPORTED_BASE(public base::NonThreadSafe) { 24 NON_EXPORTED_BASE(public base::NonThreadSafe) {
25 public: 25 public:
26 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which 26 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which
27 // contains a valid ProxyService. 27 // contains a valid ProxyService.
28 explicit HttpNetworkLayer(HttpNetworkSession* session); 28 explicit HttpNetworkLayer(HttpNetworkSession* session);
29 virtual ~HttpNetworkLayer(); 29 virtual ~HttpNetworkLayer();
30 30
31 // Create a transaction factory that instantiate a network layer over an 31 // Create a transaction factory that instantiate a network layer over an
32 // existing network session. Network session contains some valuable 32 // existing network session. Network session contains some valuable
33 // information (e.g. authentication data) that we want to share across 33 // information (e.g. authentication data) that we want to share across
(...skipping 11 matching lines...) Expand all
45 // "flow-control": enables flow control. 45 // "flow-control": enables flow control.
46 // "none" : disables both SSL and compression. 46 // "none" : disables both SSL and compression.
47 static void EnableSpdy(const std::string& mode); 47 static void EnableSpdy(const std::string& mode);
48 48
49 // HttpTransactionFactory methods: 49 // HttpTransactionFactory methods:
50 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans, 50 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans,
51 HttpTransactionDelegate* delegate) OVERRIDE; 51 HttpTransactionDelegate* delegate) OVERRIDE;
52 virtual HttpCache* GetCache() OVERRIDE; 52 virtual HttpCache* GetCache() OVERRIDE;
53 virtual HttpNetworkSession* GetSession() OVERRIDE; 53 virtual HttpNetworkSession* GetSession() OVERRIDE;
54 54
55 // base::SystemMonitor::PowerObserver methods: 55 // base::PowerObserver methods:
56 virtual void OnSuspend() OVERRIDE; 56 virtual void OnSuspend() OVERRIDE;
57 virtual void OnResume() OVERRIDE; 57 virtual void OnResume() OVERRIDE;
58 58
59 private: 59 private:
60 const scoped_refptr<HttpNetworkSession> session_; 60 const scoped_refptr<HttpNetworkSession> session_;
61 bool suspended_; 61 bool suspended_;
62 }; 62 };
63 63
64 } // namespace net 64 } // namespace net
65 65
66 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ 66 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698