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

Side by Side Diff: chrome/browser/ui/webui/media_router/query_result_manager.cc

Issue 1693963003: Pass origin to StartObservingMediaSinks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Marks Review Fixes with URL changes Created 4 years, 9 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 #include "chrome/browser/ui/webui/media_router/query_result_manager.h" 5 #include "chrome/browser/ui/webui/media_router/query_result_manager.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/media/router/media_router.h" 9 #include "chrome/browser/media/router/media_router.h"
10 #include "chrome/browser/media/router/media_sinks_observer.h" 10 #include "chrome/browser/media/router/media_sinks_observer.h"
(...skipping 11 matching lines...) Expand all
22 QueryResultManager* result_manager) 22 QueryResultManager* result_manager)
23 : MediaSinksObserver(router, source), 23 : MediaSinksObserver(router, source),
24 cast_mode_(cast_mode), 24 cast_mode_(cast_mode),
25 result_manager_(result_manager) { 25 result_manager_(result_manager) {
26 DCHECK(result_manager); 26 DCHECK(result_manager);
27 } 27 }
28 28
29 ~CastModeMediaSinksObserver() override {} 29 ~CastModeMediaSinksObserver() override {}
30 30
31 // MediaSinksObserver 31 // MediaSinksObserver
32 void OnSinksReceived(const std::vector<MediaSink>& result) override { 32 void OnSinksReceived(const MediaSource& incomingSource,
33 const std::vector<MediaSink>& result) override {
34 if (!incomingSource.Equals(source())) {
35 return;
36 }
33 latest_sink_ids_.clear(); 37 latest_sink_ids_.clear();
34 for (const MediaSink& sink : result) { 38 for (const MediaSink& sink : result) {
35 latest_sink_ids_.push_back(sink.id()); 39 latest_sink_ids_.push_back(sink.id());
36 } 40 }
37 result_manager_->UpdateWithSinksQueryResult(cast_mode_, result); 41 result_manager_->UpdateWithSinksQueryResult(cast_mode_, result);
38 result_manager_->NotifyOnResultsUpdated(); 42 result_manager_->NotifyOnResultsUpdated();
39 } 43 }
40 44
41 // Returns the most recent sink IDs that were passed to |OnSinksReceived|. 45 // Returns the most recent sink IDs that were passed to |OnSinksReceived|.
42 void GetLatestSinkIds(std::vector<MediaSink::Id>* sink_ids) const { 46 void GetLatestSinkIds(std::vector<MediaSink::Id>* sink_ids) const {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void QueryResultManager::NotifyOnResultsUpdated() { 172 void QueryResultManager::NotifyOnResultsUpdated() {
169 std::vector<MediaSinkWithCastModes> sinks; 173 std::vector<MediaSinkWithCastModes> sinks;
170 for (const auto& sink_pair : all_sinks_) { 174 for (const auto& sink_pair : all_sinks_) {
171 sinks.push_back(sink_pair.second); 175 sinks.push_back(sink_pair.second);
172 } 176 }
173 FOR_EACH_OBSERVER(QueryResultManager::Observer, observers_, 177 FOR_EACH_OBSERVER(QueryResultManager::Observer, observers_,
174 OnResultsUpdated(sinks)); 178 OnResultsUpdated(sinks));
175 } 179 }
176 180
177 } // namespace media_router 181 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698