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 aura { | |
12 class WindowTreeHost; | |
13 } | |
14 | |
15 namespace base { | 11 namespace base { |
16 class ThreadChecker; | 12 class ThreadChecker; |
17 } | 13 } |
18 | 14 |
19 namespace content{ | 15 namespace content{ |
20 class BrowserContext; | 16 class BrowserContext; |
21 class WebContents; | |
22 } | 17 } |
23 | 18 |
24 namespace chromecast { | 19 namespace chromecast { |
25 | 20 |
26 class CastService { | 21 class CastService { |
27 public: | 22 public: |
28 explicit CastService(content::BrowserContext* browser_context); | 23 static CastService* Create(content::BrowserContext* browser_context); |
| 24 |
29 virtual ~CastService(); | 25 virtual ~CastService(); |
30 | 26 |
31 // Start/stop the cast service. | 27 // Start/stop the cast service. |
32 void Start(); | 28 void Start(); |
33 void Stop(); | 29 void Stop(); |
34 | 30 |
| 31 protected: |
| 32 explicit CastService(content::BrowserContext* browser_context); |
| 33 virtual void Initialize() = 0; |
| 34 |
| 35 // Implementation-specific start/stop behavior. |
| 36 virtual void StartInternal() = 0; |
| 37 virtual void StopInternal() = 0; |
| 38 |
| 39 content::BrowserContext* browser_context() const { return browser_context_; } |
| 40 |
35 private: | 41 private: |
36 // Platform specific initialization if any. | |
37 static void PlatformInitialize(); | |
38 | |
39 void Initialize(); | |
40 | |
41 content::BrowserContext* const browser_context_; | 42 content::BrowserContext* const browser_context_; |
42 scoped_ptr<aura::WindowTreeHost> window_tree_host_; | |
43 scoped_ptr<content::WebContents> web_contents_; | |
44 bool stopped_; | 43 bool stopped_; |
45 | 44 |
46 const scoped_ptr<base::ThreadChecker> thread_checker_; | 45 const scoped_ptr<base::ThreadChecker> thread_checker_; |
47 | 46 |
48 DISALLOW_COPY_AND_ASSIGN(CastService); | 47 DISALLOW_COPY_AND_ASSIGN(CastService); |
49 }; | 48 }; |
50 | 49 |
51 } // namespace chromecast | 50 } // namespace chromecast |
52 | 51 |
53 #endif // CHROMECAST_SERVICE_CAST_SERVICE_H_ | 52 #endif // CHROMECAST_SERVICE_CAST_SERVICE_H_ |
OLD | NEW |