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

Side by Side Diff: chrome/browser/media/router/media_source.h

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 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <ostream> 10 #include <ostream>
11 #include <string> 11 #include <string>
12 12
13 #include "base/hash.h" 13 #include "base/hash.h"
14 14
15 namespace media_router { 15 namespace media_router {
16 16
17 17
18 class MediaSource { 18 class MediaSource {
19 public: 19 public:
20 using Id = std::string; 20 using Id = std::string;
21 21
22 explicit MediaSource(const MediaSource::Id& id); 22 explicit MediaSource(const MediaSource::Id& id);
23 MediaSource();
24 ~MediaSource(); 23 ~MediaSource();
25 24
26 // Gets the ID of the media source. 25 // Gets the ID of the media source.
27 MediaSource::Id id() const; 26 MediaSource::Id id() const;
28 27
29 // Returns true if two MediaSource objects use the same media ID. 28 // Returns true if two MediaSource objects use the same media ID.
30 bool Equals(const MediaSource& other) const; 29 bool operator==(const MediaSource& other) const;
31
32 // Returns true if a MediaSource is empty or uninitialized.
33 bool Empty() const;
34 30
35 // Used for logging. 31 // Used for logging.
36 std::string ToString() const; 32 std::string ToString() const;
37 33
38 // Hash operator for hash containers. 34 // Hash operator for hash containers.
39 struct Hash { 35 struct Hash {
40 size_t operator()(const MediaSource& source) const { 36 size_t operator()(const MediaSource& source) const {
41 return base::Hash(source.id()); 37 return base::Hash(source.id());
42 } 38 }
43 }; 39 };
44 40
41 // For storing in sets and in maps as keys.
42 struct Compare {
43 bool operator()(const MediaSource& source1,
44 const MediaSource& source2) const {
45 return source1.id() < source2.id();
46 }
47 };
48
45 private: 49 private:
46 MediaSource::Id id_; 50 MediaSource::Id id_;
47 }; 51 };
48 52
49 } // namespace media_router 53 } // namespace media_router
50 54
51 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_ 55 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698