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 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 } | 77 } |
78 | 78 |
79 // We need to set the isolated world origin and CSP even if it's not a new | 79 // We need to set the isolated world origin and CSP even if it's not a new |
80 // world since these are stored per frame, and we might not have used this | 80 // world since these are stored per frame, and we might not have used this |
81 // isolated world in this frame before. | 81 // isolated world in this frame before. |
82 frame->setIsolatedWorldSecurityOrigin( | 82 frame->setIsolatedWorldSecurityOrigin( |
83 id, blink::WebSecurityOrigin::create(extension->url())); | 83 id, blink::WebSecurityOrigin::create(extension->url())); |
84 frame->setIsolatedWorldContentSecurityPolicy( | 84 frame->setIsolatedWorldContentSecurityPolicy( |
85 id, | 85 id, |
86 blink::WebString::fromUTF8(CSPInfo::GetContentSecurityPolicy(extension))); | 86 blink::WebString::fromUTF8(CSPInfo::GetContentSecurityPolicy(extension))); |
87 frame->setIsolatedWorldHumanReadableName( | |
yurys
2014/08/25 09:25:52
Should it be added to translate_helper.cc as well?
lushnikov
2014/08/30 18:19:00
The translate extension already has readable origi
| |
88 id, | |
89 blink::WebString::fromUTF8(extension->name())); | |
87 | 90 |
88 return id; | 91 return id; |
89 } | 92 } |
90 | 93 |
91 } // namespace | 94 } // namespace |
92 | 95 |
93 // static | 96 // static |
94 std::string ScriptInjection::GetExtensionIdForIsolatedWorld( | 97 std::string ScriptInjection::GetExtensionIdForIsolatedWorld( |
95 int isolated_world_id) { | 98 int isolated_world_id) { |
96 IsolatedWorldMap& isolated_worlds = g_isolated_worlds.Get(); | 99 IsolatedWorldMap& isolated_worlds = g_isolated_worlds.Get(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 std::vector<std::string> css_sources = | 311 std::vector<std::string> css_sources = |
309 injector_->GetCssSources(run_location_); | 312 injector_->GetCssSources(run_location_); |
310 for (std::vector<std::string>::const_iterator iter = css_sources.begin(); | 313 for (std::vector<std::string>::const_iterator iter = css_sources.begin(); |
311 iter != css_sources.end(); | 314 iter != css_sources.end(); |
312 ++iter) { | 315 ++iter) { |
313 frame->document().insertStyleSheet(blink::WebString::fromUTF8(*iter)); | 316 frame->document().insertStyleSheet(blink::WebString::fromUTF8(*iter)); |
314 } | 317 } |
315 } | 318 } |
316 | 319 |
317 } // namespace extensions | 320 } // namespace extensions |
OLD | NEW |