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

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

Issue 2728543009: [Media Router] Custom Controls 2 - add MediaRouter::GetRouteController() (Closed)
Patch Set: Combine CreateMRController and SetMRStatusObserver 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
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_BASE_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 const MediaRoute::Id& route_id, 27 const MediaRoute::Id& route_id,
28 const content::PresentationConnectionStateChangedCallback& callback) 28 const content::PresentationConnectionStateChangedCallback& callback)
29 override; 29 override;
30 30
31 // Called when the incognito profile for this instance is being shut down. 31 // Called when the incognito profile for this instance is being shut down.
32 // This will terminate all incognito media routes. 32 // This will terminate all incognito media routes.
33 void OnIncognitoProfileShutdown() override; 33 void OnIncognitoProfileShutdown() override;
34 34
35 std::vector<MediaRoute> GetCurrentRoutes() const override; 35 std::vector<MediaRoute> GetCurrentRoutes() const override;
36 36
37 scoped_refptr<MediaRouteController> GetRouteController(
38 const MediaRoute::Id& route_id) override;
39
37 protected: 40 protected:
38 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, 41 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest,
39 PresentationConnectionStateChangedCallback); 42 PresentationConnectionStateChangedCallback);
40 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, 43 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest,
41 PresentationConnectionStateChangedCallbackRemoved); 44 PresentationConnectionStateChangedCallbackRemoved);
42 FRIEND_TEST_ALL_PREFIXES(MediaRouterBaseTest, CreatePresentationIds); 45 FRIEND_TEST_ALL_PREFIXES(MediaRouterBaseTest, CreatePresentationIds);
43 FRIEND_TEST_ALL_PREFIXES(MediaRouterBaseTest, NotifyCallbacks); 46 FRIEND_TEST_ALL_PREFIXES(MediaRouterBaseTest, NotifyCallbacks);
44 47
45 MediaRouterBase(); 48 MediaRouterBase();
46 49
47 // Generates a unique presentation id. Shared between Android and desktop. 50 // Generates a unique presentation id. Shared between Android and desktop.
48 static std::string CreatePresentationId(); 51 static std::string CreatePresentationId();
49 52
50 void NotifyPresentationConnectionStateChange( 53 void NotifyPresentationConnectionStateChange(
51 const MediaRoute::Id& route_id, 54 const MediaRoute::Id& route_id,
52 content::PresentationConnectionState state); 55 content::PresentationConnectionState state);
53 void NotifyPresentationConnectionClose( 56 void NotifyPresentationConnectionClose(
54 const MediaRoute::Id& route_id, 57 const MediaRoute::Id& route_id,
55 content::PresentationConnectionCloseReason reason, 58 content::PresentationConnectionCloseReason reason,
56 const std::string& message); 59 const std::string& message);
57 60
58 // Returns true when there is at least one MediaRoute that can be returned by 61 // Returns true when there is at least one MediaRoute that can be returned by
59 // JoinRoute(). 62 // JoinRoute().
60 bool HasJoinableRoute() const; 63 bool HasJoinableRoute() const;
61 64
65 // Returns true if there is a route with the ID in the current list of routes.
66 bool IsRouteKnown(const std::string& route_id) const;
67
62 using PresentationConnectionStateChangedCallbacks = base::CallbackList<void( 68 using PresentationConnectionStateChangedCallbacks = base::CallbackList<void(
63 const content::PresentationConnectionStateChangeInfo&)>; 69 const content::PresentationConnectionStateChangeInfo&)>;
64 70
65 std::unordered_map< 71 std::unordered_map<
66 MediaRoute::Id, 72 MediaRoute::Id,
67 std::unique_ptr<PresentationConnectionStateChangedCallbacks>> 73 std::unique_ptr<PresentationConnectionStateChangedCallbacks>>
68 presentation_connection_state_callbacks_; 74 presentation_connection_state_callbacks_;
69 75
70 private: 76 private:
71 friend class MediaRouterBaseTest; 77 friend class MediaRouterBaseTest;
72 friend class MediaRouterFactory; 78 friend class MediaRouterFactory;
73 friend class MediaRouterMojoTest; 79 friend class MediaRouterMojoTest;
74 80
75 class InternalMediaRoutesObserver; 81 class InternalMediaRoutesObserver;
76 82
77 // Must be called before invoking any other method. 83 // Must be called before invoking any other method.
78 void Initialize(); 84 void Initialize();
79 85
80 // Called when a PresentationConnectionStateChangedCallback associated with 86 // Called when a PresentationConnectionStateChangedCallback associated with
81 // |route_id| is removed from |presentation_connection_state_callbacks_|. 87 // |route_id| is removed from |presentation_connection_state_callbacks_|.
82 void OnPresentationConnectionStateCallbackRemoved( 88 void OnPresentationConnectionStateCallbackRemoved(
83 const MediaRoute::Id& route_id); 89 const MediaRoute::Id& route_id);
84 90
85 // KeyedService 91 // KeyedService
86 void Shutdown() override; 92 void Shutdown() override;
87 93
94 // MediaRouter
95 void DetachRouteController(const MediaRoute::Id& route_id,
96 MediaRouteController* controller) override;
97
88 std::unique_ptr<InternalMediaRoutesObserver> internal_routes_observer_; 98 std::unique_ptr<InternalMediaRoutesObserver> internal_routes_observer_;
89 bool initialized_; 99 bool initialized_;
90 100
91 DISALLOW_COPY_AND_ASSIGN(MediaRouterBase); 101 DISALLOW_COPY_AND_ASSIGN(MediaRouterBase);
92 }; 102 };
93 103
94 } // namespace media_router 104 } // namespace media_router
95 105
96 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_ 106 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/router/media_router.h ('k') | chrome/browser/media/router/media_router_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698