| 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 <ostream> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 11 #include "base/hash.h" |
| 12 |
| 10 namespace media_router { | 13 namespace media_router { |
| 11 | 14 |
| 15 using MediaSourceId = std::string; |
| 16 |
| 12 class MediaSource { | 17 class MediaSource { |
| 13 public: | 18 public: |
| 14 explicit MediaSource(const std::string& id); | 19 explicit MediaSource(const MediaSourceId& id); |
| 20 MediaSource(); |
| 15 ~MediaSource(); | 21 ~MediaSource(); |
| 16 | 22 |
| 17 // Gets the ID of the media source. | 23 // Gets the ID of the media source. |
| 18 std::string id() const; | 24 MediaSourceId id() const; |
| 25 |
| 26 // Returns true if two MediaSource objects use the same media ID. |
| 27 bool Equals(const MediaSource& other) const; |
| 28 |
| 29 // Returns true if a MediaSource is empty or uninitialized. |
| 30 bool Empty() const; |
| 31 |
| 32 // Used for logging. |
| 33 std::string ToString() const; |
| 34 |
| 35 // Hash operator for hash containers. |
| 36 struct Hash { |
| 37 size_t operator()(const MediaSource& source) const { |
| 38 return base::Hash(source.id()); |
| 39 } |
| 40 }; |
| 19 | 41 |
| 20 private: | 42 private: |
| 21 std::string id_; | 43 MediaSourceId id_; |
| 22 }; | 44 }; |
| 23 | 45 |
| 24 } // namespace media_router | 46 } // namespace media_router |
| 25 | 47 |
| 26 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_ | 48 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_ |
| OLD | NEW |