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

Unified Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 1235083006: CallbackPromiseAdapter types should be more compatible with WebCallbacks (2/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-callbacks-3
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/presentation/presentation_dispatcher.cc
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc
index 74b4dca5d6d955a2a08094e750195c997e1d54e3..cb0f8df8763e53ca388ea30ab0589ec361c56776 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -225,7 +225,7 @@ void PresentationDispatcher::getAvailability(
const blink::WebString& presentationUrl,
blink::WebPresentationAvailabilityCallbacks* callbacks) {
if (listening_state_ == ListeningState::Active) {
- callbacks->onSuccess(new bool(last_known_availability_));
+ callbacks->onSuccess(last_known_availability_);
delete callbacks;
return;
}
@@ -277,7 +277,7 @@ void PresentationDispatcher::OnScreenAvailabilityUpdated(bool available) {
for (AvailabilityCallbacksMap::iterator iter(&availability_callbacks_);
!iter.IsAtEnd(); iter.Advance()) {
- iter.GetCurrentValue()->onSuccess(new bool(available));
+ iter.GetCurrentValue()->onSuccess(available);
}
availability_callbacks_.Clear();
@@ -289,7 +289,7 @@ void PresentationDispatcher::OnScreenAvailabilityNotSupported() {
for (AvailabilityCallbacksMap::iterator iter(&availability_callbacks_);
!iter.IsAtEnd(); iter.Advance()) {
- iter.GetCurrentValue()->onError(new blink::WebPresentationError(
+ iter.GetCurrentValue()->onError(blink::WebPresentationError(
blink::WebPresentationError::ErrorTypeAvailabilityNotSupported,
blink::WebString::fromUTF8(
"getAvailability() isn't supported at the moment. It can be due to"
@@ -325,14 +325,15 @@ void PresentationDispatcher::OnSessionCreated(
DCHECK(callback);
if (!error.is_null()) {
DCHECK(session_info.is_null());
- callback->onError(new blink::WebPresentationError(
+ callback->onError(blink::WebPresentationError(
GetWebPresentationErrorTypeFromMojo(error->error_type),
blink::WebString::fromUTF8(error->message)));
return;
}
DCHECK(!session_info.is_null());
- callback->onSuccess(new PresentationSessionClient(session_info.Clone()));
+ callback->onSuccess(
+ blink::adoptWebPtr(new PresentationSessionClient(session_info.Clone())));
presentation_service_->ListenForSessionMessages(session_info.Pass());
}

Powered by Google App Engine
This is Rietveld 408576698