OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extension_injection_host.h" | 5 #include "extensions/renderer/extension_injection_host.h" |
6 | 6 |
7 #include "content/public/renderer/render_frame.h" | 7 #include "content/public/renderer/render_frame.h" |
8 #include "extensions/common/constants.h" | 8 #include "extensions/common/constants.h" |
9 #include "extensions/common/manifest_handlers/csp_info.h" | 9 #include "extensions/common/manifest_handlers/csp_info.h" |
10 #include "extensions/renderer/renderer_extension_registry.h" | 10 #include "extensions/renderer/renderer_extension_registry.h" |
11 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 11 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
12 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 12 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 ExtensionInjectionHost::ExtensionInjectionHost( | 16 ExtensionInjectionHost::ExtensionInjectionHost( |
17 const Extension* extension) | 17 const Extension* extension) |
18 : InjectionHost(HostID(HostID::EXTENSIONS, extension->id())), | 18 : InjectionHost(HostID(HostID::EXTENSIONS, extension->id())), |
19 extension_(extension) { | 19 extension_(extension) { |
20 } | 20 } |
21 | 21 |
22 ExtensionInjectionHost::~ExtensionInjectionHost() { | 22 ExtensionInjectionHost::~ExtensionInjectionHost() { |
23 } | 23 } |
24 | 24 |
25 // static | 25 // static |
26 scoped_ptr<const InjectionHost> ExtensionInjectionHost::Create( | 26 std::unique_ptr<const InjectionHost> ExtensionInjectionHost::Create( |
27 const std::string& extension_id) { | 27 const std::string& extension_id) { |
28 const Extension* extension = | 28 const Extension* extension = |
29 RendererExtensionRegistry::Get()->GetByID(extension_id); | 29 RendererExtensionRegistry::Get()->GetByID(extension_id); |
30 if (!extension) | 30 if (!extension) |
31 return scoped_ptr<const ExtensionInjectionHost>(); | 31 return std::unique_ptr<const ExtensionInjectionHost>(); |
32 return scoped_ptr<const ExtensionInjectionHost>( | 32 return std::unique_ptr<const ExtensionInjectionHost>( |
33 new ExtensionInjectionHost(extension)); | 33 new ExtensionInjectionHost(extension)); |
34 } | 34 } |
35 | 35 |
36 std::string ExtensionInjectionHost::GetContentSecurityPolicy() const { | 36 std::string ExtensionInjectionHost::GetContentSecurityPolicy() const { |
37 return CSPInfo::GetContentSecurityPolicy(extension_); | 37 return CSPInfo::GetContentSecurityPolicy(extension_); |
38 } | 38 } |
39 | 39 |
40 const GURL& ExtensionInjectionHost::url() const { | 40 const GURL& ExtensionInjectionHost::url() const { |
41 return extension_->url(); | 41 return extension_->url(); |
42 } | 42 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 (tab_id == -1 || render_frame->GetWebFrame()->parent())) { | 79 (tab_id == -1 || render_frame->GetWebFrame()->parent())) { |
80 // Note: we don't consider ACCESS_WITHHELD for child frames or for frames | 80 // Note: we don't consider ACCESS_WITHHELD for child frames or for frames |
81 // outside of tabs because there is nowhere to surface a request. | 81 // outside of tabs because there is nowhere to surface a request. |
82 // TODO(devlin): We should ask for permission somehow. crbug.com/491402. | 82 // TODO(devlin): We should ask for permission somehow. crbug.com/491402. |
83 access = PermissionsData::ACCESS_DENIED; | 83 access = PermissionsData::ACCESS_DENIED; |
84 } | 84 } |
85 return access; | 85 return access; |
86 } | 86 } |
87 | 87 |
88 } // namespace extensions | 88 } // namespace extensions |
OLD | NEW |