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

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

Issue 1383653002: MediaRouterAction: Only observe Media Routes when there is a local route. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per imcheng@'s comments. Created 5 years, 2 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
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_ROUTER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "chrome/browser/media/router/issue.h" 13 #include "chrome/browser/media/router/issue.h"
14 #include "chrome/browser/media/router/media_route.h" 14 #include "chrome/browser/media/router/media_route.h"
15 #include "chrome/browser/media/router/media_sink.h" 15 #include "chrome/browser/media/router/media_sink.h"
16 #include "chrome/browser/media/router/media_source.h" 16 #include "chrome/browser/media/router/media_source.h"
17 #include "components/keyed_service/core/keyed_service.h" 17 #include "components/keyed_service/core/keyed_service.h"
18 #include "content/public/browser/presentation_session_message.h" 18 #include "content/public/browser/presentation_session_message.h"
19 19
20 namespace media_router { 20 namespace media_router {
21 21
22 class IssuesObserver; 22 class IssuesObserver;
23 class LocalMediaRoutesObserver;
23 class MediaRoutesObserver; 24 class MediaRoutesObserver;
24 class MediaSinksObserver; 25 class MediaSinksObserver;
25 class PresentationSessionMessagesObserver; 26 class PresentationSessionMessagesObserver;
26 27
27 // Type of callback used in |CreateRoute()| and |JoinRoute()|. Callback is 28 // Type of callback used in |CreateRoute()| and |JoinRoute()|. Callback is
28 // invoked when the route request either succeeded or failed. 29 // invoked when the route request either succeeded or failed.
29 // On success: 30 // On success:
30 // |route|: The route created or joined. 31 // |route|: The route created or joined.
31 // |presentation_id|: 32 // |presentation_id|:
32 // The presentation ID of the route created or joined. In the case of 33 // The presentation ID of the route created or joined. In the case of
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 virtual void AddIssue(const Issue& issue) = 0; 109 virtual void AddIssue(const Issue& issue) = 0;
109 110
110 // Clears the issue with the id |issue_id|. 111 // Clears the issue with the id |issue_id|.
111 virtual void ClearIssue(const Issue::Id& issue_id) = 0; 112 virtual void ClearIssue(const Issue::Id& issue_id) = 0;
112 113
113 // Indicates that a presentation session has detached from the underlying 114 // Indicates that a presentation session has detached from the underlying
114 // MediaRoute |route_id| (due to navigation, garbage collection, etc.) 115 // MediaRoute |route_id| (due to navigation, garbage collection, etc.)
115 virtual void OnPresentationSessionDetached( 116 virtual void OnPresentationSessionDetached(
116 const MediaRoute::Id& route_id) = 0; 117 const MediaRoute::Id& route_id) = 0;
117 118
119 virtual bool GetHasLocalRoute() = 0;
imcheng 2015/10/02 17:21:11 Please add comments.
apacible 2015/10/02 18:48:20 Done.
120
118 private: 121 private:
119 friend class IssuesObserver; 122 friend class IssuesObserver;
123 friend class LocalMediaRoutesObserver;
120 friend class MediaSinksObserver; 124 friend class MediaSinksObserver;
121 friend class MediaRoutesObserver; 125 friend class MediaRoutesObserver;
122 friend class PresentationSessionMessagesObserver; 126 friend class PresentationSessionMessagesObserver;
123 127
124 // The following functions are called by friend Observer classes above. 128 // The following functions are called by friend Observer classes above.
125 129
126 // Registers |observer| with this MediaRouter. |observer| specifies a media 130 // Registers |observer| with this MediaRouter. |observer| specifies a media
127 // source and will receive updates with media sinks that are compatible with 131 // source and will receive updates with media sinks that are compatible with
128 // that source. The initial update may happen synchronously. 132 // that source. The initial update may happen synchronously.
129 // NOTE: This class does not assume ownership of |observer|. Callers must 133 // NOTE: This class does not assume ownership of |observer|. Callers must
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // |observer|. |observer| should be unregistered before it is destroyed. 169 // |observer|. |observer| should be unregistered before it is destroyed.
166 // Registering the same observer more than once will result in undefined 170 // Registering the same observer more than once will result in undefined
167 // behavior. 171 // behavior.
168 virtual void RegisterPresentationSessionMessagesObserver( 172 virtual void RegisterPresentationSessionMessagesObserver(
169 PresentationSessionMessagesObserver* observer) = 0; 173 PresentationSessionMessagesObserver* observer) = 0;
170 174
171 // Unregisters a previously registered PresentationSessionMessagesObserver. 175 // Unregisters a previously registered PresentationSessionMessagesObserver.
172 // |observer| will stop receiving further updates. 176 // |observer| will stop receiving further updates.
173 virtual void UnregisterPresentationSessionMessagesObserver( 177 virtual void UnregisterPresentationSessionMessagesObserver(
174 PresentationSessionMessagesObserver* observer) = 0; 178 PresentationSessionMessagesObserver* observer) = 0;
179
180 // Adds the LocalMediaRoutesObserver |observer| to listen for newly created
181 // MediaRoutes.
182 virtual void RegisterLocalMediaRoutesObserver(
183 LocalMediaRoutesObserver* observer) = 0;
184
185 // Removes the LocalMediaRoutesObserver |observer|.
186 virtual void UnregisterLocalMediaRoutesObserver(
187 LocalMediaRoutesObserver* observer) = 0;
175 }; 188 };
176 189
177 } // namespace media_router 190 } // namespace media_router
178 191
179 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ 192 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698