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

Side by Side Diff: chrome/browser/media/router/mojo/media_route_controller.h

Issue 2862513002: Revert of [Media Router] Custom Controls 3 - add plumbing through MRUI and MRWebUIMessageHandler (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/media/router/mojo/media_route_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_MOJO_MEDIA_ROUTE_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTE_CONTROLLER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTE_CONTROLLER_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTE_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Constructs a MediaRouteController that forwards media commands to 70 // Constructs a MediaRouteController that forwards media commands to
71 // |mojo_media_controller|. |media_router| will be notified when the 71 // |mojo_media_controller|. |media_router| will be notified when the
72 // MediaRouteController is destroyed via DetachRouteController(). 72 // MediaRouteController is destroyed via DetachRouteController().
73 MediaRouteController(const MediaRoute::Id& route_id, 73 MediaRouteController(const MediaRoute::Id& route_id,
74 mojom::MediaControllerPtr mojo_media_controller, 74 mojom::MediaControllerPtr mojo_media_controller,
75 MediaRouter* media_router); 75 MediaRouter* media_router);
76 76
77 // Media controller methods for forwarding commands to a 77 // Media controller methods for forwarding commands to a
78 // mojom::MediaControllerPtr held in |mojo_media_controller_|. 78 // mojom::MediaControllerPtr held in |mojo_media_controller_|.
79 virtual void Play() const; 79 void Play();
80 virtual void Pause() const; 80 void Pause();
81 virtual void Seek(base::TimeDelta time) const; 81 void Seek(base::TimeDelta time);
82 virtual void SetMute(bool mute) const; 82 void SetMute(bool mute);
83 virtual void SetVolume(float volume) const; 83 void SetVolume(float volume);
84 84
85 // mojom::MediaStatusObserver: 85 // mojom::MediaStatusObserver:
86 // Notifies |observers_| of a status update. 86 // Notifies |observers_| of a status update.
87 void OnMediaStatusUpdated(const MediaStatus& status) override; 87 void OnMediaStatusUpdated(const MediaStatus& status) override;
88 88
89 // Notifies |observers_| to dispose their references to the controller. The 89 // Notifies |observers_| to dispose their references to the controller. The
90 // controller gets destroyed when all the references are disposed. 90 // controller gets destroyed when all the references are disposed.
91 void Invalidate(); 91 void Invalidate();
92 92
93 // Returns a mojo pointer bound to |this| by |binding_|. This must only be 93 // Returns a mojo pointer bound to |this| by |binding_|. This must only be
94 // called at most once in the lifetime of the controller. 94 // called at most once in the lifetime of the controller.
95 mojom::MediaStatusObserverPtr BindObserverPtr(); 95 mojom::MediaStatusObserverPtr BindObserverPtr();
96 96
97 MediaRoute::Id route_id() const { return route_id_; } 97 MediaRoute::Id route_id() const { return route_id_; }
98 98
99 protected:
100 ~MediaRouteController() override;
101
102 private: 99 private:
103 friend class base::RefCounted<MediaRouteController>; 100 friend class base::RefCounted<MediaRouteController>;
104 101
102 ~MediaRouteController() override;
103
105 void AddObserver(Observer* observer); 104 void AddObserver(Observer* observer);
106 void RemoveObserver(Observer* observer); 105 void RemoveObserver(Observer* observer);
107 106
108 // Called when the connection between |this| and the MediaControllerPtr or 107 // Called when the connection between |this| and the MediaControllerPtr or
109 // the MediaStatusObserver binding is no longer valid. Notifies 108 // the MediaStatusObserver binding is no longer valid. Notifies
110 // |media_router_| and |observers_| to dispose their references to |this|. 109 // |media_router_| and |observers_| to dispose their references to |this|.
111 void OnMojoConnectionError(); 110 void OnMojoConnectionError();
112 111
113 // The ID of the Media Route that |this| controls. 112 // The ID of the Media Route that |this| controls.
114 const MediaRoute::Id route_id_; 113 const MediaRoute::Id route_id_;
(...skipping 13 matching lines...) Expand all
128 127
129 // This becomes false when the controller is invalidated. 128 // This becomes false when the controller is invalidated.
130 bool is_valid_ = true; 129 bool is_valid_ = true;
131 130
132 DISALLOW_COPY_AND_ASSIGN(MediaRouteController); 131 DISALLOW_COPY_AND_ASSIGN(MediaRouteController);
133 }; 132 };
134 133
135 } // namespace media_router 134 } // namespace media_router
136 135
137 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTE_CONTROLLER_H_ 136 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/router/mojo/media_route_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698