Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: extensions/common/permissions/permissions_data.cc

Issue 934753005: Automatically grant permissions to default-installed extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/common/permissions/permissions_data.h" 5 #include "extensions/common/permissions/permissions_data.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/public/common/url_constants.h" 8 #include "content/public/common/url_constants.h"
9 #include "extensions/common/constants.h" 9 #include "extensions/common/constants.h"
10 #include "extensions/common/error_utils.h" 10 #include "extensions/common/error_utils.h"
(...skipping 30 matching lines...) Expand all
41 41
42 PermissionsData::~PermissionsData() { 42 PermissionsData::~PermissionsData() {
43 } 43 }
44 44
45 // static 45 // static
46 void PermissionsData::SetPolicyDelegate(PolicyDelegate* delegate) { 46 void PermissionsData::SetPolicyDelegate(PolicyDelegate* delegate) {
47 g_policy_delegate = delegate; 47 g_policy_delegate = delegate;
48 } 48 }
49 49
50 // static 50 // static
51 bool PermissionsData::CanSilentlyIncreasePermissions(
52 const Extension* extension) {
53 return extension->location() != Manifest::INTERNAL ||
54 extension->creation_flags() & Extension::WAS_INSTALLED_BY_DEFAULT;
55 }
56
57 // static
58 bool PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) { 51 bool PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) {
59 if (extension->location() == Manifest::COMPONENT) 52 if (extension->location() == Manifest::COMPONENT)
60 return true; 53 return true;
61 54
62 const ExtensionsClient::ScriptingWhitelist& whitelist = 55 const ExtensionsClient::ScriptingWhitelist& whitelist =
63 ExtensionsClient::Get()->GetScriptingWhitelist(); 56 ExtensionsClient::Get()->GetScriptingWhitelist();
64 57
65 return std::find(whitelist.begin(), whitelist.end(), extension->id()) != 58 return std::find(whitelist.begin(), whitelist.end(), extension->id()) !=
66 whitelist.end(); 59 whitelist.end();
67 } 60 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 return ACCESS_WITHHELD; 357 return ACCESS_WITHHELD;
365 358
366 if (error) { 359 if (error) {
367 *error = ErrorUtils::FormatErrorMessage(manifest_errors::kCannotAccessPage, 360 *error = ErrorUtils::FormatErrorMessage(manifest_errors::kCannotAccessPage,
368 document_url.spec()); 361 document_url.spec());
369 } 362 }
370 return ACCESS_DENIED; 363 return ACCESS_DENIED;
371 } 364 }
372 365
373 } // namespace extensions 366 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698