OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 const DictionaryValue* all_settings_dictionary = | 1024 const DictionaryValue* all_settings_dictionary = |
1025 prefs->GetDictionary(prefs::kContentSettingsPatterns); | 1025 prefs->GetDictionary(prefs::kContentSettingsPatterns); |
1026 | 1026 |
1027 DictionaryPrefUpdate update(prefs, prefs::kContentSettingsPatternPairs); | 1027 DictionaryPrefUpdate update(prefs, prefs::kContentSettingsPatternPairs); |
1028 DictionaryValue* exceptions_dictionary; | 1028 DictionaryValue* exceptions_dictionary; |
1029 exceptions_dictionary = update.Get(); | 1029 exceptions_dictionary = update.Get(); |
1030 for (DictionaryValue::key_iterator i(all_settings_dictionary->begin_keys()); | 1030 for (DictionaryValue::key_iterator i(all_settings_dictionary->begin_keys()); |
1031 i != all_settings_dictionary->end_keys(); | 1031 i != all_settings_dictionary->end_keys(); |
1032 ++i) { | 1032 ++i) { |
1033 const std::string& key(*i); | 1033 const std::string& key(*i); |
1034 if (key.empty()) | |
James Hawkins
2011/07/20 01:55:26
When does this happen?
sail
2011/07/20 19:40:25
Oops, this is a separate change. Removed.
| |
1035 continue; | |
1034 | 1036 |
1035 // Validate pattern string and skip it if it is invalid. | 1037 // Validate pattern string and skip it if it is invalid. |
1036 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair = | 1038 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair = |
1037 ParsePatternString(key); | 1039 ParsePatternString(key); |
1038 ContentSettingsPattern primary_pattern = pattern_pair.first; | 1040 ContentSettingsPattern primary_pattern = pattern_pair.first; |
1039 if (!primary_pattern.IsValid()) | 1041 if (!primary_pattern.IsValid()) |
1040 continue; | 1042 continue; |
1041 | 1043 |
1042 // Copy dictionary value. | 1044 // Copy dictionary value. |
1043 // Get old settings. | 1045 // Get old settings. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1086 std::string new_key = pattern_pair.first.ToString(); | 1088 std::string new_key = pattern_pair.first.ToString(); |
1087 // Existing values are overwritten. | 1089 // Existing values are overwritten. |
1088 obsolete_settings_dictionary->SetWithoutPathExpansion( | 1090 obsolete_settings_dictionary->SetWithoutPathExpansion( |
1089 new_key, dictionary->DeepCopy()); | 1091 new_key, dictionary->DeepCopy()); |
1090 } | 1092 } |
1091 } | 1093 } |
1092 updating_preferences_ = false; | 1094 updating_preferences_ = false; |
1093 } | 1095 } |
1094 | 1096 |
1095 } // namespace content_settings | 1097 } // namespace content_settings |
OLD | NEW |