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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp

Issue 2850983002: Remove UserGestureUtilizedCallback, it's unused outside of tests (Closed)
Patch Set: Created 3 years, 7 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 "modules/presentation/PresentationRequest.h" 5 #include "modules/presentation/PresentationRequest.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // object but still has listeners registered. 128 // object but still has listeners registered.
129 return GetExecutionContext() && HasEventListeners(); 129 return GetExecutionContext() && HasEventListeners();
130 } 130 }
131 131
132 ScriptPromise PresentationRequest::start(ScriptState* script_state) { 132 ScriptPromise PresentationRequest::start(ScriptState* script_state) {
133 Settings* context_settings = GetSettings(GetExecutionContext()); 133 Settings* context_settings = GetSettings(GetExecutionContext());
134 bool is_user_gesture_required = 134 bool is_user_gesture_required =
135 !context_settings || 135 !context_settings ||
136 context_settings->GetPresentationRequiresUserGesture(); 136 context_settings->GetPresentationRequiresUserGesture();
137 137
138 if (is_user_gesture_required && !UserGestureIndicator::UtilizeUserGesture()) 138 if (is_user_gesture_required &&
139 !UserGestureIndicator::ProcessingUserGesture())
139 return ScriptPromise::RejectWithDOMException( 140 return ScriptPromise::RejectWithDOMException(
140 script_state, 141 script_state,
141 DOMException::Create( 142 DOMException::Create(
142 kInvalidAccessError, 143 kInvalidAccessError,
143 "PresentationRequest::start() requires user gesture.")); 144 "PresentationRequest::start() requires user gesture."));
144 145
145 WebPresentationClient* client = PresentationClient(GetExecutionContext()); 146 WebPresentationClient* client = PresentationClient(GetExecutionContext());
146 if (!client) 147 if (!client)
147 return ScriptPromise::RejectWithDOMException( 148 return ScriptPromise::RejectWithDOMException(
148 script_state, 149 script_state,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (execution_context->IsSecureContext()) { 231 if (execution_context->IsSecureContext()) {
231 UseCounter::Count(execution_context, 232 UseCounter::Count(execution_context,
232 UseCounter::kPresentationRequestSecureOrigin); 233 UseCounter::kPresentationRequestSecureOrigin);
233 } else { 234 } else {
234 UseCounter::Count(execution_context, 235 UseCounter::Count(execution_context,
235 UseCounter::kPresentationRequestInsecureOrigin); 236 UseCounter::kPresentationRequestInsecureOrigin);
236 } 237 }
237 } 238 }
238 239
239 } // namespace blink 240 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698