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

Unified Diff: chrome/browser/media/router/media_router_base.h

Issue 1430413003: [Media Router] Connection state change listening redesign part 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « chrome/browser/media/router/media_router.gypi ('k') | chrome/browser/media/router/media_router_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/router/media_router_base.h
diff --git a/chrome/browser/media/router/media_router_base.h b/chrome/browser/media/router/media_router_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..a2020166f83adfd54d6a7ecb7daebb62902bd23e
--- /dev/null
+++ b/chrome/browser/media/router/media_router_base.h
@@ -0,0 +1,56 @@
+// 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_BASE_H_
+#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_
+
+#include "base/callback_list.h"
+#include "base/containers/scoped_ptr_hash_map.h"
+#include "base/gtest_prod_util.h"
+#include "base/macros.h"
+#include "base/threading/thread_checker.h"
+#include "chrome/browser/media/router/media_router.h"
+
+namespace media_router {
+
+class MediaRouterBase : public MediaRouter {
+ public:
+ MediaRouterBase();
+ ~MediaRouterBase() override;
+
+ scoped_ptr<PresentationConnectionStateSubscription>
+ AddPresentationConnectionStateChangedCallback(
+ const MediaRoute::Id& route_id,
+ const content::PresentationConnectionStateChangedCallback& callback)
+ override;
+
+ protected:
+ FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest,
+ PresentationConnectionStateChangedCallback);
+
+ void NotifyPresentationConnectionStateChange(
+ const MediaRoute::Id& route_id,
+ content::PresentationConnectionState state);
+
+ using PresentationConnectionStateChangedCallbacks =
+ base::CallbackList<void(content::PresentationConnectionState)>;
+ base::ScopedPtrHashMap<
+ MediaRoute::Id,
+ scoped_ptr<PresentationConnectionStateChangedCallbacks>>
+ presentation_connection_state_callbacks_;
+
+ base::ThreadChecker thread_checker_;
+
+ private:
+ // Called when a PresentationConnectionStateChangedCallback associated with
+ // |route_id| is removed from |presentation_connection_state_callbacks_|.
+ void OnPresentationConnectionStateCallbackRemoved(
+ const MediaRoute::Id& route_id);
+
+ DISALLOW_COPY_AND_ASSIGN(MediaRouterBase);
+};
+
+} // namespace media_router
+
+#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_
« no previous file with comments | « chrome/browser/media/router/media_router.gypi ('k') | chrome/browser/media/router/media_router_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698