| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 const ContentSettingsPattern& pattern, | 152 const ContentSettingsPattern& pattern, |
| 153 ContentSetting setting, | 153 ContentSetting setting, |
| 154 const std::string& provider_name) { | 154 const std::string& provider_name) { |
| 155 DictionaryValue* exception = new DictionaryValue(); | 155 DictionaryValue* exception = new DictionaryValue(); |
| 156 exception->SetString(kSetting, ContentSettingToString(setting)); | 156 exception->SetString(kSetting, ContentSettingToString(setting)); |
| 157 exception->SetString(kOrigin, pattern.ToString()); | 157 exception->SetString(kOrigin, pattern.ToString()); |
| 158 exception->SetString(kSource, provider_name); | 158 exception->SetString(kSource, provider_name); |
| 159 return exception; | 159 return exception; |
| 160 } | 160 } |
| 161 | 161 |
| 162 // Returns true whenever the hosted |app|'s extent enjoys protected storage | |
| 163 // under the current |profile|. | |
| 164 // Must have the AppFilter signature. | |
| 165 bool HasProtectedStorage(const extensions::Extension& app, Profile* profile) { | |
| 166 ExtensionSpecialStoragePolicy* policy = | |
| 167 profile->GetExtensionSpecialStoragePolicy(); | |
| 168 return policy->NeedsProtection(&app); | |
| 169 } | |
| 170 | |
| 171 // Returns true whenever the |extension| is hosted and has |permission|. | 162 // Returns true whenever the |extension| is hosted and has |permission|. |
| 172 // Must have the AppFilter signature. | 163 // Must have the AppFilter signature. |
| 173 template <APIPermission::ID permission> | 164 template <APIPermission::ID permission> |
| 174 bool HostedAppHasPermission( | 165 bool HostedAppHasPermission( |
| 175 const extensions::Extension& extension, Profile* /*profile*/) { | 166 const extensions::Extension& extension, Profile* /*profile*/) { |
| 176 return extension.is_hosted_app() && extension.HasAPIPermission(permission); | 167 return extension.is_hosted_app() && extension.HasAPIPermission(permission); |
| 177 } | 168 } |
| 178 | 169 |
| 179 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from | 170 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from |
| 180 // the web extent of a hosted |app|. | 171 // the web extent of a hosted |app|. |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { | 1315 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { |
| 1325 if (type == kExContentSettingsTypeGroupNames[i].type) | 1316 if (type == kExContentSettingsTypeGroupNames[i].type) |
| 1326 return kExContentSettingsTypeGroupNames[i].name; | 1317 return kExContentSettingsTypeGroupNames[i].name; |
| 1327 } | 1318 } |
| 1328 | 1319 |
| 1329 NOTREACHED(); | 1320 NOTREACHED(); |
| 1330 return std::string(); | 1321 return std::string(); |
| 1331 } | 1322 } |
| 1332 | 1323 |
| 1333 } // namespace options | 1324 } // namespace options |
| OLD | NEW |