Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: chrome/browser/media/router/media_router_impl.h

Issue 1020743003: [Media Router] Design MediaRouter interface with stub implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved On*() functions into a separate Delegate interface Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
7
8 #include <map>
9 #include <queue>
10 #include <string>
11 #include <vector>
12
13 #include "base/callback.h"
14 #include "base/containers/hash_tables.h"
15 #include "base/gtest_prod_util.h"
16 #include "base/macros.h"
17 #include "base/memory/scoped_vector.h"
18 #include "base/threading/thread_checker.h"
19 #include "chrome/browser/media/router/media_router.h"
20 #include "chrome/browser/media/router/media_sinks_observer.h"
21 #include "components/keyed_service/core/keyed_service.h"
22
23 namespace base {
24 template <typename T>
25 struct DefaultLazyInstanceTraits;
26 } // namespace base
27
28 namespace media_router {
29
30 class MediaRoute;
31 class MediaRouterApiImpl;
32 class MediaRoutesObserver;
33 struct RoutesQueryResult;
34
35 // Implementation of MediaRouter that delegates calls to
36 // MediaRouteProviderManagerHost, which in turn handles communication
37 // with the Media Route Provider Manager (MRPM).
38 // Instances of this class are created by MediaRouterImplFactory.
39 // MediaRouterImpl is a profile-keyed service.
40 // MediaRouterImpl runs on the browser UI thread. All observers/callbacks
41 // registered to this class must also run in the UI thread.
42 class MediaRouterImpl : public MediaRouter, public KeyedService {
43 public:
44 ~MediaRouterImpl() override;
45
46 // |provider_manager_host_| must be null at the time this is called.
47 // |provider_manager_host| must not be null.
48 // Does not take ownership of |provider_manager_host_|.
49 // This function can only be called once.
50 void Initialize(MediaRouter* provider_manager_host);
51
52 // MediaRouter implementation.
53 void RequestRoute(const MediaSource& source,
54 const MediaSinkId& sink_id,
55 const MediaRouteResponseCallback& callback) override;
56 void CloseRoute(const MediaRouteId& route_id) override;
57 void PostMessage(const MediaRouteId& route_id,
58 const std::string& message) override;
59
60 private:
61 friend class MediaRouterImplFactory;
62
63 // Use MediaRouterImplFactory::GetForBrowserContext().
64 MediaRouterImpl();
65
66 // MediaRouter implementation.
67 bool RegisterMediaSinksObserver(MediaSinksObserver* observer) override;
68 void UnregisterMediaSinksObserver(MediaSinksObserver* observer) override;
69 bool RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override;
70 void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override;
71
72 // MRPM host to forward calls to MRPM to.
73 // This class does not own provider_manager_host_.
74 MediaRouter* provider_manager_host_;
75
76 DISALLOW_COPY_AND_ASSIGN(MediaRouterImpl);
77 };
78
79 } // namespace media_router
80
81 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698