Roll src/third_party/WebKit 0c3f21f:4f9ce20 (svn 202223:202224)
[chromium-blink-merge.git] / chromecast / service / cast_service.h
blob48a4066e370c25978ad327dfebb74a0eeeaf5d62
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
3 // found in the LICENSE file.
5 #ifndef CHROMECAST_SERVICE_CAST_SERVICE_H_
6 #define CHROMECAST_SERVICE_CAST_SERVICE_H_
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
12 class PrefService;
14 namespace base {
15 class ThreadChecker;
18 namespace content {
19 class BrowserContext;
22 namespace net {
23 class URLRequestContextGetter;
26 namespace chromecast {
28 class CastService {
29 public:
30 virtual ~CastService();
32 // Initializes/finalizes the cast service.
33 void Initialize();
34 void Finalize();
36 // Starts/stops the cast service.
37 void Start();
38 void Stop();
40 protected:
41 CastService(content::BrowserContext* browser_context,
42 PrefService* pref_service);
44 // Implementation-specific initialization. Initialization of cast service's
45 // sub-components, and anything that requires IO operations should go here.
46 // Anything that should happen before cast service is started but doesn't need
47 // the sub-components to finish initializing should also go here.
48 virtual void InitializeInternal() = 0;
50 // Implementation-specific finalization. Any initializations done by
51 // InitializeInternal() should be finalized here.
52 virtual void FinalizeInternal() = 0;
54 // Implementation-specific start behavior. It basically starts the
55 // sub-component services and does additional initialization that cannot be
56 // done in the InitializationInternal().
57 virtual void StartInternal() = 0;
59 // Implementation-specific stop behavior. Any initializations done by
60 // StartInternal() should be finalized here.
61 virtual void StopInternal() = 0;
63 content::BrowserContext* browser_context() const { return browser_context_; }
64 PrefService* pref_service() const { return pref_service_; }
66 private:
67 content::BrowserContext* const browser_context_;
68 PrefService* const pref_service_;
69 bool stopped_;
70 const scoped_ptr<base::ThreadChecker> thread_checker_;
72 DISALLOW_COPY_AND_ASSIGN(CastService);
75 } // namespace chromecast
77 #endif // CHROMECAST_SERVICE_CAST_SERVICE_H_