| 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_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "chrome/browser/media/router/media_routes_observer.h" | 16 #include "chrome/browser/media/router/media_routes_observer.h" |
| 17 #include "chrome/browser/media/router/media_sink.h" | 17 #include "chrome/browser/media/router/media_sink.h" |
| 18 #include "chrome/browser/media/router/media_source.h" | 18 #include "chrome/browser/media/router/media_source.h" |
| 19 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" | 19 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" |
| 20 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h" | 20 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h" |
| 21 | 21 |
| 22 namespace media_router { | 22 namespace media_router { |
| 23 | 23 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // |cast_mode|. | 116 // |cast_mode|. |
| 117 void UpdateWithSinksQueryResult(MediaCastMode cast_mode, | 117 void UpdateWithSinksQueryResult(MediaCastMode cast_mode, |
| 118 const std::vector<MediaSink>& result); | 118 const std::vector<MediaSink>& result); |
| 119 | 119 |
| 120 // Notifies observers that results have been updated. | 120 // Notifies observers that results have been updated. |
| 121 void NotifyOnResultsUpdated(); | 121 void NotifyOnResultsUpdated(); |
| 122 | 122 |
| 123 // MediaSinksObservers that listens for compatible MediaSink updates. | 123 // MediaSinksObservers that listens for compatible MediaSink updates. |
| 124 // Each observer is associated with a MediaCastMode. Results received by | 124 // Each observer is associated with a MediaCastMode. Results received by |
| 125 // observers are propagated back to this class. | 125 // observers are propagated back to this class. |
| 126 // TODO(mfoltz): Remove linked_ptr when there is a ScopedPtrMap available. | 126 std::map<MediaCastMode, scoped_ptr<MediaSinksObserver>> sinks_observers_; |
| 127 std::map<MediaCastMode, linked_ptr<MediaSinksObserver>> sinks_observers_; | |
| 128 | 127 |
| 129 // Holds registrations of MediaSources for cast modes. | 128 // Holds registrations of MediaSources for cast modes. |
| 130 std::map<MediaCastMode, MediaSource> cast_mode_sources_; | 129 std::map<MediaCastMode, MediaSource> cast_mode_sources_; |
| 131 | 130 |
| 132 // Holds all known sinks and their associated cast modes. | 131 // Holds all known sinks and their associated cast modes. |
| 133 std::map<MediaSink::Id, MediaSinkWithCastModes> all_sinks_; | 132 std::map<MediaSink::Id, MediaSinkWithCastModes> all_sinks_; |
| 134 | 133 |
| 135 // Registered observers. | 134 // Registered observers. |
| 136 base::ObserverList<Observer> observers_; | 135 base::ObserverList<Observer> observers_; |
| 137 | 136 |
| 138 // Not owned by this object. | 137 // Not owned by this object. |
| 139 MediaRouter* router_; | 138 MediaRouter* router_; |
| 140 | 139 |
| 141 base::ThreadChecker thread_checker_; | 140 base::ThreadChecker thread_checker_; |
| 142 | 141 |
| 143 DISALLOW_COPY_AND_ASSIGN(QueryResultManager); | 142 DISALLOW_COPY_AND_ASSIGN(QueryResultManager); |
| 144 }; | 143 }; |
| 145 | 144 |
| 146 } // namespace media_router | 145 } // namespace media_router |
| 147 | 146 |
| 148 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ | 147 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ |
| OLD | NEW |