OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/containers/scoped_ptr_hash_map.h" | 13 #include "base/containers/scoped_ptr_hash_map.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
20 #include "base/threading/thread_checker.h" | 20 #include "base/threading/thread_checker.h" |
21 #include "chrome/browser/media/router/issue.h" | 21 #include "chrome/browser/media/router/issue.h" |
22 #include "chrome/browser/media/router/media_router.h" | 22 #include "chrome/browser/media/router/media_router.h" |
23 #include "chrome/browser/media/router/media_router.mojom.h" | 23 #include "chrome/browser/media/router/media_router.mojom.h" |
24 #include "components/keyed_service/core/keyed_service.h" | |
25 | 24 |
26 namespace content { | 25 namespace content { |
27 class BrowserContext; | 26 class BrowserContext; |
28 } | 27 } |
29 | 28 |
30 namespace extensions { | 29 namespace extensions { |
31 class EventPageTracker; | 30 class EventPageTracker; |
32 } | 31 } |
33 | 32 |
34 namespace media_router { | 33 namespace media_router { |
35 | 34 |
36 // MediaRouter implementation that delegates calls to the component extension. | 35 // MediaRouter implementation that delegates calls to the component extension. |
37 // Also handles the suspension and wakeup of the component extension. | 36 // Also handles the suspension and wakeup of the component extension. |
38 class MediaRouterMojoImpl : public MediaRouter, | 37 class MediaRouterMojoImpl : public MediaRouter, |
39 public interfaces::MediaRouter, | 38 public interfaces::MediaRouter { |
40 public KeyedService { | |
41 public: | 39 public: |
42 ~MediaRouterMojoImpl() override; | 40 ~MediaRouterMojoImpl() override; |
43 | 41 |
44 // Sets up the MediaRouterMojoImpl instance owned by |context| to handle | 42 // Sets up the MediaRouterMojoImpl instance owned by |context| to handle |
45 // MediaRouterObserver requests from the component extension given by | 43 // MediaRouterObserver requests from the component extension given by |
46 // |extension_id|. Creates the MediaRouterMojoImpl instance if it does not | 44 // |extension_id|. Creates the MediaRouterMojoImpl instance if it does not |
47 // exist. | 45 // exist. |
48 // Called by the Mojo module registry. | 46 // Called by the Mojo module registry. |
49 // |extension_id|: The ID of the component extension, used for querying | 47 // |extension_id|: The ID of the component extension, used for querying |
50 // suspension state. | 48 // suspension state. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override; | 81 void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override; |
84 void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override; | 82 void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override; |
85 void RegisterIssuesObserver(IssuesObserver* observer) override; | 83 void RegisterIssuesObserver(IssuesObserver* observer) override; |
86 void UnregisterIssuesObserver(IssuesObserver* observer) override; | 84 void UnregisterIssuesObserver(IssuesObserver* observer) override; |
87 | 85 |
88 void set_instance_id_for_test(const std::string& instance_id) { | 86 void set_instance_id_for_test(const std::string& instance_id) { |
89 instance_id_ = instance_id; | 87 instance_id_ = instance_id; |
90 } | 88 } |
91 | 89 |
92 private: | 90 private: |
93 friend class MediaRouterMojoImplFactory; | 91 friend class MediaRouterFactory; |
94 friend class MediaRouterMojoTest; | 92 friend class MediaRouterMojoTest; |
95 | 93 |
96 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, | 94 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, |
97 DeferredBindingAndSuspension); | 95 DeferredBindingAndSuspension); |
98 | 96 |
99 // Standard constructor, used by | 97 // Standard constructor, used by |
100 // MediaRouterMojoImplFactory::GetApiForBrowserContext. | 98 // MediaRouterMojoImplFactory::GetApiForBrowserContext. |
101 explicit MediaRouterMojoImpl( | 99 explicit MediaRouterMojoImpl( |
102 extensions::EventPageTracker* event_page_tracker); | 100 extensions::EventPageTracker* event_page_tracker); |
103 | 101 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 std::string instance_id_; | 197 std::string instance_id_; |
200 | 198 |
201 base::ThreadChecker thread_checker_; | 199 base::ThreadChecker thread_checker_; |
202 | 200 |
203 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); | 201 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |
204 }; | 202 }; |
205 | 203 |
206 } // namespace media_router | 204 } // namespace media_router |
207 | 205 |
208 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ | 206 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
OLD | NEW |