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

Side by Side Diff: chrome/browser/media/router/presentation_service_delegate_impl.cc

Issue 2426223002: Reduce FOR_EACH_OBSERVER macro usage in chrome/browser (Closed)
Patch Set: 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 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/media/router/presentation_service_delegate_impl.h" 5 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <unordered_map> 8 #include <unordered_map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } 615 }
616 return presentation_frame.get(); 616 return presentation_frame.get();
617 } 617 }
618 618
619 void PresentationFrameManager::ClearDefaultPresentationRequest() { 619 void PresentationFrameManager::ClearDefaultPresentationRequest() {
620 default_presentation_started_callback_.Reset(); 620 default_presentation_started_callback_.Reset();
621 if (!default_presentation_request_) 621 if (!default_presentation_request_)
622 return; 622 return;
623 623
624 default_presentation_request_.reset(); 624 default_presentation_request_.reset();
625 FOR_EACH_OBSERVER( 625 for (auto& observer : default_presentation_request_observers_)
626 PresentationServiceDelegateImpl::DefaultPresentationRequestObserver, 626 observer.OnDefaultPresentationRemoved();
627 default_presentation_request_observers_, OnDefaultPresentationRemoved());
628 } 627 }
629 628
630 bool PresentationFrameManager::IsMainFrame( 629 bool PresentationFrameManager::IsMainFrame(
631 const RenderFrameHostId& render_frame_host_id) const { 630 const RenderFrameHostId& render_frame_host_id) const {
632 RenderFrameHost* main_frame = web_contents_->GetMainFrame(); 631 RenderFrameHost* main_frame = web_contents_->GetMainFrame();
633 return main_frame && GetRenderFrameHostId(main_frame) == render_frame_host_id; 632 return main_frame && GetRenderFrameHostId(main_frame) == render_frame_host_id;
634 } 633 }
635 634
636 void PresentationFrameManager::SetDefaultPresentationRequest( 635 void PresentationFrameManager::SetDefaultPresentationRequest(
637 const PresentationRequest& default_presentation_request) { 636 const PresentationRequest& default_presentation_request) {
638 if (default_presentation_request_ && 637 if (default_presentation_request_ &&
639 default_presentation_request_->Equals(default_presentation_request)) 638 default_presentation_request_->Equals(default_presentation_request))
640 return; 639 return;
641 640
642 default_presentation_request_.reset( 641 default_presentation_request_.reset(
643 new PresentationRequest(default_presentation_request)); 642 new PresentationRequest(default_presentation_request));
644 FOR_EACH_OBSERVER( 643 for (auto& observer : default_presentation_request_observers_)
645 PresentationServiceDelegateImpl::DefaultPresentationRequestObserver, 644 observer.OnDefaultPresentationChanged(*default_presentation_request_);
646 default_presentation_request_observers_,
647 OnDefaultPresentationChanged(*default_presentation_request_));
648 } 645 }
649 646
650 void PresentationFrameManager::SetMediaRouterForTest(MediaRouter* router) { 647 void PresentationFrameManager::SetMediaRouterForTest(MediaRouter* router) {
651 router_ = router; 648 router_ = router;
652 } 649 }
653 650
654 PresentationServiceDelegateImpl* 651 PresentationServiceDelegateImpl*
655 PresentationServiceDelegateImpl::GetOrCreateForWebContents( 652 PresentationServiceDelegateImpl::GetOrCreateForWebContents(
656 content::WebContents* web_contents) { 653 content::WebContents* web_contents) {
657 DCHECK(web_contents); 654 DCHECK(web_contents);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( 958 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest(
962 int render_process_id, 959 int render_process_id,
963 int render_frame_id, 960 int render_frame_id,
964 const MediaSource::Id& source_id) const { 961 const MediaSource::Id& source_id) const {
965 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); 962 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
966 return frame_manager_->HasScreenAvailabilityListenerForTest( 963 return frame_manager_->HasScreenAvailabilityListenerForTest(
967 render_frame_host_id, source_id); 964 render_frame_host_id, source_id);
968 } 965 }
969 966
970 } // namespace media_router 967 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698