summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media/router/media_router_base.h
diff options
context:
space:
mode:
authormfoltz <mfoltz@chromium.org>2016-03-18 10:13:44 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-18 17:15:32 +0000
commitb4ba372948a5bc67e06377b5c2b57e539da0bf37 (patch)
tree50bb8d9508f84d68ec672647de1c17ba9cb4627d /chrome/browser/media/router/media_router_base.h
parent2d38b38473ef8051f6e1f0ac46cb769f475ab18b (diff)
downloadchromium_src-b4ba372948a5bc67e06377b5c2b57e539da0bf37.zip
chromium_src-b4ba372948a5bc67e06377b5c2b57e539da0bf37.tar.gz
chromium_src-b4ba372948a5bc67e06377b5c2b57e539da0bf37.tar.bz2
Third patch to implement incognito support for Media Router.
This patch implements policies around incognito: - OTR media routes created from OTR profiles are tracked. When the OTR profile is destroyed, we attempt to terminate the OTR media routes. - Enforces that the OTR status of routes returned from to CreateRoute(), JoinRoute(), or ConnectRouteByRouteId() matches the OTR status of the profile that called them. Patches will be submitted in this order: 1682853007: Adds support for off the record media routes. This patch: Implements incognito policies for Media Router. 1702533003: Enables UI for incognito profiles. BUG=524795 Review URL: https://codereview.chromium.org/1745493003 Cr-Commit-Position: refs/heads/master@{#381996}
Diffstat (limited to 'chrome/browser/media/router/media_router_base.h')
-rw-r--r--chrome/browser/media/router/media_router_base.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/chrome/browser/media/router/media_router_base.h b/chrome/browser/media/router/media_router_base.h
index d342d9b..41a7c43 100644
--- a/chrome/browser/media/router/media_router_base.h
+++ b/chrome/browser/media/router/media_router_base.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_
#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_
+#include <set>
+
#include "base/callback_list.h"
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/gtest_prod_util.h"
@@ -12,6 +14,8 @@
#include "base/threading/thread_checker.h"
#include "chrome/browser/media/router/media_router.h"
+class Profile;
+
namespace media_router {
class MediaRouterBase : public MediaRouter {
@@ -25,6 +29,10 @@ class MediaRouterBase : public MediaRouter {
const content::PresentationConnectionStateChangedCallback& callback)
override;
+ // Called when the off the record (incognito) profile for this instance is
+ // being shut down. This will terminate all off the record media routes.
+ void OnOffTheRecordProfileShutdown() override;
+
protected:
FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest,
PresentationConnectionStateChangedCallback);
@@ -39,6 +47,11 @@ 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);
+
using PresentationConnectionStateChangedCallbacks = base::CallbackList<void(
const content::PresentationConnectionStateChangeInfo&)>;
base::ScopedPtrHashMap<
@@ -54,6 +67,9 @@ class MediaRouterBase : public MediaRouter {
void OnPresentationConnectionStateCallbackRemoved(
const MediaRoute::Id& route_id);
+ // Ids of current off the record media routes.
+ std::set<MediaRoute::Id> off_the_record_route_ids_;
+
DISALLOW_COPY_AND_ASSIGN(MediaRouterBase);
};