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

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: fix content_unittests compile 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
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..ed859434364dd7c898a4b40f34e16630e07fe2a3
--- /dev/null
+++ b/chrome/browser/media/router/media_router_base.h
@@ -0,0 +1,52 @@
+// 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/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:
+ 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_

Powered by Google App Engine
This is Rietveld 408576698