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

Side by Side Diff: components/content_settings/core/browser/content_settings_pref.cc

Issue 2376453003: Remove old, unused per-plugin data from user prefs
Patch Set: Remove old, unused per-plugin data from user prefs 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 | « components/content_settings/core/browser/content_settings_pref.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/content_settings/core/browser/content_settings_pref.h" 5 #include "components/content_settings/core/browser/content_settings_pref.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 bool ContentSettingsPref::SetWebsiteSetting( 96 bool ContentSettingsPref::SetWebsiteSetting(
97 const ContentSettingsPattern& primary_pattern, 97 const ContentSettingsPattern& primary_pattern,
98 const ContentSettingsPattern& secondary_pattern, 98 const ContentSettingsPattern& secondary_pattern,
99 const ResourceIdentifier& resource_identifier, 99 const ResourceIdentifier& resource_identifier,
100 base::Value* in_value) { 100 base::Value* in_value) {
101 DCHECK(!in_value || IsValueAllowedForType(in_value, content_type_)); 101 DCHECK(!in_value || IsValueAllowedForType(in_value, content_type_));
102 DCHECK(thread_checker_.CalledOnValidThread()); 102 DCHECK(thread_checker_.CalledOnValidThread());
103 DCHECK(prefs_); 103 DCHECK(prefs_);
104 DCHECK(primary_pattern != ContentSettingsPattern::Wildcard() || 104 DCHECK(primary_pattern != ContentSettingsPattern::Wildcard() ||
105 secondary_pattern != ContentSettingsPattern::Wildcard() || 105 secondary_pattern != ContentSettingsPattern::Wildcard());
106 !resource_identifier.empty()); 106 DCHECK(resource_identifier.empty());
107 107
108 // At this point take the ownership of the |in_value|. 108 // At this point take the ownership of the |in_value|.
109 std::unique_ptr<base::Value> value(in_value); 109 std::unique_ptr<base::Value> value(in_value);
110 110
111 // Update in memory value map. 111 // Update in memory value map.
112 OriginIdentifierValueMap* map_to_modify = &incognito_value_map_; 112 OriginIdentifierValueMap* map_to_modify = &incognito_value_map_;
113 if (!is_incognito_) 113 if (!is_incognito_)
114 map_to_modify = &value_map_; 114 map_to_modify = &value_map_;
115 115
116 { 116 {
117 base::AutoLock auto_lock(lock_); 117 base::AutoLock auto_lock(lock_);
118 if (value.get()) { 118 if (value.get()) {
119 map_to_modify->SetValue( 119 map_to_modify->SetValue(primary_pattern, secondary_pattern, content_type_,
120 primary_pattern, 120 std::string(), value->DeepCopy());
121 secondary_pattern,
122 content_type_,
123 resource_identifier,
124 value->DeepCopy());
125 } else { 121 } else {
126 map_to_modify->DeleteValue( 122 map_to_modify->DeleteValue(primary_pattern, secondary_pattern,
127 primary_pattern, 123 content_type_, std::string());
128 secondary_pattern,
129 content_type_,
130 resource_identifier);
131 } 124 }
132 } 125 }
133 // Update the content settings preference. 126 // Update the content settings preference.
134 if (!is_incognito_) { 127 if (!is_incognito_) {
135 UpdatePref(primary_pattern, 128 UpdatePref(primary_pattern,
136 secondary_pattern, 129 secondary_pattern,
137 resource_identifier,
138 value.get()); 130 value.get());
139 } 131 }
140 132
141 notify_callback_.Run( 133 notify_callback_.Run(primary_pattern, secondary_pattern, content_type_,
142 primary_pattern, secondary_pattern, content_type_, resource_identifier); 134 std::string());
143 135
144 return true; 136 return true;
145 } 137 }
146 138
147 void ContentSettingsPref::ClearPref() { 139 void ContentSettingsPref::ClearPref() {
148 DCHECK(thread_checker_.CalledOnValidThread()); 140 DCHECK(thread_checker_.CalledOnValidThread());
149 DCHECK(prefs_); 141 DCHECK(prefs_);
150 142
151 { 143 {
152 base::AutoLock auto_lock(lock_); 144 base::AutoLock auto_lock(lock_);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // send out notifications (by |~DictionaryPrefUpdate|). 183 // send out notifications (by |~DictionaryPrefUpdate|).
192 AssertLockNotHeld(); 184 AssertLockNotHeld();
193 185
194 base::AutoReset<bool> auto_reset(&updating_preferences_, true); 186 base::AutoReset<bool> auto_reset(&updating_preferences_, true);
195 { 187 {
196 DictionaryPrefUpdate update(prefs_, pref_name_); 188 DictionaryPrefUpdate update(prefs_, pref_name_);
197 base::DictionaryValue* pattern_pairs_settings = update.Get(); 189 base::DictionaryValue* pattern_pairs_settings = update.Get();
198 190
199 std::string pattern_str( 191 std::string pattern_str(
200 CreatePatternString(primary_pattern, secondary_pattern)); 192 CreatePatternString(primary_pattern, secondary_pattern));
201 base::DictionaryValue* settings_dictionary = NULL; 193 base::DictionaryValue* settings_dictionary = nullptr;
202 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion( 194 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion(
203 pattern_str, &settings_dictionary); 195 pattern_str, &settings_dictionary);
204 196
205 if (!found) { 197 if (!found) {
206 settings_dictionary = new base::DictionaryValue; 198 settings_dictionary = new base::DictionaryValue;
207 pattern_pairs_settings->SetWithoutPathExpansion(pattern_str, 199 pattern_pairs_settings->SetWithoutPathExpansion(pattern_str,
208 settings_dictionary); 200 settings_dictionary);
209 } 201 }
210 202
211 settings_dictionary->SetWithoutPathExpansion( 203 settings_dictionary->SetWithoutPathExpansion(
212 kLastUsed, new base::FundamentalValue(clock->Now().ToDoubleT())); 204 kLastUsed, new base::FundamentalValue(clock->Now().ToDoubleT()));
213 } 205 }
214 } 206 }
215 207
216 base::Time ContentSettingsPref::GetLastUsage( 208 base::Time ContentSettingsPref::GetLastUsage(
217 const ContentSettingsPattern& primary_pattern, 209 const ContentSettingsPattern& primary_pattern,
218 const ContentSettingsPattern& secondary_pattern) { 210 const ContentSettingsPattern& secondary_pattern) {
219 const base::DictionaryValue* pattern_pairs_settings = 211 const base::DictionaryValue* pattern_pairs_settings =
220 prefs_->GetDictionary(pref_name_); 212 prefs_->GetDictionary(pref_name_);
221 std::string pattern_str( 213 std::string pattern_str(
222 CreatePatternString(primary_pattern, secondary_pattern)); 214 CreatePatternString(primary_pattern, secondary_pattern));
223 215
224 const base::DictionaryValue* settings_dictionary = NULL; 216 const base::DictionaryValue* settings_dictionary = nullptr;
225 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion( 217 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion(
226 pattern_str, &settings_dictionary); 218 pattern_str, &settings_dictionary);
227 219
228 if (!found) 220 if (!found)
229 return base::Time(); 221 return base::Time();
230 222
231 double last_used_time; 223 double last_used_time;
232 found = settings_dictionary->GetDoubleWithoutPathExpansion( 224 found = settings_dictionary->GetDoubleWithoutPathExpansion(
233 kLastUsed, &last_used_time); 225 kLastUsed, &last_used_time);
234 226
(...skipping 22 matching lines...) Expand all
257 // notification. 249 // notification.
258 base::AutoReset<bool> auto_reset(&updating_preferences_, true); 250 base::AutoReset<bool> auto_reset(&updating_preferences_, true);
259 DictionaryPrefUpdate update(prefs_, pref_name_); 251 DictionaryPrefUpdate update(prefs_, pref_name_);
260 base::AutoLock auto_lock(lock_); 252 base::AutoLock auto_lock(lock_);
261 253
262 const base::DictionaryValue* all_settings_dictionary = 254 const base::DictionaryValue* all_settings_dictionary =
263 prefs_->GetDictionary(pref_name_); 255 prefs_->GetDictionary(pref_name_);
264 256
265 value_map_.clear(); 257 value_map_.clear();
266 258
267 // Careful: The returned value could be NULL if the pref has never been set. 259 // Careful: The returned value could be nullptr if the pref has never been
Bernhard Bauer 2016/09/27 09:34:44 Tiny nit: I would use just "null" if it's more abo
260 // set.
268 if (!all_settings_dictionary) 261 if (!all_settings_dictionary)
269 return; 262 return;
270 263
271 base::DictionaryValue* mutable_settings; 264 base::DictionaryValue* mutable_settings;
272 std::unique_ptr<base::DictionaryValue> mutable_settings_scope; 265 std::unique_ptr<base::DictionaryValue> mutable_settings_scope;
273 266
274 if (!is_incognito_) { 267 if (!is_incognito_) {
275 mutable_settings = update.Get(); 268 mutable_settings = update.Get();
276 } else { 269 } else {
277 // Create copy as we do not want to persist anything in OTR prefs. 270 // Create copy as we do not want to persist anything in OTR prefs.
278 mutable_settings = all_settings_dictionary->DeepCopy(); 271 mutable_settings = all_settings_dictionary->DeepCopy();
279 mutable_settings_scope.reset(mutable_settings); 272 mutable_settings_scope.reset(mutable_settings);
280 } 273 }
281 // Convert all Unicode patterns into punycode form, then read. 274 // Convert all Unicode patterns into punycode form, then read.
282 CanonicalizeContentSettingsExceptions(mutable_settings); 275 CanonicalizeContentSettingsExceptions(mutable_settings);
283 276
277 std::vector<std::string> remove_items;
284 size_t cookies_block_exception_count = 0; 278 size_t cookies_block_exception_count = 0;
285 size_t cookies_allow_exception_count = 0; 279 size_t cookies_allow_exception_count = 0;
286 size_t cookies_session_only_exception_count = 0; 280 size_t cookies_session_only_exception_count = 0;
287 for (base::DictionaryValue::Iterator i(*mutable_settings); !i.IsAtEnd(); 281 for (base::DictionaryValue::Iterator i(*mutable_settings); !i.IsAtEnd();
288 i.Advance()) { 282 i.Advance()) {
289 const std::string& pattern_str(i.key()); 283 const std::string& pattern_str(i.key());
290 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair = 284 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair =
291 ParsePatternString(pattern_str); 285 ParsePatternString(pattern_str);
292 if (!pattern_pair.first.IsValid() || 286 if (!pattern_pair.first.IsValid() ||
293 !pattern_pair.second.IsValid()) { 287 !pattern_pair.second.IsValid()) {
294 // TODO: Change this to DFATAL when crbug.com/132659 is fixed. 288 // TODO: Change this to DFATAL when crbug.com/132659 is fixed.
295 LOG(ERROR) << "Invalid pattern strings: " << pattern_str; 289 LOG(ERROR) << "Invalid pattern strings: " << pattern_str;
296 continue; 290 continue;
297 } 291 }
298 292
299 // Get settings dictionary for the current pattern string, and read 293 // Get settings dictionary for the current pattern string, and read
300 // settings from the dictionary. 294 // settings from the dictionary.
301 const base::DictionaryValue* settings_dictionary = NULL; 295 const base::DictionaryValue* settings_dictionary = nullptr;
302 bool is_dictionary = i.value().GetAsDictionary(&settings_dictionary); 296 bool is_dictionary = i.value().GetAsDictionary(&settings_dictionary);
303 DCHECK(is_dictionary); 297 DCHECK(is_dictionary);
304 298
299 // Remove the old per-plugin content settings which are no longer used.
300 // TODO(raymes): delete this code ~M57.
msramek 2017/01/12 23:56:07 A lot of time has passed, so please update this :)
305 if (SupportsResourceIdentifiers(content_type_)) { 301 if (SupportsResourceIdentifiers(content_type_)) {
306 const base::DictionaryValue* resource_dictionary = NULL; 302 if (settings_dictionary->GetWithoutPathExpansion(
307 if (settings_dictionary->GetDictionary( 303 kPerResourceIdentifierPrefName, nullptr)) {
308 kPerResourceIdentifierPrefName, &resource_dictionary)) { 304 remove_items.push_back(pattern_str);
309 for (base::DictionaryValue::Iterator j(*resource_dictionary);
310 !j.IsAtEnd();
311 j.Advance()) {
312 const std::string& resource_identifier(j.key());
313 int setting = CONTENT_SETTING_DEFAULT;
314 bool is_integer = j.value().GetAsInteger(&setting);
315 DCHECK(is_integer);
316 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting);
317 std::unique_ptr<base::Value> setting_ptr(
318 new base::FundamentalValue(setting));
319 value_map_.SetValue(pattern_pair.first,
320 pattern_pair.second,
321 content_type_,
322 resource_identifier,
323 setting_ptr->DeepCopy());
324 }
325 } 305 }
326 } 306 }
327 307
328 const base::Value* value = nullptr; 308 const base::Value* value = nullptr;
329 settings_dictionary->GetWithoutPathExpansion(kSettingPath, &value); 309 settings_dictionary->GetWithoutPathExpansion(kSettingPath, &value);
330 310
331 if (value) { 311 if (value) {
332 DCHECK(IsValueAllowedForType(value, content_type_)); 312 DCHECK(IsValueAllowedForType(value, content_type_));
333 value_map_.SetValue(pattern_pair.first, 313 value_map_.SetValue(pattern_pair.first,
334 pattern_pair.second, 314 pattern_pair.second,
(...skipping 11 matching lines...) Expand all
346 break; 326 break;
347 case CONTENT_SETTING_SESSION_ONLY : 327 case CONTENT_SETTING_SESSION_ONLY :
348 ++cookies_session_only_exception_count; 328 ++cookies_session_only_exception_count;
349 break; 329 break;
350 default: 330 default:
351 NOTREACHED(); 331 NOTREACHED();
352 break; 332 break;
353 } 333 }
354 } 334 }
355 } 335 }
336 }
356 337
338 for (std::string pattern_str : remove_items) {
Bernhard Bauer 2016/09/27 09:34:44 const std::string& so you don't copy them?
339 base::DictionaryValue* settings_dictionary = nullptr;
340 if (mutable_settings->GetDictionaryWithoutPathExpansion(
341 pattern_str, &settings_dictionary)) {
342 settings_dictionary->RemoveWithoutPathExpansion(
343 kPerResourceIdentifierPrefName, nullptr);
344 if (settings_dictionary->empty())
345 mutable_settings->RemoveWithoutPathExpansion(pattern_str, nullptr);
346 }
357 } 347 }
358 348
359 if (content_type_ == CONTENT_SETTINGS_TYPE_COOKIES) { 349 if (content_type_ == CONTENT_SETTINGS_TYPE_COOKIES) {
360 UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOfBlockCookiesExceptions", 350 UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOfBlockCookiesExceptions",
361 cookies_block_exception_count); 351 cookies_block_exception_count);
362 UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOfAllowCookiesExceptions", 352 UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOfAllowCookiesExceptions",
363 cookies_allow_exception_count); 353 cookies_allow_exception_count);
364 UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOfSessionOnlyCookiesExceptions", 354 UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOfSessionOnlyCookiesExceptions",
365 cookies_session_only_exception_count); 355 cookies_session_only_exception_count);
366 } 356 }
367 } 357 }
368 358
369 void ContentSettingsPref::OnPrefChanged() { 359 void ContentSettingsPref::OnPrefChanged() {
370 DCHECK(thread_checker_.CalledOnValidThread()); 360 DCHECK(thread_checker_.CalledOnValidThread());
371 361
372 if (updating_preferences_) 362 if (updating_preferences_)
373 return; 363 return;
374 364
375 ReadContentSettingsFromPref(); 365 ReadContentSettingsFromPref();
376 366
377 notify_callback_.Run(ContentSettingsPattern(), 367 notify_callback_.Run(ContentSettingsPattern(),
378 ContentSettingsPattern(), 368 ContentSettingsPattern(),
379 content_type_, 369 content_type_,
380 ResourceIdentifier()); 370 ResourceIdentifier());
381 } 371 }
382 372
383 void ContentSettingsPref::UpdatePref( 373 void ContentSettingsPref::UpdatePref(
384 const ContentSettingsPattern& primary_pattern, 374 const ContentSettingsPattern& primary_pattern,
385 const ContentSettingsPattern& secondary_pattern, 375 const ContentSettingsPattern& secondary_pattern,
386 const ResourceIdentifier& resource_identifier,
387 const base::Value* value) { 376 const base::Value* value) {
388 // Ensure that |lock_| is not held by this thread, since this function will 377 // Ensure that |lock_| is not held by this thread, since this function will
389 // send out notifications (by |~DictionaryPrefUpdate|). 378 // send out notifications (by |~DictionaryPrefUpdate|).
390 AssertLockNotHeld(); 379 AssertLockNotHeld();
391 380
392 base::AutoReset<bool> auto_reset(&updating_preferences_, true); 381 base::AutoReset<bool> auto_reset(&updating_preferences_, true);
393 { 382 {
394 DictionaryPrefUpdate update(prefs_, pref_name_); 383 DictionaryPrefUpdate update(prefs_, pref_name_);
395 base::DictionaryValue* pattern_pairs_settings = update.Get(); 384 base::DictionaryValue* pattern_pairs_settings = update.Get();
396 385
397 // Get settings dictionary for the given patterns. 386 // Get settings dictionary for the given patterns.
398 std::string pattern_str(CreatePatternString(primary_pattern, 387 std::string pattern_str(CreatePatternString(primary_pattern,
399 secondary_pattern)); 388 secondary_pattern));
400 base::DictionaryValue* settings_dictionary = NULL; 389 base::DictionaryValue* settings_dictionary = nullptr;
401 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion( 390 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion(
402 pattern_str, &settings_dictionary); 391 pattern_str, &settings_dictionary);
403 392
404 if (!found && value) { 393 if (!found && value) {
405 settings_dictionary = new base::DictionaryValue; 394 settings_dictionary = new base::DictionaryValue;
406 pattern_pairs_settings->SetWithoutPathExpansion( 395 pattern_pairs_settings->SetWithoutPathExpansion(
407 pattern_str, settings_dictionary); 396 pattern_str, settings_dictionary);
408 } 397 }
409 398
410 if (settings_dictionary) { 399 if (settings_dictionary) {
411 if (SupportsResourceIdentifiers(content_type_) &&
412 !resource_identifier.empty()) {
413 base::DictionaryValue* resource_dictionary = NULL;
414 found = settings_dictionary->GetDictionary(
415 kPerResourceIdentifierPrefName, &resource_dictionary);
416 if (!found) {
417 if (value == NULL)
418 return; // Nothing to remove. Exit early.
419 resource_dictionary = new base::DictionaryValue;
420 settings_dictionary->Set(
421 kPerResourceIdentifierPrefName, resource_dictionary);
422 }
423 // Update resource dictionary.
424 if (value == NULL) {
425 resource_dictionary->RemoveWithoutPathExpansion(resource_identifier,
426 NULL);
427 if (resource_dictionary->empty()) {
428 settings_dictionary->RemoveWithoutPathExpansion(
429 kPerResourceIdentifierPrefName, NULL);
430 }
431 } else {
432 resource_dictionary->SetWithoutPathExpansion(
433 resource_identifier, value->DeepCopy());
434 }
435 } else {
436 // Update settings dictionary.
437 if (value == NULL) {
438 settings_dictionary->RemoveWithoutPathExpansion(kSettingPath, NULL);
439 settings_dictionary->RemoveWithoutPathExpansion(kLastUsed, NULL);
440 } else {
441 settings_dictionary->SetWithoutPathExpansion(
442 kSettingPath, value->DeepCopy());
443 }
444 }
445 // Remove the settings dictionary if it is empty. 400 // Remove the settings dictionary if it is empty.
446 if (settings_dictionary->empty()) { 401 if (settings_dictionary->empty()) {
447 pattern_pairs_settings->RemoveWithoutPathExpansion( 402 pattern_pairs_settings->RemoveWithoutPathExpansion(pattern_str,
448 pattern_str, NULL); 403 nullptr);
449 } 404 }
450 } 405 }
451 } 406 }
452 } 407 }
453 408
454 // static 409 // static
455 void ContentSettingsPref::CanonicalizeContentSettingsExceptions( 410 void ContentSettingsPref::CanonicalizeContentSettingsExceptions(
456 base::DictionaryValue* all_settings_dictionary) { 411 base::DictionaryValue* all_settings_dictionary) {
457 DCHECK(all_settings_dictionary); 412 DCHECK(all_settings_dictionary);
458 413
(...skipping 13 matching lines...) Expand all
472 427
473 const std::string canonicalized_pattern_str = CreatePatternString( 428 const std::string canonicalized_pattern_str = CreatePatternString(
474 pattern_pair.first, pattern_pair.second); 429 pattern_pair.first, pattern_pair.second);
475 430
476 if (canonicalized_pattern_str.empty() || 431 if (canonicalized_pattern_str.empty() ||
477 canonicalized_pattern_str == pattern_str) { 432 canonicalized_pattern_str == pattern_str) {
478 continue; 433 continue;
479 } 434 }
480 435
481 // Clear old pattern if prefs already have canonicalized pattern. 436 // Clear old pattern if prefs already have canonicalized pattern.
482 const base::DictionaryValue* new_pattern_settings_dictionary = NULL; 437 const base::DictionaryValue* new_pattern_settings_dictionary = nullptr;
483 if (all_settings_dictionary->GetDictionaryWithoutPathExpansion( 438 if (all_settings_dictionary->GetDictionaryWithoutPathExpansion(
484 canonicalized_pattern_str, &new_pattern_settings_dictionary)) { 439 canonicalized_pattern_str, &new_pattern_settings_dictionary)) {
485 remove_items.push_back(pattern_str); 440 remove_items.push_back(pattern_str);
486 continue; 441 continue;
487 } 442 }
488 443
489 // Move old pattern to canonicalized pattern. 444 // Move old pattern to canonicalized pattern.
490 const base::DictionaryValue* old_pattern_settings_dictionary = NULL; 445 const base::DictionaryValue* old_pattern_settings_dictionary = nullptr;
491 if (i.value().GetAsDictionary(&old_pattern_settings_dictionary)) { 446 if (i.value().GetAsDictionary(&old_pattern_settings_dictionary)) {
492 move_items.push_back( 447 move_items.push_back(
493 std::make_pair(pattern_str, canonicalized_pattern_str)); 448 std::make_pair(pattern_str, canonicalized_pattern_str));
494 } 449 }
495 } 450 }
496 451
497 for (size_t i = 0; i < remove_items.size(); ++i) { 452 for (size_t i = 0; i < remove_items.size(); ++i) {
498 all_settings_dictionary->RemoveWithoutPathExpansion(remove_items[i], NULL); 453 all_settings_dictionary->RemoveWithoutPathExpansion(remove_items[i],
454 nullptr);
499 } 455 }
500 456
501 for (size_t i = 0; i < move_items.size(); ++i) { 457 for (size_t i = 0; i < move_items.size(); ++i) {
502 std::unique_ptr<base::Value> pattern_settings_dictionary; 458 std::unique_ptr<base::Value> pattern_settings_dictionary;
503 all_settings_dictionary->RemoveWithoutPathExpansion( 459 all_settings_dictionary->RemoveWithoutPathExpansion(
504 move_items[i].first, &pattern_settings_dictionary); 460 move_items[i].first, &pattern_settings_dictionary);
505 all_settings_dictionary->SetWithoutPathExpansion( 461 all_settings_dictionary->SetWithoutPathExpansion(
506 move_items[i].second, pattern_settings_dictionary.release()); 462 move_items[i].second, pattern_settings_dictionary.release());
507 } 463 }
508 } 464 }
509 465
510 void ContentSettingsPref::AssertLockNotHeld() const { 466 void ContentSettingsPref::AssertLockNotHeld() const {
511 #if !defined(NDEBUG) 467 #if !defined(NDEBUG)
512 // |Lock::Acquire()| will assert if the lock is held by this thread. 468 // |Lock::Acquire()| will assert if the lock is held by this thread.
513 lock_.Acquire(); 469 lock_.Acquire();
514 lock_.Release(); 470 lock_.Release();
515 #endif 471 #endif
516 } 472 }
517 473
518 } // namespace content_settings 474 } // namespace content_settings
OLDNEW
« no previous file with comments | « components/content_settings/core/browser/content_settings_pref.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698