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

Side by Side Diff: chrome/browser/ui/webui/media_router/cast_modes_with_media_sources.cc

Issue 2264153002: [Presentation API] Add support for multiple URLs in PresentationRequest on Media Router UI side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Mark's comments, add unit test for CMWMS Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 #include "chrome/browser/ui/webui/media_router/cast_modes_with_media_sources.h"
6
7 namespace media_router {
8
9 CastModesWithMediaSources::CastModesWithMediaSources() {}
10 CastModesWithMediaSources::CastModesWithMediaSources(
11 const CastModesWithMediaSources& other) = default;
12 CastModesWithMediaSources::~CastModesWithMediaSources() {}
13
14 void CastModesWithMediaSources::AddSource(
15 const MediaSource& source, MediaCastMode cast_mode) {
16 cast_modes_[cast_mode].insert(source);
17 }
18
19 void CastModesWithMediaSources::RemoveSource(
20 const MediaSource& source, MediaCastMode cast_mode) {
21 cast_modes_[cast_mode].erase(source);
22 if (cast_modes_[cast_mode].empty())
23 cast_modes_.erase(cast_mode);
24 }
25
26 bool CastModesWithMediaSources::HasSource(
27 const MediaSource& source, MediaCastMode cast_mode) const {
28 auto it = cast_modes_.find(cast_mode);
29 if (it == cast_modes_.end())
30 return false;
31 const auto& sources_for_cast_mode = it->second;
mark a. foltz 2016/09/02 23:00:37 base::ContainsKey?
takumif 2016/09/06 21:53:20 Done.
32 return sources_for_cast_mode.find(source) != sources_for_cast_mode.end();
33 }
34
35 CastModeSet CastModesWithMediaSources::GetCastModes() const {
36 CastModeSet cast_mode_set;
37 for (const auto& cast_mode_pair : cast_modes_)
38 cast_mode_set.insert(cast_mode_pair.first);
39 return cast_mode_set;
40 }
41
42 bool CastModesWithMediaSources::IsEmpty() const {
43 return cast_modes_.empty();
44 }
45
46 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698