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

Unified Diff: chrome/renderer/extensions/user_script_slave.cc

Issue 234413005: Move most of ChromeV8Context to a base ScriptContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: factor feature_channel out of module_system Created 6 years, 8 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
« no previous file with comments | « chrome/renderer/extensions/user_script_slave.h ('k') | chrome/renderer/extensions/utils_native_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/user_script_slave.cc
diff --git a/chrome/renderer/extensions/user_script_slave.cc b/chrome/renderer/extensions/user_script_slave.cc
index bdaff10bb86692bbe69c3f3e69cadc438f90067c..249b439c68a1e589b500ae9f4c1c40232f3a3637 100644
--- a/chrome/renderer/extensions/user_script_slave.cc
+++ b/chrome/renderer/extensions/user_script_slave.cc
@@ -25,10 +25,10 @@
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_handlers/csp_info.h"
#include "extensions/common/permissions/permissions_data.h"
+#include "extensions/renderer/script_context.h"
#include "grit/renderer_resources.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/platform/WebVector.h"
-#include "third_party/WebKit/public/web/WebDataSource.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
@@ -179,24 +179,9 @@ bool UserScriptSlave::UpdateScripts(base::SharedMemoryHandle shared_memory) {
return true;
}
-GURL UserScriptSlave::GetDataSourceURLForFrame(const WebFrame* frame) {
- // Normally we would use frame->document().url() to determine the document's
- // URL, but to decide whether to inject a content script, we use the URL from
- // the data source. This "quirk" helps prevents content scripts from
- // inadvertently adding DOM elements to the compose iframe in Gmail because
- // the compose iframe's dataSource URL is about:blank, but the document URL
- // changes to match the parent document after Gmail document.writes into
- // it to create the editor.
- // http://code.google.com/p/chromium/issues/detail?id=86742
- blink::WebDataSource* data_source = frame->provisionalDataSource() ?
- frame->provisionalDataSource() : frame->dataSource();
- CHECK(data_source);
- return GURL(data_source->request().url());
-}
-
void UserScriptSlave::InjectScripts(WebFrame* frame,
UserScript::RunLocation location) {
- GURL data_source_url = GetDataSourceURLForFrame(frame);
+ GURL data_source_url = ScriptContext::GetDataSourceURLForFrame(frame);
if (data_source_url.is_empty())
return;
@@ -302,7 +287,7 @@ void UserScriptSlave::InjectScripts(WebFrame* frame,
render_view->GetRoutingID(),
extensions_executing_scripts,
render_view->GetPageId(),
- GetDataSourceURLForFrame(top_frame)));
+ ScriptContext::GetDataSourceURLForFrame(top_frame)));
}
// Log debug info.
« no previous file with comments | « chrome/renderer/extensions/user_script_slave.h ('k') | chrome/renderer/extensions/utils_native_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698