| 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/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class ThreadChecker; | 13 class ThreadChecker; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class BrowserContext; | 17 class BrowserContext; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace chromecast { | 24 namespace chromecast { |
| 25 namespace shell { | |
| 26 class CastNetworkDelegate; | |
| 27 } | |
| 28 | 25 |
| 29 class CastService { | 26 class CastService { |
| 30 public: | 27 public: |
| 31 // A callback that will be invoked when the user changes the opt-in stats | 28 // A callback that will be invoked when the user changes the opt-in stats |
| 32 // value. | 29 // value. |
| 33 typedef base::Callback<void(bool)> OptInStatsChangedCallback; | 30 typedef base::Callback<void(bool)> OptInStatsChangedCallback; |
| 34 | 31 |
| 35 // Create() takes a separate url request context getter because the request | 32 // Create() takes a separate url request context getter because the request |
| 36 // context getter obtained through the browser context might not be | 33 // context getter obtained through the browser context might not be |
| 37 // appropriate for the url requests made by the cast service/reciever. | 34 // appropriate for the url requests made by the cast service/reciever. |
| 38 // For example, on Chromecast, it is needed to pass in a system url request | 35 // For example, on Chromecast, it is needed to pass in a system url request |
| 39 // context getter that would set the request context for NSS, which the main | 36 // context getter that would set the request context for NSS, which the main |
| 40 // getter doesn't do. | 37 // getter doesn't do. |
| 41 static CastService* Create( | 38 static CastService* Create( |
| 42 content::BrowserContext* browser_context, | 39 content::BrowserContext* browser_context, |
| 43 net::URLRequestContextGetter* request_context_getter, | 40 net::URLRequestContextGetter* request_context_getter, |
| 44 shell::CastNetworkDelegate* network_delegate, | |
| 45 const OptInStatsChangedCallback& opt_in_stats_callback); | 41 const OptInStatsChangedCallback& opt_in_stats_callback); |
| 46 | 42 |
| 47 virtual ~CastService(); | 43 virtual ~CastService(); |
| 48 | 44 |
| 49 // Start/stop the cast service. | 45 // Start/stop the cast service. |
| 50 void Start(); | 46 void Start(); |
| 51 void Stop(); | 47 void Stop(); |
| 52 | 48 |
| 53 protected: | 49 protected: |
| 54 CastService(content::BrowserContext* browser_context, | 50 CastService(content::BrowserContext* browser_context, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 69 const OptInStatsChangedCallback opt_in_stats_callback_; | 65 const OptInStatsChangedCallback opt_in_stats_callback_; |
| 70 bool stopped_; | 66 bool stopped_; |
| 71 const scoped_ptr<base::ThreadChecker> thread_checker_; | 67 const scoped_ptr<base::ThreadChecker> thread_checker_; |
| 72 | 68 |
| 73 DISALLOW_COPY_AND_ASSIGN(CastService); | 69 DISALLOW_COPY_AND_ASSIGN(CastService); |
| 74 }; | 70 }; |
| 75 | 71 |
| 76 } // namespace chromecast | 72 } // namespace chromecast |
| 77 | 73 |
| 78 #endif // CHROMECAST_SERVICE_CAST_SERVICE_H_ | 74 #endif // CHROMECAST_SERVICE_CAST_SERVICE_H_ |
| OLD | NEW |