Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / media / router / media_route.cc
blobab5a9e9826126dca5ca11e0f80ea6134a7f0605b
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/media/router/media_route.h"
7 #include "base/logging.h"
8 #include "chrome/browser/media/router/media_source.h"
10 namespace media_router {
12 MediaRoute::MediaRoute(const MediaRoute::Id& media_route_id,
13 const MediaSource& media_source,
14 const MediaSink::Id& media_sink_id,
15 const std::string& description,
16 bool is_local,
17 const std::string& custom_controller_path,
18 bool for_display)
19 : media_route_id_(media_route_id),
20 media_source_(media_source),
21 media_sink_id_(media_sink_id),
22 description_(description),
23 is_local_(is_local),
24 custom_controller_path_(custom_controller_path),
25 for_display_(for_display) {}
27 MediaRoute::~MediaRoute() {
30 bool MediaRoute::Equals(const MediaRoute& other) const {
31 return media_route_id_ == other.media_route_id_;
34 MediaRouteIdToPresentationSessionMapping::
35 MediaRouteIdToPresentationSessionMapping() {
38 MediaRouteIdToPresentationSessionMapping::
39 ~MediaRouteIdToPresentationSessionMapping() {
42 void MediaRouteIdToPresentationSessionMapping::Add(
43 const MediaRoute::Id& route_id,
44 const content::PresentationSessionInfo& session_info) {
45 route_id_to_presentation_.insert(std::make_pair(route_id, session_info));
48 void MediaRouteIdToPresentationSessionMapping::Remove(
49 const MediaRoute::Id& route_id) {
50 route_id_to_presentation_.erase(route_id);
53 void MediaRouteIdToPresentationSessionMapping::Clear() {
54 route_id_to_presentation_.clear();
57 const content::PresentationSessionInfo*
58 MediaRouteIdToPresentationSessionMapping::Get(
59 const MediaRoute::Id& route_id) const {
60 auto it = route_id_to_presentation_.find(route_id);
61 return it == route_id_to_presentation_.end() ? nullptr : &it->second;
64 } // namespace media_router