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

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

Issue 1494833002: Cleanup/ linked_ptr -> scoped_ptr from c/b/ui/webui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (source.Empty()) { 78 if (source.Empty()) {
79 LOG(WARNING) << "StartSinksQuery called with empty source for " 79 LOG(WARNING) << "StartSinksQuery called with empty source for "
80 << cast_mode; 80 << cast_mode;
81 return; 81 return;
82 } 82 }
83 83
84 SetSourceForCastMode(cast_mode, source); 84 SetSourceForCastMode(cast_mode, source);
85 RemoveObserverForCastMode(cast_mode); 85 RemoveObserverForCastMode(cast_mode);
86 UpdateWithSinksQueryResult(cast_mode, std::vector<MediaSink>()); 86 UpdateWithSinksQueryResult(cast_mode, std::vector<MediaSink>());
87 87
88 linked_ptr<CastModeMediaSinksObserver> observer( 88 scoped_ptr<CastModeMediaSinksObserver> observer(
89 new CastModeMediaSinksObserver(cast_mode, source, router_, this)); 89 new CastModeMediaSinksObserver(cast_mode, source, router_, this));
90 observer->Init(); 90 observer->Init();
91 auto result = sinks_observers_.insert(std::make_pair(cast_mode, observer)); 91 auto result =
92 sinks_observers_.insert(std::make_pair(cast_mode, std::move(observer)));
92 DCHECK(result.second); 93 DCHECK(result.second);
93 NotifyOnResultsUpdated(); 94 NotifyOnResultsUpdated();
94 } 95 }
95 96
96 void QueryResultManager::StopSinksQuery(MediaCastMode cast_mode) { 97 void QueryResultManager::StopSinksQuery(MediaCastMode cast_mode) {
97 DCHECK(thread_checker_.CalledOnValidThread()); 98 DCHECK(thread_checker_.CalledOnValidThread());
98 RemoveObserverForCastMode(cast_mode); 99 RemoveObserverForCastMode(cast_mode);
99 SetSourceForCastMode(cast_mode, MediaSource()); 100 SetSourceForCastMode(cast_mode, MediaSource());
100 UpdateWithSinksQueryResult(cast_mode, std::vector<MediaSink>()); 101 UpdateWithSinksQueryResult(cast_mode, std::vector<MediaSink>());
101 NotifyOnResultsUpdated(); 102 NotifyOnResultsUpdated();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 void QueryResultManager::NotifyOnResultsUpdated() { 168 void QueryResultManager::NotifyOnResultsUpdated() {
168 std::vector<MediaSinkWithCastModes> sinks; 169 std::vector<MediaSinkWithCastModes> sinks;
169 for (const auto& sink_pair : all_sinks_) { 170 for (const auto& sink_pair : all_sinks_) {
170 sinks.push_back(sink_pair.second); 171 sinks.push_back(sink_pair.second);
171 } 172 }
172 FOR_EACH_OBSERVER(QueryResultManager::Observer, observers_, 173 FOR_EACH_OBSERVER(QueryResultManager::Observer, observers_,
173 OnResultsUpdated(sinks)); 174 OnResultsUpdated(sinks));
174 } 175 }
175 176
176 } // namespace media_router 177 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698