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

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

Issue 2547703002: [Media Router] Handle multiple Presentation URLs when creating routes (Closed)
Patch Set: resolve code review comments from Mark Created 4 years 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 #include "url/gurl.h"
15 class GURL;
16 15
17 // TODO(mfoltz): Right now this is a wrapper for std::string. Factor methods 16 // TODO(mfoltz): Right now this is a wrapper for std::string. Factor methods
18 // from media_source_helper here so this object becomes useful; and don't just 17 // from media_source_helper here so this object becomes useful; and don't just
19 // pass it around by Id. 18 // pass it around by Id.
20 namespace media_router { 19 namespace media_router {
21 20
22 class MediaSource { 21 class MediaSource {
23 public: 22 public:
24 using Id = std::string; 23 using Id = std::string;
25 24
26 explicit MediaSource(const MediaSource::Id& id); 25 explicit MediaSource(const MediaSource::Id& id);
27 explicit MediaSource(const GURL& presentation_url); 26 explicit MediaSource(const GURL& presentation_url);
28 ~MediaSource(); 27 ~MediaSource();
29 28
30 // Gets the ID of the media source. 29 // Gets the ID of the media source.
31 MediaSource::Id id() const; 30 MediaSource::Id id() const;
32 31
32 // If MediaSource is created from a URL, return the URL; otherwise return an
33 // empty GURL.
34 GURL url() const;
35
33 // Returns true if two MediaSource objects use the same media ID. 36 // Returns true if two MediaSource objects use the same media ID.
34 bool operator==(const MediaSource& other) const; 37 bool operator==(const MediaSource& other) const;
35 38
36 // Used for logging. 39 // Used for logging.
37 std::string ToString() const; 40 std::string ToString() const;
38 41
39 // Hash operator for hash containers. 42 // Hash operator for hash containers.
40 struct Hash { 43 struct Hash {
41 size_t operator()(const MediaSource& source) const { 44 size_t operator()(const MediaSource& source) const {
42 return base::Hash(source.id()); 45 return base::Hash(source.id());
43 } 46 }
44 }; 47 };
45 48
46 private: 49 private:
47 MediaSource::Id id_; 50 MediaSource::Id id_;
51 GURL url_;
mark a. foltz 2016/12/05 22:21:13 Thanks :)
48 }; 52 };
49 53
50 } // namespace media_router 54 } // namespace media_router
51 55
52 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_ 56 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698