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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_store.cc

Issue 2423003002: Delete fullscreen/mouselock pref data associated with extensions. (Closed)
Patch Set: Fix confusing wording. Created 4 years, 2 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/extensions/api/content_settings/content_settings_store_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) 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/extensions/api/content_settings/content_settings_store. h" 5 #include "chrome/browser/extensions/api/content_settings/content_settings_store. h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 base::AutoLock lock(lock_); 109 base::AutoLock lock(lock_);
110 OriginIdentifierValueMap* map = GetValueMap(ext_id, scope); 110 OriginIdentifierValueMap* map = GetValueMap(ext_id, scope);
111 if (setting == CONTENT_SETTING_DEFAULT) { 111 if (setting == CONTENT_SETTING_DEFAULT) {
112 map->DeleteValue(primary_pattern, secondary_pattern, type, identifier); 112 map->DeleteValue(primary_pattern, secondary_pattern, type, identifier);
113 } else { 113 } else {
114 map->SetValue(primary_pattern, secondary_pattern, type, identifier, 114 map->SetValue(primary_pattern, secondary_pattern, type, identifier,
115 new base::FundamentalValue(setting)); 115 new base::FundamentalValue(setting));
116 } 116 }
117 } 117 }
118 118
119 // Send notification that content settings changed. 119 // Send notification that content settings changed. (Note: This is responsible
120 // TODO(markusheintz): Notifications should only be sent if the set content 120 // for updating the pref store, so cannot be skipped even if the setting would
121 // setting is effective and not hidden by another setting of another 121 // be masked by another extension.)
122 // extension installed more recently.
123 NotifyOfContentSettingChanged(ext_id, 122 NotifyOfContentSettingChanged(ext_id,
124 scope != kExtensionPrefsScopeRegular); 123 scope != kExtensionPrefsScopeRegular);
125 } 124 }
126 125
127 void ContentSettingsStore::RegisterExtension( 126 void ContentSettingsStore::RegisterExtension(
128 const std::string& ext_id, 127 const std::string& ext_id,
129 const base::Time& install_time, 128 const base::Time& install_time,
130 bool is_enabled) { 129 bool is_enabled) {
131 base::AutoLock lock(lock_); 130 base::AutoLock lock(lock_);
132 ExtensionEntryMap::iterator i = FindEntry(ext_id); 131 ExtensionEntryMap::iterator i = FindEntry(ext_id);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 std::string secondary_pattern_str; 312 std::string secondary_pattern_str;
314 dict->GetString(keys::kSecondaryPatternKey, &secondary_pattern_str); 313 dict->GetString(keys::kSecondaryPatternKey, &secondary_pattern_str);
315 ContentSettingsPattern secondary_pattern = 314 ContentSettingsPattern secondary_pattern =
316 ContentSettingsPattern::FromString(secondary_pattern_str); 315 ContentSettingsPattern::FromString(secondary_pattern_str);
317 DCHECK(secondary_pattern.IsValid()); 316 DCHECK(secondary_pattern.IsValid());
318 317
319 std::string content_settings_type_str; 318 std::string content_settings_type_str;
320 dict->GetString(keys::kContentSettingsTypeKey, &content_settings_type_str); 319 dict->GetString(keys::kContentSettingsTypeKey, &content_settings_type_str);
321 ContentSettingsType content_settings_type = 320 ContentSettingsType content_settings_type =
322 helpers::StringToContentSettingsType(content_settings_type_str); 321 helpers::StringToContentSettingsType(content_settings_type_str);
322 if (content_settings_type == CONTENT_SETTINGS_TYPE_FULLSCREEN ||
323 content_settings_type == CONTENT_SETTINGS_TYPE_MOUSELOCK) {
324 // Fullscreen and mouselock are deprecated. Skip over settings of these
325 // types, effectively deleting them from the in-memory model. This will
326 // implicitly delete these old settings from the pref store when it is
327 // written back.
328 continue;
329 }
323 DCHECK_NE(CONTENT_SETTINGS_TYPE_DEFAULT, content_settings_type); 330 DCHECK_NE(CONTENT_SETTINGS_TYPE_DEFAULT, content_settings_type);
324 331
325 std::string resource_identifier; 332 std::string resource_identifier;
326 dict->GetString(keys::kResourceIdentifierKey, &resource_identifier); 333 dict->GetString(keys::kResourceIdentifierKey, &resource_identifier);
327 334
328 std::string content_setting_string; 335 std::string content_setting_string;
329 dict->GetString(keys::kContentSettingKey, &content_setting_string); 336 dict->GetString(keys::kContentSettingKey, &content_setting_string);
330 ContentSetting setting; 337 ContentSetting setting;
331 bool result = content_settings::ContentSettingFromString( 338 bool result = content_settings::ContentSettingFromString(
332 content_setting_string, &setting); 339 content_setting_string, &setting);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 ContentSettingsStore::FindEntry(const std::string& ext_id) const { 388 ContentSettingsStore::FindEntry(const std::string& ext_id) const {
382 ExtensionEntryMap::const_iterator i; 389 ExtensionEntryMap::const_iterator i;
383 for (i = entries_.begin(); i != entries_.end(); ++i) { 390 for (i = entries_.begin(); i != entries_.end(); ++i) {
384 if (i->second->id == ext_id) 391 if (i->second->id == ext_id)
385 return i; 392 return i;
386 } 393 }
387 return entries_.end(); 394 return entries_.end();
388 } 395 }
389 396
390 } // namespace extensions 397 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698