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: content/browser/presentation/presentation_service_impl.cc

Issue 1033733007: [PresentationAPI] renamed GetScreenAvailability to ListenForScreenAvailability for consistency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated the test Created 5 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 "content/browser/presentation/presentation_service_impl.h" 5 #include "content/browser/presentation/presentation_service_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/browser/presentation/presentation_type_converters.h" 10 #include "content/browser/presentation/presentation_type_converters.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 context.get())) { 77 context.get())) {
78 DVLOG(1) << "AddScreenAvailabilityListener failed. Ignoring request."; 78 DVLOG(1) << "AddScreenAvailabilityListener failed. Ignoring request.";
79 return nullptr; 79 return nullptr;
80 } 80 }
81 it = availability_contexts_.insert( 81 it = availability_contexts_.insert(
82 std::make_pair(context->GetPresentationUrl(), context)).first; 82 std::make_pair(context->GetPresentationUrl(), context)).first;
83 } 83 }
84 return it->second.get(); 84 return it->second.get();
85 } 85 }
86 86
87 void PresentationServiceImpl::GetScreenAvailability( 87 void PresentationServiceImpl::ListenForScreenAvailability(
88 const mojo::String& presentation_url, 88 const mojo::String& presentation_url,
89 const ScreenAvailabilityMojoCallback& callback) { 89 const ScreenAvailabilityMojoCallback& callback) {
90 DVLOG(2) << "GetScreenAvailability"; 90 DVLOG(2) << "ListenForScreenAvailability";
91 if (!delegate_) { 91 if (!delegate_) {
92 callback.Run(presentation_url, false); 92 callback.Run(presentation_url, false);
93 return; 93 return;
94 } 94 }
95 95
96 ScreenAvailabilityContext* context = 96 ScreenAvailabilityContext* context =
97 GetOrCreateAvailabilityContext(presentation_url.get()); 97 GetOrCreateAvailabilityContext(presentation_url.get());
98 if (!context) { 98 if (!context) {
99 callback.Run(presentation_url, false); 99 callback.Run(presentation_url, false);
100 return; 100 return;
101 } 101 }
102 context->CallbackReceived(callback); 102 context->CallbackReceived(callback);
103 } 103 }
104 104
105 void PresentationServiceImpl::OnScreenAvailabilityListenerRemoved( 105 void PresentationServiceImpl::RemoveScreenAvailabilityListener(
106 const mojo::String& presentation_url) { 106 const mojo::String& presentation_url) {
107 DVLOG(2) << "OnScreenAvailabilityListenerRemoved"; 107 DVLOG(2) << "RemoveScreenAvailabilityListener";
108 if (!delegate_) 108 if (!delegate_)
109 return; 109 return;
110 110
111 const std::string& presentation_url_str = presentation_url.get(); 111 const std::string& presentation_url_str = presentation_url.get();
112 auto it = availability_contexts_.find(presentation_url_str); 112 auto it = availability_contexts_.find(presentation_url_str);
113 if (it == availability_contexts_.end()) 113 if (it == availability_contexts_.end())
114 return; 114 return;
115 115
116 delegate_->RemoveScreenAvailabilityListener( 116 delegate_->RemoveScreenAvailabilityListener(
117 render_frame_host_->GetProcess()->GetID(), 117 render_frame_host_->GetProcess()->GetID(),
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 : presentation_url(presentation_url), 412 : presentation_url(presentation_url),
413 presentation_id(presentation_id), 413 presentation_id(presentation_id),
414 callback(callback) { 414 callback(callback) {
415 } 415 }
416 416
417 PresentationServiceImpl::StartSessionRequest::~StartSessionRequest() { 417 PresentationServiceImpl::StartSessionRequest::~StartSessionRequest() {
418 } 418 }
419 419
420 } // namespace content 420 } // namespace content
421 421
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698