| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SERVICE_CAST_SERVICE_H_ | 5 #ifndef CHROMECAST_SERVICE_CAST_SERVICE_H_ |
| 6 #define CHROMECAST_SERVICE_CAST_SERVICE_H_ | 6 #define CHROMECAST_SERVICE_CAST_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 | 10 |
| 11 namespace base { | 11 namespace base { |
| 12 class ThreadChecker; | 12 class ThreadChecker; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace content{ | 15 namespace content{ |
| 16 class BrowserContext; | 16 class BrowserContext; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace chromecast { | 23 namespace chromecast { |
| 24 namespace shell { |
| 25 class CastNetworkDelegate; |
| 26 } |
| 24 | 27 |
| 25 class CastService { | 28 class CastService { |
| 26 public: | 29 public: |
| 27 // Create() takes a separate url request context getter because the request | 30 // Create() takes a separate url request context getter because the request |
| 28 // context getter obtained through the browser context might not be | 31 // context getter obtained through the browser context might not be |
| 29 // appropriate for the url requests made by the cast service/reciever. | 32 // appropriate for the url requests made by the cast service/reciever. |
| 30 // For example, on Chromecast, it is needed to pass in a system url request | 33 // For example, on Chromecast, it is needed to pass in a system url request |
| 31 // context getter that would set the request context for NSS, which the main | 34 // context getter that would set the request context for NSS, which the main |
| 32 // getter doesn't do. | 35 // getter doesn't do. |
| 33 static CastService* Create( | 36 static CastService* Create( |
| 34 content::BrowserContext* browser_context, | 37 content::BrowserContext* browser_context, |
| 35 net::URLRequestContextGetter* request_context_getter); | 38 net::URLRequestContextGetter* request_context_getter, |
| 39 shell::CastNetworkDelegate* network_delegate); |
| 36 | 40 |
| 37 virtual ~CastService(); | 41 virtual ~CastService(); |
| 38 | 42 |
| 39 // Start/stop the cast service. | 43 // Start/stop the cast service. |
| 40 void Start(); | 44 void Start(); |
| 41 void Stop(); | 45 void Stop(); |
| 42 | 46 |
| 43 protected: | 47 protected: |
| 44 explicit CastService(content::BrowserContext* browser_context); | 48 explicit CastService(content::BrowserContext* browser_context); |
| 45 virtual void Initialize() = 0; | 49 virtual void Initialize() = 0; |
| 46 | 50 |
| 47 // Implementation-specific start/stop behavior. | 51 // Implementation-specific start/stop behavior. |
| 48 virtual void StartInternal() = 0; | 52 virtual void StartInternal() = 0; |
| 49 virtual void StopInternal() = 0; | 53 virtual void StopInternal() = 0; |
| 50 | 54 |
| 51 content::BrowserContext* browser_context() const { return browser_context_; } | 55 content::BrowserContext* browser_context() const { return browser_context_; } |
| 52 | 56 |
| 53 private: | 57 private: |
| 54 content::BrowserContext* const browser_context_; | 58 content::BrowserContext* const browser_context_; |
| 55 bool stopped_; | 59 bool stopped_; |
| 56 | 60 |
| 57 const scoped_ptr<base::ThreadChecker> thread_checker_; | 61 const scoped_ptr<base::ThreadChecker> thread_checker_; |
| 58 | 62 |
| 59 DISALLOW_COPY_AND_ASSIGN(CastService); | 63 DISALLOW_COPY_AND_ASSIGN(CastService); |
| 60 }; | 64 }; |
| 61 | 65 |
| 62 } // namespace chromecast | 66 } // namespace chromecast |
| 63 | 67 |
| 64 #endif // CHROMECAST_SERVICE_CAST_SERVICE_H_ | 68 #endif // CHROMECAST_SERVICE_CAST_SERVICE_H_ |
| OLD | NEW |