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

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

Issue 979413002: [Presentation API] Additional plumbing for PresentationServiceImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@REAL-NEW-MASTER
Patch Set: updated comments 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/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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 void PresentationDispatcher::OnSessionCreated( 116 void PresentationDispatcher::OnSessionCreated(
117 blink::WebPresentationSessionClientCallbacks* callback, 117 blink::WebPresentationSessionClientCallbacks* callback,
118 presentation::PresentationSessionInfoPtr session_info, 118 presentation::PresentationSessionInfoPtr session_info,
119 presentation::PresentationErrorPtr error) { 119 presentation::PresentationErrorPtr error) {
120 DCHECK(callback); 120 DCHECK(callback);
121 if (!error.is_null()) { 121 if (!error.is_null()) {
122 DCHECK(session_info.is_null()); 122 DCHECK(session_info.is_null());
123 callback->onError(new blink::WebPresentationError( 123 callback->onError(new blink::WebPresentationError(
124 GetWebPresentationErrorTypeFromMojo(error->errorType), 124 GetWebPresentationErrorTypeFromMojo(error->error_type),
125 blink::WebString::fromUTF8(error->message))); 125 blink::WebString::fromUTF8(error->message)));
126 return; 126 return;
127 } 127 }
128 128
129 DCHECK(!session_info.is_null()); 129 DCHECK(!session_info.is_null());
130 PresentationSessionDispatcher* session_dispatcher = 130 PresentationSessionDispatcher* session_dispatcher =
131 new PresentationSessionDispatcher(session_info.Pass()); 131 new PresentationSessionDispatcher(session_info.Pass());
132 presentation_session_dispatchers_.push_back(session_dispatcher); 132 presentation_session_dispatchers_.push_back(session_dispatcher);
133 callback->onSuccess(new PresentationSessionClient(session_dispatcher)); 133 callback->onSuccess(new PresentationSessionClient(session_dispatcher));
134 } 134 }
135 135
136 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { 136 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() {
137 if (presentation_service_.get()) 137 if (presentation_service_.get())
138 return; 138 return;
139 139
140 render_frame()->GetServiceRegistry()->ConnectToRemoteService( 140 render_frame()->GetServiceRegistry()->ConnectToRemoteService(
141 &presentation_service_); 141 &presentation_service_);
142 } 142 }
143 143
144 } // namespace content 144 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698