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

Side by Side Diff: third_party/WebKit/Source/core/inspector/DevToolsHost.cpp

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Re-add dropped null check Created 4 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 14 matching lines...) Expand all
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "core/inspector/DevToolsHost.h" 30 #include "core/inspector/DevToolsHost.h"
31 31
32 #include "bindings/core/v8/ScriptState.h" 32 #include "bindings/core/v8/ScriptState.h"
33 #include "bindings/core/v8/V8ScriptRunner.h" 33 #include "bindings/core/v8/V8ScriptRunner.h"
34 #include "core/clipboard/Pasteboard.h" 34 #include "core/clipboard/Pasteboard.h"
35 #include "core/dom/DocumentUserGestureToken.h"
35 #include "core/dom/ExecutionContext.h" 36 #include "core/dom/ExecutionContext.h"
36 #include "core/events/Event.h" 37 #include "core/events/Event.h"
37 #include "core/events/EventTarget.h" 38 #include "core/events/EventTarget.h"
38 #include "core/fetch/ResourceFetcher.h" 39 #include "core/fetch/ResourceFetcher.h"
39 #include "core/frame/FrameView.h" 40 #include "core/frame/FrameView.h"
40 #include "core/frame/LocalDOMWindow.h" 41 #include "core/frame/LocalDOMWindow.h"
41 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
42 #include "core/html/parser/TextResourceDecoder.h" 43 #include "core/html/parser/TextResourceDecoder.h"
43 #include "core/inspector/InspectorFrontendClient.h" 44 #include "core/inspector/InspectorFrontendClient.h"
44 #include "core/layout/LayoutTheme.h" 45 #include "core/layout/LayoutTheme.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 void DevToolsHost::evaluateScript(const String& expression) { 127 void DevToolsHost::evaluateScript(const String& expression) {
127 if (ScriptForbiddenScope::isScriptForbidden()) 128 if (ScriptForbiddenScope::isScriptForbidden())
128 return; 129 return;
129 if (!m_frontendFrame) 130 if (!m_frontendFrame)
130 return; 131 return;
131 ScriptState* scriptState = ScriptState::forMainWorld(m_frontendFrame); 132 ScriptState* scriptState = ScriptState::forMainWorld(m_frontendFrame);
132 if (!scriptState) 133 if (!scriptState)
133 return; 134 return;
134 ScriptState::Scope scope(scriptState); 135 ScriptState::Scope scope(scriptState);
135 UserGestureIndicator gestureIndicator(UserGestureToken::create()); 136 UserGestureIndicator gestureIndicator(
137 DocumentUserGestureToken::create(m_frontendFrame->document()));
136 v8::MicrotasksScope microtasks(scriptState->isolate(), 138 v8::MicrotasksScope microtasks(scriptState->isolate(),
137 v8::MicrotasksScope::kRunMicrotasks); 139 v8::MicrotasksScope::kRunMicrotasks);
138 v8::Local<v8::String> source = 140 v8::Local<v8::String> source =
139 v8AtomicString(scriptState->isolate(), expression.utf8().data()); 141 v8AtomicString(scriptState->isolate(), expression.utf8().data());
140 V8ScriptRunner::compileAndRunInternalScript(source, scriptState->isolate(), 142 V8ScriptRunner::compileAndRunInternalScript(source, scriptState->isolate(),
141 String(), TextPosition()); 143 String(), TextPosition());
142 } 144 }
143 145
144 void DevToolsHost::disconnectClient() { 146 void DevToolsHost::disconnectClient() {
145 m_client = 0; 147 m_client = 0;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 226
225 bool DevToolsHost::isUnderTest() { 227 bool DevToolsHost::isUnderTest() {
226 return m_client && m_client->isUnderTest(); 228 return m_client && m_client->isUnderTest();
227 } 229 }
228 230
229 bool DevToolsHost::isHostedMode() { 231 bool DevToolsHost::isHostedMode() {
230 return false; 232 return false;
231 } 233 }
232 234
233 } // namespace blink 235 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698