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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Address comments Created 4 years, 2 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 93 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
94 #include "bindings/core/v8/ScriptController.h" 94 #include "bindings/core/v8/ScriptController.h"
95 #include "bindings/core/v8/ScriptSourceCode.h" 95 #include "bindings/core/v8/ScriptSourceCode.h"
96 #include "bindings/core/v8/ScriptValue.h" 96 #include "bindings/core/v8/ScriptValue.h"
97 #include "bindings/core/v8/SourceLocation.h" 97 #include "bindings/core/v8/SourceLocation.h"
98 #include "bindings/core/v8/V8Binding.h" 98 #include "bindings/core/v8/V8Binding.h"
99 #include "bindings/core/v8/V8GCController.h" 99 #include "bindings/core/v8/V8GCController.h"
100 #include "bindings/core/v8/V8PerIsolateData.h" 100 #include "bindings/core/v8/V8PerIsolateData.h"
101 #include "core/HTMLNames.h" 101 #include "core/HTMLNames.h"
102 #include "core/dom/Document.h" 102 #include "core/dom/Document.h"
103 #include "core/dom/DocumentUserGestureToken.h"
103 #include "core/dom/IconURL.h" 104 #include "core/dom/IconURL.h"
104 #include "core/dom/MessagePort.h" 105 #include "core/dom/MessagePort.h"
105 #include "core/dom/Node.h" 106 #include "core/dom/Node.h"
106 #include "core/dom/NodeTraversal.h" 107 #include "core/dom/NodeTraversal.h"
107 #include "core/dom/SuspendableTask.h" 108 #include "core/dom/SuspendableTask.h"
108 #include "core/dom/shadow/ShadowRoot.h" 109 #include "core/dom/shadow/ShadowRoot.h"
109 #include "core/editing/EditingUtilities.h" 110 #include "core/editing/EditingUtilities.h"
110 #include "core/editing/Editor.h" 111 #include "core/editing/Editor.h"
111 #include "core/editing/FrameSelection.h" 112 #include "core/editing/FrameSelection.h"
112 #include "core/editing/InputMethodController.h" 113 #include "core/editing/InputMethodController.h"
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 Document* ownerDocument(frame()->document()); 1888 Document* ownerDocument(frame()->document());
1888 1889
1889 // Protect privileged pages against bookmarklets and other javascript 1890 // Protect privileged pages against bookmarklets and other javascript
1890 // manipulations. 1891 // manipulations.
1891 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs( 1892 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(
1892 frame()->document()->url().protocol())) 1893 frame()->document()->url().protocol()))
1893 return; 1894 return;
1894 1895
1895 String script = decodeURLEscapeSequences( 1896 String script = decodeURLEscapeSequences(
1896 url.getString().substring(strlen("javascript:"))); 1897 url.getString().substring(strlen("javascript:")));
1897 UserGestureIndicator gestureIndicator( 1898 UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create(
1898 UserGestureToken::create(UserGestureToken::NewGesture)); 1899 frame()->document(), UserGestureToken::NewGesture));
1899 v8::HandleScope handleScope(toIsolate(frame())); 1900 v8::HandleScope handleScope(toIsolate(frame()));
1900 v8::Local<v8::Value> result = 1901 v8::Local<v8::Value> result =
1901 frame()->script().executeScriptInMainWorldAndReturnValue( 1902 frame()->script().executeScriptInMainWorldAndReturnValue(
1902 ScriptSourceCode(script)); 1903 ScriptSourceCode(script));
1903 if (result.IsEmpty() || !result->IsString()) 1904 if (result.IsEmpty() || !result->IsString())
1904 return; 1905 return;
1905 String scriptResult = toCoreString(v8::Local<v8::String>::Cast(result)); 1906 String scriptResult = toCoreString(v8::Local<v8::String>::Cast(result));
1906 if (!frame()->navigationScheduler().locationChangePending()) 1907 if (!frame()->navigationScheduler().locationChangePending())
1907 frame()->loader().replaceDocumentWhileExecutingJavaScriptURL(scriptResult, 1908 frame()->loader().replaceDocumentWhileExecutingJavaScriptURL(scriptResult,
1908 ownerDocument); 1909 ownerDocument);
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol; 2382 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol;
2382 } else if (metric == "wasAlternateProtocolAvailable") { 2383 } else if (metric == "wasAlternateProtocolAvailable") {
2383 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable; 2384 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable;
2384 } else if (metric == "connectionInfo") { 2385 } else if (metric == "connectionInfo") {
2385 feature = UseCounter::ChromeLoadTimesConnectionInfo; 2386 feature = UseCounter::ChromeLoadTimesConnectionInfo;
2386 } 2387 }
2387 UseCounter::count(frame(), feature); 2388 UseCounter::count(frame(), feature);
2388 } 2389 }
2389 2390
2390 } // namespace blink 2391 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698