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

Unified 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: change MediaRouter private APIs to protected 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/media_router_impl.h
diff --git a/chrome/browser/media/router/media_router_impl.h b/chrome/browser/media/router/media_router_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..72bb4625583bc3e2bbe47f10a96b630716a9f245
--- /dev/null
+++ b/chrome/browser/media/router/media_router_impl.h
@@ -0,0 +1,80 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
+
+#include <map>
+#include <queue>
+#include <string>
+#include <vector>
+
+#include "base/callback.h"
+#include "base/containers/hash_tables.h"
+#include "base/gtest_prod_util.h"
+#include "base/macros.h"
+#include "base/memory/scoped_vector.h"
+#include "base/threading/thread_checker.h"
+#include "chrome/browser/media/router/media_router.h"
+#include "chrome/browser/media/router/media_sinks_observer.h"
+#include "components/keyed_service/core/keyed_service.h"
+
+namespace base {
+template <typename T>
+struct DefaultLazyInstanceTraits;
+} // namespace base
+
+namespace media_router {
+
+class MediaRoute;
+class MediaRouterApiImpl;
+class MediaRoutesObserver;
+struct RoutesQueryResult;
+
+// Delegates calls to another implementation of MediaRouter, which in turn
+// handles communication with the Media Route Provider Manager (MRPM).
+// Instances of this class are created by MediaRouterImplFactory.
+// MediaRouterImpl is a profile-keyed service.
+// MediaRouterImpl runs on the browser UI thread. All observers/callbacks
+// registered to this class must also run in the UI thread.
+class MediaRouterImpl : public MediaRouter, public KeyedService {
+ public:
+ ~MediaRouterImpl() override;
+
+ // |provider_manager_host_| must be null at the time this is called.
+ // |provider_manager_host| must not be null.
+ // Does not take ownership of |provider_manager_host_|.
+ // This function can only be called once.
+ void Initialize(MediaRouter* provider_manager_host);
+
+ // MediaRouter implementation.
+ void RequestRoute(const MediaSource& source,
xhwang 2015/04/09 21:33:06 nit: I still feel this should be an MediaSourceId
imcheng 2015/04/09 22:02:18 Done.
+ const MediaSinkId& sink_id,
+ const MediaRouteResponseCallback& callback) override;
+ void CloseRoute(const MediaRouteId& route_id) override;
+ void PostMessage(const MediaRouteId& route_id,
+ const std::string& message) override;
+
+ private:
+ friend class MediaRouterImplFactory;
+
+ // Use MediaRouterImplFactory::GetForBrowserContext().
+ MediaRouterImpl();
+
+ // MediaRouter implementation.
+ bool RegisterMediaSinksObserver(MediaSinksObserver* observer) override;
+ void UnregisterMediaSinksObserver(MediaSinksObserver* observer) override;
+ bool RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override;
+ void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override;
+
+ // MRPM host to forward calls to MRPM to.
+ // This class does not own provider_manager_host_.
+ MediaRouter* provider_manager_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaRouterImpl);
+};
+
+} // namespace media_router
+
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698