| OLD | NEW |
| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "third_party/WebKit/public/web/WebDocument.h" | 26 #include "third_party/WebKit/public/web/WebDocument.h" |
| 27 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 27 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 28 #include "third_party/WebKit/public/web/WebScriptSource.h" | 28 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
| 30 | 30 |
| 31 namespace extensions { | 31 namespace extensions { |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 using IsolatedWorldMap = std::map<std::string, int>; | 35 using IsolatedWorldMap = std::map<std::string, int>; |
| 36 base::LazyInstance<IsolatedWorldMap> g_isolated_worlds = | 36 base::LazyInstance<IsolatedWorldMap>::DestructorAtExit g_isolated_worlds = |
| 37 LAZY_INSTANCE_INITIALIZER; | 37 LAZY_INSTANCE_INITIALIZER; |
| 38 | 38 |
| 39 const int64_t kInvalidRequestId = -1; | 39 const int64_t kInvalidRequestId = -1; |
| 40 | 40 |
| 41 // The id of the next pending injection. | 41 // The id of the next pending injection. |
| 42 int64_t g_next_pending_id = 0; | 42 int64_t g_next_pending_id = 0; |
| 43 | 43 |
| 44 // Gets the isolated world ID to use for the given |injection_host| | 44 // Gets the isolated world ID to use for the given |injection_host| |
| 45 // in the given |frame|. If no isolated world has been created for that | 45 // in the given |frame|. If no isolated world has been created for that |
| 46 // |injection_host| one will be created and initialized. | 46 // |injection_host| one will be created and initialized. |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 void ScriptInjection::InjectCss(std::set<std::string>* injected_stylesheets, | 321 void ScriptInjection::InjectCss(std::set<std::string>* injected_stylesheets, |
| 322 size_t* num_injected_stylesheets) { | 322 size_t* num_injected_stylesheets) { |
| 323 std::vector<blink::WebString> css_sources = injector_->GetCssSources( | 323 std::vector<blink::WebString> css_sources = injector_->GetCssSources( |
| 324 run_location_, injected_stylesheets, num_injected_stylesheets); | 324 run_location_, injected_stylesheets, num_injected_stylesheets); |
| 325 blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame(); | 325 blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame(); |
| 326 for (const blink::WebString& css : css_sources) | 326 for (const blink::WebString& css : css_sources) |
| 327 web_frame->document().insertStyleSheet(css); | 327 web_frame->document().insertStyleSheet(css); |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace extensions | 330 } // namespace extensions |
| OLD | NEW |