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

Side by Side Diff: extensions/browser/admin_policy.cc

Issue 299853002: Make installed_loader UMA less wasteful. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/browser/admin_policy.h" 5 #include "extensions/browser/admin_policy.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "extensions/common/extension.h" 8 #include "extensions/common/extension.h"
9 #include "extensions/common/manifest.h" 9 #include "extensions/common/manifest.h"
10 #include "grit/extensions_strings.h" 10 #include "grit/extensions_strings.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // kExtensionAllowedTypesMap in configuration_policy_handler_list.cc. 86 // kExtensionAllowedTypesMap in configuration_policy_handler_list.cc.
87 switch (extension->GetType()) { 87 switch (extension->GetType()) {
88 case Manifest::TYPE_UNKNOWN: 88 case Manifest::TYPE_UNKNOWN:
89 break; 89 break;
90 case Manifest::TYPE_EXTENSION: 90 case Manifest::TYPE_EXTENSION:
91 case Manifest::TYPE_THEME: 91 case Manifest::TYPE_THEME:
92 case Manifest::TYPE_USER_SCRIPT: 92 case Manifest::TYPE_USER_SCRIPT:
93 case Manifest::TYPE_HOSTED_APP: 93 case Manifest::TYPE_HOSTED_APP:
94 case Manifest::TYPE_LEGACY_PACKAGED_APP: 94 case Manifest::TYPE_LEGACY_PACKAGED_APP:
95 case Manifest::TYPE_PLATFORM_APP: 95 case Manifest::TYPE_PLATFORM_APP:
96 case Manifest::TYPE_SHARED_MODULE: 96 case Manifest::TYPE_SHARED_MODULE: {
97 base::FundamentalValue type_value(extension->GetType()); 97 base::FundamentalValue type_value(extension->GetType());
98 if (allowed_types && 98 if (allowed_types &&
99 allowed_types->Find(type_value) == allowed_types->end()) 99 allowed_types->Find(type_value) == allowed_types->end())
100 return ReturnLoadError(extension, error); 100 return ReturnLoadError(extension, error);
101 break; 101 break;
Devlin 2014/05/21 19:54:09 Hey, this break statement actually does something
102 }
103 case Manifest::NUM_LOAD_TYPES:
104 NOTREACHED();
102 } 105 }
103 106
104 // Check the whitelist/forcelist first. 107 // Check the whitelist/forcelist first.
105 base::StringValue id_value(extension->id()); 108 base::StringValue id_value(extension->id());
106 if ((whitelist && whitelist->Find(id_value) != whitelist->end()) || 109 if ((whitelist && whitelist->Find(id_value) != whitelist->end()) ||
107 (forcelist && forcelist->HasKey(extension->id()))) 110 (forcelist && forcelist->HasKey(extension->id())))
108 return true; 111 return true;
109 112
110 // Then check the admin blacklist. 113 // Then check the admin blacklist.
111 if ((blacklist && blacklist->Find(id_value) != blacklist->end()) || 114 if ((blacklist && blacklist->Find(id_value) != blacklist->end()) ||
112 BlacklistedByDefault(blacklist)) 115 BlacklistedByDefault(blacklist))
113 return ReturnLoadError(extension, error); 116 return ReturnLoadError(extension, error);
114 117
115 return true; 118 return true;
116 } 119 }
117 120
118 bool UserMayModifySettings(const Extension* extension, base::string16* error) { 121 bool UserMayModifySettings(const Extension* extension, base::string16* error) {
119 return ManagementPolicyImpl(extension, error, true); 122 return ManagementPolicyImpl(extension, error, true);
120 } 123 }
121 124
122 bool MustRemainEnabled(const Extension* extension, base::string16* error) { 125 bool MustRemainEnabled(const Extension* extension, base::string16* error) {
123 return ManagementPolicyImpl(extension, error, false); 126 return ManagementPolicyImpl(extension, error, false);
124 } 127 }
125 128
126 } // namespace admin_policy 129 } // namespace admin_policy
127 } // namespace extensions 130 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698