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

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

Issue 2401123002: UserGestureIndicator is a mess. Clean it up. (Closed)
Patch Set: Callback cleanup, 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 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 Document* ownerDocument(frame()->document()); 1853 Document* ownerDocument(frame()->document());
1854 1854
1855 // Protect privileged pages against bookmarklets and other javascript 1855 // Protect privileged pages against bookmarklets and other javascript
1856 // manipulations. 1856 // manipulations.
1857 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs( 1857 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(
1858 frame()->document()->url().protocol())) 1858 frame()->document()->url().protocol()))
1859 return; 1859 return;
1860 1860
1861 String script = decodeURLEscapeSequences( 1861 String script = decodeURLEscapeSequences(
1862 url.getString().substring(strlen("javascript:"))); 1862 url.getString().substring(strlen("javascript:")));
1863 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); 1863 UserGestureIndicator gestureIndicator(
1864 UserGestureToken::create(UserGestureToken::NewGesture));
1864 v8::HandleScope handleScope(toIsolate(frame())); 1865 v8::HandleScope handleScope(toIsolate(frame()));
1865 v8::Local<v8::Value> result = 1866 v8::Local<v8::Value> result =
1866 frame()->script().executeScriptInMainWorldAndReturnValue( 1867 frame()->script().executeScriptInMainWorldAndReturnValue(
1867 ScriptSourceCode(script)); 1868 ScriptSourceCode(script));
1868 if (result.IsEmpty() || !result->IsString()) 1869 if (result.IsEmpty() || !result->IsString())
1869 return; 1870 return;
1870 String scriptResult = toCoreString(v8::Local<v8::String>::Cast(result)); 1871 String scriptResult = toCoreString(v8::Local<v8::String>::Cast(result));
1871 if (!frame()->navigationScheduler().locationChangePending()) 1872 if (!frame()->navigationScheduler().locationChangePending())
1872 frame()->loader().replaceDocumentWhileExecutingJavaScriptURL(scriptResult, 1873 frame()->loader().replaceDocumentWhileExecutingJavaScriptURL(scriptResult,
1873 ownerDocument); 1874 ownerDocument);
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol; 2341 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol;
2341 } else if (metric == "wasAlternateProtocolAvailable") { 2342 } else if (metric == "wasAlternateProtocolAvailable") {
2342 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable; 2343 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable;
2343 } else if (metric == "connectionInfo") { 2344 } else if (metric == "connectionInfo") {
2344 feature = UseCounter::ChromeLoadTimesConnectionInfo; 2345 feature = UseCounter::ChromeLoadTimesConnectionInfo;
2345 } 2346 }
2346 UseCounter::count(frame(), feature); 2347 UseCounter::count(frame(), feature);
2347 } 2348 }
2348 2349
2349 } // namespace blink 2350 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp ('k') | third_party/WebKit/Source/web/WebPluginContainerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698