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

Side by Side Diff: chrome/browser/content_settings/content_settings_internal_extension_provider.cc

Issue 2853983002: Ensure settings returned from Content Settings providers are valid (Closed)
Patch Set: Ensure settings returned from Content Settings providers are valid Created 3 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_policy_provider_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/content_settings/content_settings_internal_extension_pr ovider.h" 5 #include "chrome/browser/content_settings/content_settings_internal_extension_pr ovider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/browser/pdf/pdf_extension_util.h" 10 #include "chrome/browser/pdf/pdf_extension_util.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/chrome_content_client.h" 12 #include "chrome/common/chrome_content_client.h"
13 #include "components/content_settings/core/browser/content_settings_info.h"
14 #include "components/content_settings/core/browser/content_settings_registry.h"
13 #include "components/content_settings/core/browser/content_settings_rule.h" 15 #include "components/content_settings/core/browser/content_settings_rule.h"
14 #include "components/content_settings/core/common/content_settings.h" 16 #include "components/content_settings/core/common/content_settings.h"
15 #include "components/content_settings/core/common/content_settings_pattern.h" 17 #include "components/content_settings/core/common/content_settings_pattern.h"
16 #include "content/public/browser/notification_details.h" 18 #include "content/public/browser/notification_details.h"
17 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
18 #include "extensions/browser/extension_host.h" 20 #include "extensions/browser/extension_host.h"
19 #include "extensions/browser/extension_registry.h" 21 #include "extensions/browser/extension_registry.h"
20 #include "extensions/browser/notification_types.h" 22 #include "extensions/browser/notification_types.h"
21 #include "extensions/common/constants.h" 23 #include "extensions/common/constants.h"
22 #include "extensions/common/extension.h" 24 #include "extensions/common/extension.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 ContentSettingsPattern primary_pattern = pattern_builder->Build(); 204 ContentSettingsPattern primary_pattern = pattern_builder->Build();
203 ContentSettingsPattern secondary_pattern = ContentSettingsPattern::Wildcard(); 205 ContentSettingsPattern secondary_pattern = ContentSettingsPattern::Wildcard();
204 { 206 {
205 base::AutoLock lock(lock_); 207 base::AutoLock lock(lock_);
206 if (setting == CONTENT_SETTING_DEFAULT) { 208 if (setting == CONTENT_SETTING_DEFAULT) {
207 value_map_.DeleteValue(primary_pattern, 209 value_map_.DeleteValue(primary_pattern,
208 secondary_pattern, 210 secondary_pattern,
209 CONTENT_SETTINGS_TYPE_PLUGINS, 211 CONTENT_SETTINGS_TYPE_PLUGINS,
210 resource); 212 resource);
211 } else { 213 } else {
214 DCHECK(content_settings::ContentSettingsRegistry::GetInstance()
215 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS)
216 ->IsSettingValid(setting));
212 // Do not set a timestamp for extension settings. 217 // Do not set a timestamp for extension settings.
213 value_map_.SetValue(primary_pattern, secondary_pattern, 218 value_map_.SetValue(primary_pattern, secondary_pattern,
214 CONTENT_SETTINGS_TYPE_PLUGINS, resource, base::Time(), 219 CONTENT_SETTINGS_TYPE_PLUGINS, resource, base::Time(),
215 new base::Value(setting)); 220 new base::Value(setting));
216 } 221 }
217 } 222 }
218 NotifyObservers(primary_pattern, 223 NotifyObservers(primary_pattern,
219 secondary_pattern, 224 secondary_pattern,
220 CONTENT_SETTINGS_TYPE_PLUGINS, 225 CONTENT_SETTINGS_TYPE_PLUGINS,
221 resource); 226 resource);
222 } 227 }
223 228
224 } // namespace content_settings 229 } // namespace content_settings
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_policy_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698