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

Side by Side Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 999003004: Implementing closeSession from WebPresentationClient to PresentationService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After merge 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
« no previous file with comments | « content/renderer/presentation/presentation_dispatcher.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/presentation/presentation_dispatcher.h" 5 #include "content/renderer/presentation/presentation_dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/presentation/presentation_service.mojom.h" 8 #include "content/common/presentation/presentation_service.mojom.h"
9 #include "content/public/common/service_registry.h" 9 #include "content/public/common/service_registry.h"
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // OnSessionCreated() is called. |callback| needs to be alive and also needs 113 // OnSessionCreated() is called. |callback| needs to be alive and also needs
114 // to be destroyed so we transfer its ownership to the mojo callback. 114 // to be destroyed so we transfer its ownership to the mojo callback.
115 presentation_service_->JoinSession( 115 presentation_service_->JoinSession(
116 presentationUrl.utf8(), 116 presentationUrl.utf8(),
117 presentationId.utf8(), 117 presentationId.utf8(),
118 base::Bind(&PresentationDispatcher::OnSessionCreated, 118 base::Bind(&PresentationDispatcher::OnSessionCreated,
119 base::Unretained(this), 119 base::Unretained(this),
120 base::Owned(callback))); 120 base::Owned(callback)));
121 } 121 }
122 122
123 void PresentationDispatcher::closeSession(
124 const blink::WebString& presentationUrl,
125 const blink::WebString& presentationId) {
126 ConnectToPresentationServiceIfNeeded();
127
128 presentation_service_->CloseSession(
129 presentationUrl.utf8(),
130 presentationId.utf8());
131 }
132
123 void PresentationDispatcher::DidChangeDefaultPresentation() { 133 void PresentationDispatcher::DidChangeDefaultPresentation() {
124 GURL presentation_url(GetPresentationURLFromFrame(render_frame())); 134 GURL presentation_url(GetPresentationURLFromFrame(render_frame()));
125 135
126 ConnectToPresentationServiceIfNeeded(); 136 ConnectToPresentationServiceIfNeeded();
127 presentation_service_->SetDefaultPresentationURL( 137 presentation_service_->SetDefaultPresentationURL(
128 presentation_url.spec(), mojo::String()); 138 presentation_url.spec(), mojo::String());
129 } 139 }
130 140
131 void PresentationDispatcher::OnScreenAvailabilityChanged( 141 void PresentationDispatcher::OnScreenAvailabilityChanged(
132 const std::string& presentation_url, bool available) { 142 const std::string& presentation_url, bool available) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return; 193 return;
184 194
185 render_frame()->GetServiceRegistry()->ConnectToRemoteService( 195 render_frame()->GetServiceRegistry()->ConnectToRemoteService(
186 &presentation_service_); 196 &presentation_service_);
187 presentation_service_->ListenForDefaultSessionStart(base::Bind( 197 presentation_service_->ListenForDefaultSessionStart(base::Bind(
188 &PresentationDispatcher::OnDefaultSessionStarted, 198 &PresentationDispatcher::OnDefaultSessionStarted,
189 base::Unretained(this))); 199 base::Unretained(this)));
190 } 200 }
191 201
192 } // namespace content 202 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/presentation/presentation_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698