Chromium Code Reviews| 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/issue_manager.h" | |
| 22 #include "chrome/browser/media/router/media_router.h" | 23 #include "chrome/browser/media/router/media_router.h" |
| 23 #include "chrome/browser/media/router/media_router.mojom.h" | 24 #include "chrome/browser/media/router/media_router.mojom.h" |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 class BrowserContext; | 27 class BrowserContext; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace extensions { | 30 namespace extensions { |
| 30 class EventPageTracker; | 31 class EventPageTracker; |
| 31 } | 32 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 const std::string& message, | 137 const std::string& message, |
| 137 const SendRouteMessageCallback& callback); | 138 const SendRouteMessageCallback& callback); |
| 138 void DoListenForRouteMessages( | 139 void DoListenForRouteMessages( |
| 139 const std::vector<MediaRoute::Id>& route_ids, | 140 const std::vector<MediaRoute::Id>& route_ids, |
| 140 const PresentationSessionMessageCallback& message_cb); | 141 const PresentationSessionMessageCallback& message_cb); |
| 141 void DoClearIssue(const Issue::Id& issue_id); | 142 void DoClearIssue(const Issue::Id& issue_id); |
| 142 void DoStartObservingMediaSinks(const MediaSource::Id& source_id); | 143 void DoStartObservingMediaSinks(const MediaSource::Id& source_id); |
| 143 void DoStopObservingMediaSinks(const MediaSource::Id& source_id); | 144 void DoStopObservingMediaSinks(const MediaSource::Id& source_id); |
| 144 void DoStartObservingMediaRoutes(); | 145 void DoStartObservingMediaRoutes(); |
| 145 void DoStopObservingMediaRoutes(); | 146 void DoStopObservingMediaRoutes(); |
| 146 void DoStartObservingIssues(); | |
| 147 void DoStopObservingIssues(); | |
| 148 | 147 |
| 149 // Invoked when the next batch of messages arrives. | 148 // Invoked when the next batch of messages arrives. |
| 150 // |messages|: A list of messages received. | 149 // |messages|: A list of messages received. |
| 151 // |message_cb|: The callback to invoke to pass on the messages received. | 150 // |message_cb|: The callback to invoke to pass on the messages received. |
| 152 void OnRouteMessageReceived( | 151 void OnRouteMessageReceived( |
| 153 const PresentationSessionMessageCallback& message_cb, | 152 const PresentationSessionMessageCallback& message_cb, |
| 154 mojo::Array<interfaces::RouteMessagePtr> messages); | 153 mojo::Array<interfaces::RouteMessagePtr> messages); |
| 155 | 154 |
| 156 // Error handler callback for |binding_| and |media_route_provider_|. | 155 // Error handler callback for |binding_| and |media_route_provider_|. |
| 157 void OnConnectionError(); | 156 void OnConnectionError(); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 169 // Pending requests queued to be executed once component extension | 168 // Pending requests queued to be executed once component extension |
| 170 // becomes ready. | 169 // becomes ready. |
| 171 std::vector<base::Closure> pending_requests_; | 170 std::vector<base::Closure> pending_requests_; |
| 172 | 171 |
| 173 base::ScopedPtrHashMap<MediaSource::Id, | 172 base::ScopedPtrHashMap<MediaSource::Id, |
| 174 scoped_ptr<base::ObserverList<MediaSinksObserver>>> | 173 scoped_ptr<base::ObserverList<MediaSinksObserver>>> |
| 175 sinks_observers_; | 174 sinks_observers_; |
| 176 | 175 |
| 177 base::ObserverList<MediaRoutesObserver> routes_observers_; | 176 base::ObserverList<MediaRoutesObserver> routes_observers_; |
| 178 | 177 |
| 178 IssueManager issue_manager_; | |
|
Kevin M
2015/07/29 17:41:49
Make this a pointer so it can accept a mock
haibinlu
2015/07/29 18:46:07
Discussed with Derek, we feel that the cost of moc
| |
| 179 | |
| 179 // Binds |this| to a Mojo connection stub for interfaces::MediaRouter. | 180 // Binds |this| to a Mojo connection stub for interfaces::MediaRouter. |
| 180 scoped_ptr<mojo::Binding<interfaces::MediaRouter>> binding_; | 181 scoped_ptr<mojo::Binding<interfaces::MediaRouter>> binding_; |
| 181 | 182 |
| 182 // Mojo proxy object for the Media Route Provider Manager. | 183 // Mojo proxy object for the Media Route Provider Manager. |
| 183 // Set to null initially, and later set to the Provider Manager proxy object | 184 // Set to null initially, and later set to the Provider Manager proxy object |
| 184 // passed in via |RegisterMediaRouteProvider()|. | 185 // passed in via |RegisterMediaRouteProvider()|. |
| 185 // This is set to null again when the component extension is suspended | 186 // This is set to null again when the component extension is suspended |
| 186 // if or a Mojo channel error occured. | 187 // if or a Mojo channel error occured. |
| 187 interfaces::MediaRouteProviderPtr media_route_provider_; | 188 interfaces::MediaRouteProviderPtr media_route_provider_; |
| 188 | 189 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 201 std::string instance_id_; | 202 std::string instance_id_; |
| 202 | 203 |
| 203 base::ThreadChecker thread_checker_; | 204 base::ThreadChecker thread_checker_; |
| 204 | 205 |
| 205 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); | 206 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |
| 206 }; | 207 }; |
| 207 | 208 |
| 208 } // namespace media_router | 209 } // namespace media_router |
| 209 | 210 |
| 210 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ | 211 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
| OLD | NEW |