Fix vectorized icon for PPAPI broker website setting icon
[chromium-blink-merge.git] / chrome / renderer / extensions / renderer_permissions_policy_delegate.cc
blob11f92be460d5e188dec56ff689694431cfa9bc44
1 // Copyright 2013 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.
5 #include "chrome/renderer/extensions/renderer_permissions_policy_delegate.h"
7 #include "chrome/common/extensions/extension_constants.h"
8 #include "extensions/common/constants.h"
9 #include "extensions/common/extensions_client.h"
10 #include "extensions/common/manifest_constants.h"
11 #include "extensions/common/switches.h"
12 #include "extensions/renderer/dispatcher.h"
14 namespace extensions {
16 namespace errors = manifest_errors;
18 RendererPermissionsPolicyDelegate::RendererPermissionsPolicyDelegate(
19 Dispatcher* dispatcher) : dispatcher_(dispatcher) {
20 PermissionsData::SetPolicyDelegate(this);
22 RendererPermissionsPolicyDelegate::~RendererPermissionsPolicyDelegate() {
23 PermissionsData::SetPolicyDelegate(NULL);
26 bool RendererPermissionsPolicyDelegate::CanExecuteScriptOnPage(
27 const Extension* extension,
28 const GURL& document_url,
29 int tab_id,
30 int process_id,
31 std::string* error) {
32 if (PermissionsData::CanExecuteScriptEverywhere(extension))
33 return true;
35 if (dispatcher_->IsExtensionActive(kWebStoreAppId)) {
36 if (error)
37 *error = errors::kCannotScriptGallery;
38 return false;
41 return true;
44 } // namespace extensions