| OLD | NEW |
| 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 |
| 45 private: | 41 private: |
| 46 MediaSource::Id id_; | 42 MediaSource::Id id_; |
| 47 }; | 43 }; |
| 48 | 44 |
| 49 } // namespace media_router | 45 } // namespace media_router |
| 50 | 46 |
| 51 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_ | 47 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_ |
| OLD | NEW |