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

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

Issue 1911183002: [Media Router] Implement an internal Media Routes observer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad merge & android build Created 4 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_base.h
diff --git a/chrome/browser/media/router/media_router_base.h b/chrome/browser/media/router/media_router_base.h
index e95fa177cdab3b2951b6f97b4bfdfa6375e82dd7..933f840de134a797bd056899ebc683180174eee3 100644
--- a/chrome/browser/media/router/media_router_base.h
+++ b/chrome/browser/media/router/media_router_base.h
@@ -6,21 +6,21 @@
#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_
#include <set>
+#include <vector>
#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_route.h"
#include "chrome/browser/media/router/media_router.h"
-
-class Profile;
+#include "chrome/browser/media/router/media_routes_observer.h"
namespace media_router {
class MediaRouterBase : public MediaRouter {
public:
- MediaRouterBase();
~MediaRouterBase() override;
std::unique_ptr<PresentationConnectionStateSubscription>
@@ -39,6 +39,8 @@ class MediaRouterBase : public MediaRouter {
FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest,
PresentationConnectionStateChangedCallbackRemoved);
+ MediaRouterBase();
+
// Generates a unique presentation id. Shared between Android and desktop.
static std::string CreatePresentationId();
@@ -50,13 +52,12 @@ class MediaRouterBase : public MediaRouter {
content::PresentationConnectionCloseReason reason,
const std::string& message);
- // Called when off the record route |route_id| has been created.
- void OnOffTheRecordRouteCreated(const MediaRoute::Id& route_id);
- // Called when route |route_id| has been terminated.
- void OnRouteTerminated(const MediaRoute::Id& route_id);
+ // Returns true when there is at least one MediaRoute with is_local = true.
+ bool HasLocalRoute() const;
using PresentationConnectionStateChangedCallbacks = base::CallbackList<void(
const content::PresentationConnectionStateChangeInfo&)>;
+
base::ScopedPtrHashMap<
MediaRoute::Id,
std::unique_ptr<PresentationConnectionStateChangedCallbacks>>
@@ -65,13 +66,24 @@ class MediaRouterBase : public MediaRouter {
base::ThreadChecker thread_checker_;
private:
+ friend class MediaRouterFactory;
+ friend class MediaRouterMojoTest;
+
+ class InternalMediaRoutesObserver;
+
+ // Must be called before invoking any other method.
+ void Initialize();
+
// Called when a PresentationConnectionStateChangedCallback associated with
// |route_id| is removed from |presentation_connection_state_callbacks_|.
void OnPresentationConnectionStateCallbackRemoved(
const MediaRoute::Id& route_id);
- // Ids of current off the record media routes.
- std::set<MediaRoute::Id> off_the_record_route_ids_;
+ // KeyedService
+ void Shutdown() override;
+
+ std::unique_ptr<InternalMediaRoutesObserver> internal_routes_observer_;
+ bool initialized_;
DISALLOW_COPY_AND_ASSIGN(MediaRouterBase);
};
« no previous file with comments | « chrome/browser/media/android/router/media_router_android.cc ('k') | chrome/browser/media/router/media_router_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698