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

Side by Side Diff: extensions/renderer/script_injection.cc

Issue 2628053003: Remove extension group from DOMWrapperWorld. (Closed)
Patch Set: Fix GCCallbackTest Created 3 years, 11 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/renderer/script_injection.h" 5 #include "extensions/renderer/script_injection.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/timer/elapsed_timer.h" 13 #include "base/timer/elapsed_timer.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "content/public/child/v8_value_converter.h" 15 #include "content/public/child/v8_value_converter.h"
16 #include "content/public/renderer/render_frame.h" 16 #include "content/public/renderer/render_frame.h"
17 #include "extensions/common/extension_messages.h" 17 #include "extensions/common/extension_messages.h"
18 #include "extensions/common/host_id.h" 18 #include "extensions/common/host_id.h"
19 #include "extensions/renderer/dom_activity_logger.h" 19 #include "extensions/renderer/dom_activity_logger.h"
20 #include "extensions/renderer/extension_frame_helper.h" 20 #include "extensions/renderer/extension_frame_helper.h"
21 #include "extensions/renderer/extension_groups.h"
22 #include "extensions/renderer/extensions_renderer_client.h" 21 #include "extensions/renderer/extensions_renderer_client.h"
23 #include "extensions/renderer/script_injection_callback.h" 22 #include "extensions/renderer/script_injection_callback.h"
24 #include "extensions/renderer/scripts_run_info.h" 23 #include "extensions/renderer/scripts_run_info.h"
25 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 24 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
26 #include "third_party/WebKit/public/platform/WebString.h" 25 #include "third_party/WebKit/public/platform/WebString.h"
27 #include "third_party/WebKit/public/web/WebDocument.h" 26 #include "third_party/WebKit/public/web/WebDocument.h"
28 #include "third_party/WebKit/public/web/WebLocalFrame.h" 27 #include "third_party/WebKit/public/web/WebLocalFrame.h"
29 #include "third_party/WebKit/public/web/WebScriptSource.h" 28 #include "third_party/WebKit/public/web/WebScriptSource.h"
30 #include "url/gurl.h" 29 #include "url/gurl.h"
31 30
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 DCHECK_EQ(1u, sources.size()); 270 DCHECK_EQ(1u, sources.size());
272 271
273 web_frame->requestExecuteScriptAndReturnValue(sources.front(), 272 web_frame->requestExecuteScriptAndReturnValue(sources.front(),
274 is_user_gesture, 273 is_user_gesture,
275 callback.release()); 274 callback.release());
276 } else { 275 } else {
277 web_frame->requestExecuteScriptInIsolatedWorld( 276 web_frame->requestExecuteScriptInIsolatedWorld(
278 world_id, 277 world_id,
279 &sources.front(), 278 &sources.front(),
280 sources.size(), 279 sources.size(),
281 EXTENSION_GROUP_CONTENT_SCRIPTS,
282 is_user_gesture, 280 is_user_gesture,
283 callback.release()); 281 callback.release());
284 } 282 }
285 283
286 if (injection_host_->id().type() == HostID::EXTENSIONS) 284 if (injection_host_->id().type() == HostID::EXTENSIONS)
287 UMA_HISTOGRAM_TIMES("Extensions.InjectScriptTime", exec_timer.Elapsed()); 285 UMA_HISTOGRAM_TIMES("Extensions.InjectScriptTime", exec_timer.Elapsed());
288 } 286 }
289 287
290 void ScriptInjection::OnJsInjectionCompleted( 288 void ScriptInjection::OnJsInjectionCompleted(
291 const std::vector<v8::Local<v8::Value>>& results) { 289 const std::vector<v8::Local<v8::Value>>& results) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 void ScriptInjection::InjectCss(std::set<std::string>* injected_stylesheets, 321 void ScriptInjection::InjectCss(std::set<std::string>* injected_stylesheets,
324 size_t* num_injected_stylesheets) { 322 size_t* num_injected_stylesheets) {
325 std::vector<blink::WebString> css_sources = injector_->GetCssSources( 323 std::vector<blink::WebString> css_sources = injector_->GetCssSources(
326 run_location_, injected_stylesheets, num_injected_stylesheets); 324 run_location_, injected_stylesheets, num_injected_stylesheets);
327 blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame(); 325 blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame();
328 for (const blink::WebString& css : css_sources) 326 for (const blink::WebString& css : css_sources)
329 web_frame->document().insertStyleSheet(css); 327 web_frame->document().insertStyleSheet(css);
330 } 328 }
331 329
332 } // namespace extensions 330 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_context_set_unittest.cc ('k') | extensions/renderer/test_extensions_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698