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

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

Issue 2771413003: Move c/b/media/router/mojo/*.mojom to chrome/common/media_router/mojo/*.mojom (Closed)
Patch Set: Rebase Created 3 years, 8 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 2015 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 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
7
8 #include <stddef.h>
9
10 #include <ostream>
11 #include <string>
12
13 #include "base/hash.h"
14 #include "url/gurl.h"
15
16 // TODO(mfoltz): Right now this is a wrapper for std::string. Factor methods
17 // from media_source_helper here so this object becomes useful; and don't just
18 // pass it around by Id.
19 namespace media_router {
20
21 class MediaSource {
22 public:
23 using Id = std::string;
24
25 explicit MediaSource(const MediaSource::Id& id);
26 explicit MediaSource(const GURL& presentation_url);
27 MediaSource();
28 ~MediaSource();
29
30 // Gets the ID of the media source.
31 MediaSource::Id id() const;
32
33 // If MediaSource is created from a URL, return the URL; otherwise return an
34 // empty GURL.
35 GURL url() const;
36
37 // Returns true if two MediaSource objects use the same media ID.
38 bool operator==(const MediaSource& other) const;
39
40 // Used for logging.
41 std::string ToString() const;
42
43 // Hash operator for hash containers.
44 struct Hash {
45 size_t operator()(const MediaSource& source) const {
46 return base::Hash(source.id());
47 }
48 };
49
50 private:
51 MediaSource::Id id_;
52 GURL url_;
53 };
54
55 } // namespace media_router
56
57 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698