OLD | NEW |
---|---|
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 <memory> | |
8 #include <set> | 9 #include <set> |
10 #include <string> | |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "base/callback_list.h" | 13 #include "base/callback_list.h" |
12 #include "base/containers/scoped_ptr_hash_map.h" | 14 #include "base/containers/scoped_ptr_hash_map.h" |
13 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 16 #include "base/macros.h" |
15 #include "chrome/browser/media/router/media_route.h" | 17 #include "chrome/browser/media/router/media_route.h" |
16 #include "chrome/browser/media/router/media_router.h" | 18 #include "chrome/browser/media/router/media_router.h" |
17 #include "chrome/browser/media/router/media_routes_observer.h" | 19 #include "chrome/browser/media/router/media_routes_observer.h" |
20 #if !defined(OS_ANDROID) | |
21 #include "chrome/browser/ui/toolbar/media_router_action_controller.h" | |
22 #endif | |
23 | |
24 class Profile; | |
18 | 25 |
19 namespace media_router { | 26 namespace media_router { |
20 | 27 |
21 class MediaRouterBase : public MediaRouter { | 28 class MediaRouterBase : public MediaRouter { |
22 public: | 29 public: |
23 ~MediaRouterBase() override; | 30 ~MediaRouterBase() override; |
24 | 31 |
25 std::unique_ptr<PresentationConnectionStateSubscription> | 32 std::unique_ptr<PresentationConnectionStateSubscription> |
26 AddPresentationConnectionStateChangedCallback( | 33 AddPresentationConnectionStateChangedCallback( |
27 const MediaRoute::Id& route_id, | 34 const MediaRoute::Id& route_id, |
28 const content::PresentationConnectionStateChangedCallback& callback) | 35 const content::PresentationConnectionStateChangedCallback& callback) |
29 override; | 36 override; |
30 | 37 |
31 // Called when the incognito profile for this instance is being shut down. | 38 // Called when the incognito profile for this instance is being shut down. |
32 // This will terminate all incognito media routes. | 39 // This will terminate all incognito media routes. |
33 void OnIncognitoProfileShutdown() override; | 40 void OnIncognitoProfileShutdown() override; |
34 | 41 |
42 #if !defined(OS_ANDROID) | |
43 // Returns the controller for media router toolbar action icon. | |
44 MediaRouterActionController* GetActionController() override; | |
45 #endif | |
46 | |
35 protected: | 47 protected: |
36 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, | 48 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, |
37 PresentationConnectionStateChangedCallback); | 49 PresentationConnectionStateChangedCallback); |
38 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, | 50 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, |
39 PresentationConnectionStateChangedCallbackRemoved); | 51 PresentationConnectionStateChangedCallbackRemoved); |
40 | 52 |
41 MediaRouterBase(); | 53 explicit MediaRouterBase(Profile* profile); |
42 | 54 |
43 // Generates a unique presentation id. Shared between Android and desktop. | 55 // Generates a unique presentation id. Shared between Android and desktop. |
44 static std::string CreatePresentationId(); | 56 static std::string CreatePresentationId(); |
45 | 57 |
46 void NotifyPresentationConnectionStateChange( | 58 void NotifyPresentationConnectionStateChange( |
47 const MediaRoute::Id& route_id, | 59 const MediaRoute::Id& route_id, |
48 content::PresentationConnectionState state); | 60 content::PresentationConnectionState state); |
49 void NotifyPresentationConnectionClose( | 61 void NotifyPresentationConnectionClose( |
50 const MediaRoute::Id& route_id, | 62 const MediaRoute::Id& route_id, |
51 content::PresentationConnectionCloseReason reason, | 63 content::PresentationConnectionCloseReason reason, |
(...skipping 24 matching lines...) Expand all Loading... | |
76 // |route_id| is removed from |presentation_connection_state_callbacks_|. | 88 // |route_id| is removed from |presentation_connection_state_callbacks_|. |
77 void OnPresentationConnectionStateCallbackRemoved( | 89 void OnPresentationConnectionStateCallbackRemoved( |
78 const MediaRoute::Id& route_id); | 90 const MediaRoute::Id& route_id); |
79 | 91 |
80 // KeyedService | 92 // KeyedService |
81 void Shutdown() override; | 93 void Shutdown() override; |
82 | 94 |
83 std::unique_ptr<InternalMediaRoutesObserver> internal_routes_observer_; | 95 std::unique_ptr<InternalMediaRoutesObserver> internal_routes_observer_; |
84 bool initialized_; | 96 bool initialized_; |
85 | 97 |
98 Profile* profile_; | |
99 | |
100 #if !defined(OS_ANDROID) | |
101 std::unique_ptr<MediaRouterActionController> action_controller_; | |
mark a. foltz
2016/09/02 22:19:09
Please add a TODO to find an owner for this object
takumif
2016/09/07 21:48:32
Done.
| |
102 #endif | |
103 | |
86 DISALLOW_COPY_AND_ASSIGN(MediaRouterBase); | 104 DISALLOW_COPY_AND_ASSIGN(MediaRouterBase); |
87 }; | 105 }; |
88 | 106 |
89 } // namespace media_router | 107 } // namespace media_router |
90 | 108 |
91 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_ | 109 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_BASE_H_ |
OLD | NEW |