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

Side by Side Diff: extensions/browser/api/display_source/display_source_apitestbase.cc

Issue 2424593002: Reduce FOR_EACH_OBSERVER usage in extensions (Closed)
Patch Set: script_observers_ Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "extensions/browser/api/display_source/display_source_apitestbase.h" 5 #include "extensions/browser/api/display_source/display_source_apitestbase.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 399 }
400 400
401 void MockDisplaySourceConnectionDelegate::OnSinkConnected() { 401 void MockDisplaySourceConnectionDelegate::OnSinkConnected() {
402 DCHECK_CURRENTLY_ON(BrowserThread::UI); 402 DCHECK_CURRENTLY_ON(BrowserThread::UI);
403 CHECK(active_sink_); 403 CHECK(active_sink_);
404 active_sink_->state = SINK_STATE_CONNECTED; 404 active_sink_->state = SINK_STATE_CONNECTED;
405 NotifySinksUpdated(); 405 NotifySinksUpdated();
406 } 406 }
407 407
408 void MockDisplaySourceConnectionDelegate::NotifySinksUpdated() { 408 void MockDisplaySourceConnectionDelegate::NotifySinksUpdated() {
409 FOR_EACH_OBSERVER(DisplaySourceConnectionDelegate::Observer, observers_, 409 for (auto& observer : observers_)
410 OnSinksUpdated(sinks_)); 410 observer.OnSinksUpdated(sinks_);
411 } 411 }
412 412
413 void MockDisplaySourceConnectionDelegate:: 413 void MockDisplaySourceConnectionDelegate::
414 EnqueueSinkMessage(std::string message) { 414 EnqueueSinkMessage(std::string message) {
415 const std::size_t found_session_key = message.find(kSessionKey); 415 const std::size_t found_session_key = message.find(kSessionKey);
416 if (found_session_key != std::string::npos) 416 if (found_session_key != std::string::npos)
417 AdaptMessagePattern(found_session_key, kSessionKey, kSessionIdLength, 417 AdaptMessagePattern(found_session_key, kSessionKey, kSessionIdLength,
418 session_id_, message); 418 session_id_, message);
419 419
420 const std::size_t found_unicast_key = message.find(kUnicastKey); 420 const std::size_t found_unicast_key = message.find(kUnicastKey);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 base::Bind(&MockDisplaySourceConnectionDelegate::Disconnect, 526 base::Bind(&MockDisplaySourceConnectionDelegate::Disconnect,
527 base::Unretained(this), StringCallback())); 527 base::Unretained(this), StringCallback()));
528 return; 528 return;
529 } 529 }
530 530
531 DCHECK(socket_.get()); 531 DCHECK(socket_.get());
532 ReceiveMediaPacket(); 532 ReceiveMediaPacket();
533 } 533 }
534 534
535 } // namespace extensions 535 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698