Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "extensions/common/manifest_handlers/csp_info.h" | |
| 6 #include "extensions/renderer/extension_consumer.h" | |
| 7 | |
| 8 namespace extensions { | |
| 9 | |
| 10 ExtensionConsumer::ExtensionConsumer( | |
| 11 const scoped_refptr<const Extension>& extension, const HostID& host_id) | |
| 12 : Host(host_id), | |
| 13 extension_(extension) { | |
| 14 } | |
| 15 | |
| 16 ExtensionConsumer::~ExtensionConsumer() { | |
| 17 } | |
| 18 | |
| 19 const std::string& ExtensionConsumer::GetContentSecurityPolicy() const { | |
| 20 return CSPInfo::GetContentSecurityPolicy(extension_.get()); | |
| 21 } | |
| 22 | |
| 23 const GURL& ExtensionConsumer::url() const { | |
| 24 DCHECK(extension_.get()); | |
|
Devlin
2015/02/09 17:40:24
Probably better to just move the DCHECK into the c
Xi Han
2015/02/09 23:28:11
Done.
| |
| 25 return extension_->url(); | |
| 26 } | |
| 27 | |
| 28 const std::string ExtensionConsumer::name() const { | |
| 29 DCHECK(extension_.get()); | |
| 30 return extension_->name(); | |
| 31 } | |
| 32 | |
| 33 PermissionsData::AccessType ExtensionConsumer::CanExecuteOnFrame( | |
| 34 const GURL& document_url, | |
| 35 const GURL& top_frame_url, | |
| 36 int tab_id, | |
| 37 bool is_declarative) const { | |
| 38 // Declarative user scripts use "page access" (from "permissions" section in | |
| 39 // manifest) whereas non-declarative user scripts use custom | |
| 40 // "content script access" logic. | |
| 41 if (is_declarative) { | |
| 42 return extension_->permissions_data()->GetPageAccess( | |
| 43 extension_.get(), | |
| 44 document_url, | |
| 45 top_frame_url, | |
| 46 tab_id, | |
| 47 -1, // no process id | |
| 48 NULL /* ignore error */); | |
|
Devlin
2015/02/09 17:40:24
nit: prefer nullptr.
Xi Han
2015/02/09 23:28:11
Done.
| |
| 49 } else { | |
| 50 return extension_->permissions_data()->GetContentScriptAccess( | |
| 51 extension_.get(), | |
| 52 document_url, | |
| 53 top_frame_url, | |
| 54 tab_id, | |
| 55 -1, // no process id | |
| 56 NULL /* ignore error */); | |
| 57 } | |
| 58 } | |
| 59 | |
| 60 } // namespace extensions | |
| OLD | NEW |