| 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/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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 std::string secondary_pattern_str; | 312 std::string secondary_pattern_str; |
| 313 dict->GetString(keys::kSecondaryPatternKey, &secondary_pattern_str); | 313 dict->GetString(keys::kSecondaryPatternKey, &secondary_pattern_str); |
| 314 ContentSettingsPattern secondary_pattern = | 314 ContentSettingsPattern secondary_pattern = |
| 315 ContentSettingsPattern::FromString(secondary_pattern_str); | 315 ContentSettingsPattern::FromString(secondary_pattern_str); |
| 316 DCHECK(secondary_pattern.IsValid()); | 316 DCHECK(secondary_pattern.IsValid()); |
| 317 | 317 |
| 318 std::string content_settings_type_str; | 318 std::string content_settings_type_str; |
| 319 dict->GetString(keys::kContentSettingsTypeKey, &content_settings_type_str); | 319 dict->GetString(keys::kContentSettingsTypeKey, &content_settings_type_str); |
| 320 ContentSettingsType content_settings_type = | 320 ContentSettingsType content_settings_type = |
| 321 helpers::StringToContentSettingsType(content_settings_type_str); | 321 helpers::StringToContentSettingsType(content_settings_type_str); |
| 322 if (content_settings_type == CONTENT_SETTINGS_TYPE_FULLSCREEN || | 322 if (content_settings_type == CONTENT_SETTINGS_TYPE_DEFAULT) { |
| 323 content_settings_type == CONTENT_SETTINGS_TYPE_MOUSELOCK) { | 323 // We'll end up with DEFAULT here if the type string isn't recognised. |
| 324 // Fullscreen and mouselock are deprecated. Skip over settings of these | 324 // This could be if it's a string from an old settings type that has been |
| 325 // types, effectively deleting them from the in-memory model. This will | 325 // deleted. DCHECK to make sure this is the case (not some random string). |
| 326 // implicitly delete these old settings from the pref store when it is | 326 DCHECK(content_settings_type_str == "fullscreen" || |
| 327 // written back. | 327 content_settings_type_str == "mouselock"); |
| 328 |
| 329 // In this case, we just skip over that setting, effectively deleting it |
| 330 // from the in-memory model. This will implicitly delete these old |
| 331 // settings from the pref store when it is written back. |
| 328 continue; | 332 continue; |
| 329 } | 333 } |
| 330 DCHECK_NE(CONTENT_SETTINGS_TYPE_DEFAULT, content_settings_type); | |
| 331 | 334 |
| 332 std::string resource_identifier; | 335 std::string resource_identifier; |
| 333 dict->GetString(keys::kResourceIdentifierKey, &resource_identifier); | 336 dict->GetString(keys::kResourceIdentifierKey, &resource_identifier); |
| 334 | 337 |
| 335 std::string content_setting_string; | 338 std::string content_setting_string; |
| 336 dict->GetString(keys::kContentSettingKey, &content_setting_string); | 339 dict->GetString(keys::kContentSettingKey, &content_setting_string); |
| 337 ContentSetting setting; | 340 ContentSetting setting; |
| 338 bool result = content_settings::ContentSettingFromString( | 341 bool result = content_settings::ContentSettingFromString( |
| 339 content_setting_string, &setting); | 342 content_setting_string, &setting); |
| 340 DCHECK(result); | 343 DCHECK(result); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 ContentSettingsStore::FindEntry(const std::string& ext_id) const { | 389 ContentSettingsStore::FindEntry(const std::string& ext_id) const { |
| 387 ExtensionEntryMap::const_iterator i; | 390 ExtensionEntryMap::const_iterator i; |
| 388 for (i = entries_.begin(); i != entries_.end(); ++i) { | 391 for (i = entries_.begin(); i != entries_.end(); ++i) { |
| 389 if (i->second->id == ext_id) | 392 if (i->second->id == ext_id) |
| 390 return i; | 393 return i; |
| 391 } | 394 } |
| 392 return entries_.end(); | 395 return entries_.end(); |
| 393 } | 396 } |
| 394 | 397 |
| 395 } // namespace extensions | 398 } // namespace extensions |
| OLD | NEW |