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

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.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 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 if (!m_element->document().contentSecurityPolicy()->allowJavaScriptURLs( 469 if (!m_element->document().contentSecurityPolicy()->allowJavaScriptURLs(
470 m_element->document().url(), OrdinalNumber())) 470 m_element->document().url(), OrdinalNumber()))
471 return WebString(); 471 return WebString();
472 472
473 const KURL& kurl = url; 473 const KURL& kurl = url;
474 DCHECK(kurl.protocolIs("javascript")); 474 DCHECK(kurl.protocolIs("javascript"));
475 475
476 String script = decodeURLEscapeSequences( 476 String script = decodeURLEscapeSequences(
477 kurl.getString().substring(strlen("javascript:"))); 477 kurl.getString().substring(strlen("javascript:")));
478 478
479 UserGestureIndicator gestureIndicator(popupsAllowed 479 UserGestureIndicator gestureIndicator(
480 ? DefinitelyProcessingNewUserGesture 480 popupsAllowed ? UserGestureToken::create(UserGestureToken::NewGesture)
481 : PossiblyProcessingUserGesture); 481 : nullptr);
482 v8::HandleScope handleScope(toIsolate(frame)); 482 v8::HandleScope handleScope(toIsolate(frame));
483 v8::Local<v8::Value> result = 483 v8::Local<v8::Value> result =
484 frame->script().executeScriptInMainWorldAndReturnValue( 484 frame->script().executeScriptInMainWorldAndReturnValue(
485 ScriptSourceCode(script)); 485 ScriptSourceCode(script));
486 486
487 // Failure is reported as a null string. 487 // Failure is reported as a null string.
488 if (result.IsEmpty() || !result->IsString()) 488 if (result.IsEmpty() || !result->IsString())
489 return WebString(); 489 return WebString();
490 return toCoreString(v8::Local<v8::String>::Cast(result)); 490 return toCoreString(v8::Local<v8::String>::Cast(result));
491 } 491 }
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 // frame view. 970 // frame view.
971 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); 971 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect);
972 } 972 }
973 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 973 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
974 // Convert to the plugin position. 974 // Convert to the plugin position.
975 for (size_t i = 0; i < cutOutRects.size(); i++) 975 for (size_t i = 0; i < cutOutRects.size(); i++)
976 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 976 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
977 } 977 }
978 978
979 } // namespace blink 979 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | third_party/WebKit/Source/web/WebScopedUserGesture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698