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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorRuntimeAgent.cpp

Issue 1808533002: DevTools: wrap console evaluation with user gesture indicator for convenience. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorRuntimeAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorRuntimeAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorRuntimeAgent.cpp
index b96d9ce97dc8ba7a96d6782ef5ab504c7d1fd0db..4f367ef6f04b11772157e61f36e371bbd22f2647 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorRuntimeAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorRuntimeAgent.cpp
@@ -33,9 +33,11 @@
#include "bindings/core/v8/ScriptState.h"
#include "core/inspector/InspectorTraceEvents.h"
#include "core/inspector/MuteConsoleScope.h"
+#include "platform/UserGestureIndicator.h"
#include "platform/inspector_protocol/Values.h"
#include "platform/v8_inspector/public/V8Debugger.h"
#include "platform/v8_inspector/public/V8RuntimeAgent.h"
+#include "wtf/Optional.h"
namespace blink {
@@ -96,10 +98,14 @@ void InspectorRuntimeAgent::evaluate(ErrorString* errorString,
const Maybe<int>& optExecutionContextId,
const Maybe<bool>& returnByValue,
const Maybe<bool>& generatePreview,
+ const Maybe<bool>& userGesture,
OwnPtr<protocol::Runtime::RemoteObject>* result,
Maybe<bool>* wasThrown,
Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
+ Optional<UserGestureIndicator> userGestureIndicator;
+ if (userGesture.fromMaybe(false))
+ userGestureIndicator.emplace(DefinitelyProcessingNewUserGesture);
int executionContextId;
if (optExecutionContextId.isJust()) {
executionContextId = optExecutionContextId.fromJust();
@@ -110,7 +116,7 @@ void InspectorRuntimeAgent::evaluate(ErrorString* errorString,
MuteConsoleScope<InspectorRuntimeAgent> muteScope;
if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false))
muteScope.enter(this);
- m_v8RuntimeAgent->evaluate(errorString, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, executionContextId, returnByValue, generatePreview, result, wasThrown, exceptionDetails);
+ m_v8RuntimeAgent->evaluate(errorString, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, executionContextId, returnByValue, generatePreview, userGesture, result, wasThrown, exceptionDetails);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data());
}
@@ -121,13 +127,17 @@ void InspectorRuntimeAgent::callFunctionOn(ErrorString* errorString,
const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole,
const Maybe<bool>& returnByValue,
const Maybe<bool>& generatePreview,
+ const Maybe<bool>& userGesture,
OwnPtr<protocol::Runtime::RemoteObject>* result,
Maybe<bool>* wasThrown)
{
+ Optional<UserGestureIndicator> userGestureIndicator;
+ if (userGesture.fromMaybe(false))
+ userGestureIndicator.emplace(DefinitelyProcessingNewUserGesture);
MuteConsoleScope<InspectorRuntimeAgent> muteScope;
if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false))
muteScope.enter(this);
- m_v8RuntimeAgent->callFunctionOn(errorString, objectId, expression, optionalArguments, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, result, wasThrown);
+ m_v8RuntimeAgent->callFunctionOn(errorString, objectId, expression, optionalArguments, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, userGesture, result, wasThrown);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data());
}

Powered by Google App Engine
This is Rietveld 408576698