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

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

Issue 106433007: Update some uses of Value in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 12 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 | Annotate | Revision Log
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/content_settings/content_settings_pref_provider.h" 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 prefs::kContentSettingsPatternPairs, 117 prefs::kContentSettingsPatternPairs,
118 base::Bind(&PrefProvider::OnContentSettingsPatternPairsChanged, 118 base::Bind(&PrefProvider::OnContentSettingsPatternPairsChanged,
119 base::Unretained(this))); 119 base::Unretained(this)));
120 } 120 }
121 121
122 bool PrefProvider::SetWebsiteSetting( 122 bool PrefProvider::SetWebsiteSetting(
123 const ContentSettingsPattern& primary_pattern, 123 const ContentSettingsPattern& primary_pattern,
124 const ContentSettingsPattern& secondary_pattern, 124 const ContentSettingsPattern& secondary_pattern,
125 ContentSettingsType content_type, 125 ContentSettingsType content_type,
126 const ResourceIdentifier& resource_identifier, 126 const ResourceIdentifier& resource_identifier,
127 Value* in_value) { 127 base::Value* in_value) {
128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
129 DCHECK(prefs_); 129 DCHECK(prefs_);
130 // Default settings are set using a wildcard pattern for both 130 // Default settings are set using a wildcard pattern for both
131 // |primary_pattern| and |secondary_pattern|. Don't store default settings in 131 // |primary_pattern| and |secondary_pattern|. Don't store default settings in
132 // the |PrefProvider|. The |PrefProvider| handles settings for specific 132 // the |PrefProvider|. The |PrefProvider| handles settings for specific
133 // sites/origins defined by the |primary_pattern| and the |secondary_pattern|. 133 // sites/origins defined by the |primary_pattern| and the |secondary_pattern|.
134 // Default settings are handled by the |DefaultProvider|. 134 // Default settings are handled by the |DefaultProvider|.
135 if (primary_pattern == ContentSettingsPattern::Wildcard() && 135 if (primary_pattern == ContentSettingsPattern::Wildcard() &&
136 secondary_pattern == ContentSettingsPattern::Wildcard() && 136 secondary_pattern == ContentSettingsPattern::Wildcard() &&
137 resource_identifier.empty()) { 137 resource_identifier.empty()) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 const ResourceIdentifier& resource_identifier, 237 const ResourceIdentifier& resource_identifier,
238 const base::Value* value) { 238 const base::Value* value) {
239 // Ensure that |lock_| is not held by this thread, since this function will 239 // Ensure that |lock_| is not held by this thread, since this function will
240 // send out notifications (by |~DictionaryPrefUpdate|). 240 // send out notifications (by |~DictionaryPrefUpdate|).
241 AssertLockNotHeld(); 241 AssertLockNotHeld();
242 242
243 base::AutoReset<bool> auto_reset(&updating_preferences_, true); 243 base::AutoReset<bool> auto_reset(&updating_preferences_, true);
244 { 244 {
245 DictionaryPrefUpdate update(prefs_, 245 DictionaryPrefUpdate update(prefs_,
246 prefs::kContentSettingsPatternPairs); 246 prefs::kContentSettingsPatternPairs);
247 DictionaryValue* pattern_pairs_settings = update.Get(); 247 base::DictionaryValue* pattern_pairs_settings = update.Get();
248 248
249 // Get settings dictionary for the given patterns. 249 // Get settings dictionary for the given patterns.
250 std::string pattern_str(CreatePatternString(primary_pattern, 250 std::string pattern_str(CreatePatternString(primary_pattern,
251 secondary_pattern)); 251 secondary_pattern));
252 DictionaryValue* settings_dictionary = NULL; 252 base::DictionaryValue* settings_dictionary = NULL;
253 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion( 253 bool found = pattern_pairs_settings->GetDictionaryWithoutPathExpansion(
254 pattern_str, &settings_dictionary); 254 pattern_str, &settings_dictionary);
255 255
256 if (!found && value) { 256 if (!found && value) {
257 settings_dictionary = new DictionaryValue; 257 settings_dictionary = new base::DictionaryValue;
258 pattern_pairs_settings->SetWithoutPathExpansion( 258 pattern_pairs_settings->SetWithoutPathExpansion(
259 pattern_str, settings_dictionary); 259 pattern_str, settings_dictionary);
260 } 260 }
261 261
262 if (settings_dictionary) { 262 if (settings_dictionary) {
263 std::string res_dictionary_path; 263 std::string res_dictionary_path;
264 if (GetResourceTypeName(content_type, &res_dictionary_path) && 264 if (GetResourceTypeName(content_type, &res_dictionary_path) &&
265 !resource_identifier.empty()) { 265 !resource_identifier.empty()) {
266 DictionaryValue* resource_dictionary = NULL; 266 base::DictionaryValue* resource_dictionary = NULL;
267 found = settings_dictionary->GetDictionary( 267 found = settings_dictionary->GetDictionary(
268 res_dictionary_path, &resource_dictionary); 268 res_dictionary_path, &resource_dictionary);
269 if (!found) { 269 if (!found) {
270 if (value == NULL) 270 if (value == NULL)
271 return; // Nothing to remove. Exit early. 271 return; // Nothing to remove. Exit early.
272 resource_dictionary = new DictionaryValue; 272 resource_dictionary = new base::DictionaryValue;
273 settings_dictionary->Set(res_dictionary_path, resource_dictionary); 273 settings_dictionary->Set(res_dictionary_path, resource_dictionary);
274 } 274 }
275 // Update resource dictionary. 275 // Update resource dictionary.
276 if (value == NULL) { 276 if (value == NULL) {
277 resource_dictionary->RemoveWithoutPathExpansion(resource_identifier, 277 resource_dictionary->RemoveWithoutPathExpansion(resource_identifier,
278 NULL); 278 NULL);
279 if (resource_dictionary->empty()) { 279 if (resource_dictionary->empty()) {
280 settings_dictionary->RemoveWithoutPathExpansion( 280 settings_dictionary->RemoveWithoutPathExpansion(
281 res_dictionary_path, NULL); 281 res_dictionary_path, NULL);
282 } 282 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 const content_settings::Rule& rule = rule_iterator->Next(); 315 const content_settings::Rule& rule = rule_iterator->Next();
316 DCHECK(rule.primary_pattern != ContentSettingsPattern::Wildcard()); 316 DCHECK(rule.primary_pattern != ContentSettingsPattern::Wildcard());
317 if (!rule.value.get()) 317 if (!rule.value.get())
318 continue; 318 continue;
319 rules_to_delete.push_back(rule); 319 rules_to_delete.push_back(rule);
320 } 320 }
321 } 321 }
322 322
323 for (std::vector<Rule>::const_iterator it = rules_to_delete.begin(); 323 for (std::vector<Rule>::const_iterator it = rules_to_delete.begin();
324 it != rules_to_delete.end(); ++it) { 324 it != rules_to_delete.end(); ++it) {
325 const DictionaryValue* value_dict = NULL; 325 const base::DictionaryValue* value_dict = NULL;
326 if (!it->value->GetAsDictionary(&value_dict) || value_dict->empty()) 326 if (!it->value->GetAsDictionary(&value_dict) || value_dict->empty())
327 return; 327 return;
328 328
329 std::string audio_device, video_device; 329 std::string audio_device, video_device;
330 value_dict->GetString(kAudioKey, &audio_device); 330 value_dict->GetString(kAudioKey, &audio_device);
331 value_dict->GetString(kVideoKey, &video_device); 331 value_dict->GetString(kVideoKey, &video_device);
332 // Add the exception to the new microphone content setting. 332 // Add the exception to the new microphone content setting.
333 if (!audio_device.empty()) { 333 if (!audio_device.empty()) {
334 SetWebsiteSetting(it->primary_pattern, 334 SetWebsiteSetting(it->primary_pattern,
335 it->secondary_pattern, 335 it->secondary_pattern,
336 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, 336 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
337 std::string(), 337 std::string(),
338 Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); 338 base::Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
339 } 339 }
340 // Add the exception to the new camera content setting. 340 // Add the exception to the new camera content setting.
341 if (!video_device.empty()) { 341 if (!video_device.empty()) {
342 SetWebsiteSetting(it->primary_pattern, 342 SetWebsiteSetting(it->primary_pattern,
343 it->secondary_pattern, 343 it->secondary_pattern,
344 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, 344 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
345 std::string(), 345 std::string(),
346 Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); 346 base::Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
347 } 347 }
348 348
349 // Remove the old exception in CONTENT_SETTINGS_TYPE_MEDIASTREAM. 349 // Remove the old exception in CONTENT_SETTINGS_TYPE_MEDIASTREAM.
350 SetWebsiteSetting(it->primary_pattern, 350 SetWebsiteSetting(it->primary_pattern,
351 it->secondary_pattern, 351 it->secondary_pattern,
352 CONTENT_SETTINGS_TYPE_MEDIASTREAM, 352 CONTENT_SETTINGS_TYPE_MEDIASTREAM,
353 std::string(), 353 std::string(),
354 NULL); 354 NULL);
355 } 355 }
356 } 356 }
357 357
358 void PrefProvider::ReadContentSettingsFromPref(bool overwrite) { 358 void PrefProvider::ReadContentSettingsFromPref(bool overwrite) {
359 // |DictionaryPrefUpdate| sends out notifications when destructed. This 359 // |DictionaryPrefUpdate| sends out notifications when destructed. This
360 // construction order ensures |AutoLock| gets destroyed first and |lock_| is 360 // construction order ensures |AutoLock| gets destroyed first and |lock_| is
361 // not held when the notifications are sent. Also, |auto_reset| must be still 361 // not held when the notifications are sent. Also, |auto_reset| must be still
362 // valid when the notifications are sent, so that |Observe| skips the 362 // valid when the notifications are sent, so that |Observe| skips the
363 // notification. 363 // notification.
364 base::AutoReset<bool> auto_reset(&updating_preferences_, true); 364 base::AutoReset<bool> auto_reset(&updating_preferences_, true);
365 DictionaryPrefUpdate update(prefs_, prefs::kContentSettingsPatternPairs); 365 DictionaryPrefUpdate update(prefs_, prefs::kContentSettingsPatternPairs);
366 base::AutoLock auto_lock(lock_); 366 base::AutoLock auto_lock(lock_);
367 367
368 const DictionaryValue* all_settings_dictionary = 368 const base::DictionaryValue* all_settings_dictionary =
369 prefs_->GetDictionary(prefs::kContentSettingsPatternPairs); 369 prefs_->GetDictionary(prefs::kContentSettingsPatternPairs);
370 370
371 if (overwrite) 371 if (overwrite)
372 value_map_.clear(); 372 value_map_.clear();
373 373
374 // Careful: The returned value could be NULL if the pref has never been set. 374 // Careful: The returned value could be NULL if the pref has never been set.
375 if (!all_settings_dictionary) 375 if (!all_settings_dictionary)
376 return; 376 return;
377 377
378 DictionaryValue* mutable_settings; 378 base::DictionaryValue* mutable_settings;
379 scoped_ptr<DictionaryValue> mutable_settings_scope; 379 scoped_ptr<base::DictionaryValue> mutable_settings_scope;
380 380
381 if (!is_incognito_) { 381 if (!is_incognito_) {
382 mutable_settings = update.Get(); 382 mutable_settings = update.Get();
383 } else { 383 } else {
384 // Create copy as we do not want to persist anything in OTR prefs. 384 // Create copy as we do not want to persist anything in OTR prefs.
385 mutable_settings = all_settings_dictionary->DeepCopy(); 385 mutable_settings = all_settings_dictionary->DeepCopy();
386 mutable_settings_scope.reset(mutable_settings); 386 mutable_settings_scope.reset(mutable_settings);
387 } 387 }
388 // Convert all Unicode patterns into punycode form, then read. 388 // Convert all Unicode patterns into punycode form, then read.
389 CanonicalizeContentSettingsExceptions(mutable_settings); 389 CanonicalizeContentSettingsExceptions(mutable_settings);
390 390
391 size_t cookies_block_exception_count = 0; 391 size_t cookies_block_exception_count = 0;
392 size_t cookies_allow_exception_count = 0; 392 size_t cookies_allow_exception_count = 0;
393 size_t cookies_session_only_exception_count = 0; 393 size_t cookies_session_only_exception_count = 0;
394 for (DictionaryValue::Iterator i(*mutable_settings); !i.IsAtEnd(); 394 for (base::DictionaryValue::Iterator i(*mutable_settings); !i.IsAtEnd();
395 i.Advance()) { 395 i.Advance()) {
396 const std::string& pattern_str(i.key()); 396 const std::string& pattern_str(i.key());
397 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair = 397 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair =
398 ParsePatternString(pattern_str); 398 ParsePatternString(pattern_str);
399 if (!pattern_pair.first.IsValid() || 399 if (!pattern_pair.first.IsValid() ||
400 !pattern_pair.second.IsValid()) { 400 !pattern_pair.second.IsValid()) {
401 // TODO: Change this to DFATAL when crbug.com/132659 is fixed. 401 // TODO: Change this to DFATAL when crbug.com/132659 is fixed.
402 LOG(ERROR) << "Invalid pattern strings: " << pattern_str; 402 LOG(ERROR) << "Invalid pattern strings: " << pattern_str;
403 continue; 403 continue;
404 } 404 }
405 405
406 // Get settings dictionary for the current pattern string, and read 406 // Get settings dictionary for the current pattern string, and read
407 // settings from the dictionary. 407 // settings from the dictionary.
408 const DictionaryValue* settings_dictionary = NULL; 408 const base::DictionaryValue* settings_dictionary = NULL;
409 bool is_dictionary = i.value().GetAsDictionary(&settings_dictionary); 409 bool is_dictionary = i.value().GetAsDictionary(&settings_dictionary);
410 DCHECK(is_dictionary); 410 DCHECK(is_dictionary);
411 411
412 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 412 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
413 ContentSettingsType content_type = static_cast<ContentSettingsType>(i); 413 ContentSettingsType content_type = static_cast<ContentSettingsType>(i);
414 414
415 std::string res_dictionary_path; 415 std::string res_dictionary_path;
416 if (GetResourceTypeName(content_type, &res_dictionary_path)) { 416 if (GetResourceTypeName(content_type, &res_dictionary_path)) {
417 const DictionaryValue* resource_dictionary = NULL; 417 const base::DictionaryValue* resource_dictionary = NULL;
418 if (settings_dictionary->GetDictionary( 418 if (settings_dictionary->GetDictionary(
419 res_dictionary_path, &resource_dictionary)) { 419 res_dictionary_path, &resource_dictionary)) {
420 for (DictionaryValue::Iterator j(*resource_dictionary); !j.IsAtEnd(); 420 for (base::DictionaryValue::Iterator j(*resource_dictionary);
421 !j.IsAtEnd();
421 j.Advance()) { 422 j.Advance()) {
422 const std::string& resource_identifier(j.key()); 423 const std::string& resource_identifier(j.key());
423 int setting = CONTENT_SETTING_DEFAULT; 424 int setting = CONTENT_SETTING_DEFAULT;
424 bool is_integer = j.value().GetAsInteger(&setting); 425 bool is_integer = j.value().GetAsInteger(&setting);
425 DCHECK(is_integer); 426 DCHECK(is_integer);
426 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); 427 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting);
427 value_map_.SetValue(pattern_pair.first, 428 value_map_.SetValue(pattern_pair.first,
428 pattern_pair.second, 429 pattern_pair.second,
429 content_type, 430 content_type,
430 resource_identifier, 431 resource_identifier,
431 Value::CreateIntegerValue(setting)); 432 base::Value::CreateIntegerValue(setting));
432 } 433 }
433 } 434 }
434 } 435 }
435 Value* value = NULL; 436 base::Value* value = NULL;
436 if (HostContentSettingsMap::ContentTypeHasCompoundValue(content_type)) { 437 if (HostContentSettingsMap::ContentTypeHasCompoundValue(content_type)) {
437 const DictionaryValue* setting = NULL; 438 const base::DictionaryValue* setting = NULL;
438 // TODO(xians): Handle the non-dictionary types. 439 // TODO(xians): Handle the non-dictionary types.
439 if (settings_dictionary->GetDictionaryWithoutPathExpansion( 440 if (settings_dictionary->GetDictionaryWithoutPathExpansion(
440 GetTypeName(ContentSettingsType(i)), &setting)) { 441 GetTypeName(ContentSettingsType(i)), &setting)) {
441 DCHECK(!setting->empty()); 442 DCHECK(!setting->empty());
442 value = setting->DeepCopy(); 443 value = setting->DeepCopy();
443 } 444 }
444 } else { 445 } else {
445 int setting = CONTENT_SETTING_DEFAULT; 446 int setting = CONTENT_SETTING_DEFAULT;
446 if (settings_dictionary->GetIntegerWithoutPathExpansion( 447 if (settings_dictionary->GetIntegerWithoutPathExpansion(
447 GetTypeName(ContentSettingsType(i)), &setting)) { 448 GetTypeName(ContentSettingsType(i)), &setting)) {
448 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); 449 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting);
449 setting = FixObsoleteCookiePromptMode(content_type, 450 setting = FixObsoleteCookiePromptMode(content_type,
450 ContentSetting(setting)); 451 ContentSetting(setting));
451 value = Value::CreateIntegerValue(setting); 452 value = base::Value::CreateIntegerValue(setting);
452 } 453 }
453 } 454 }
454 455
455 // |value_map_| will take the ownership of |value|. 456 // |value_map_| will take the ownership of |value|.
456 if (value != NULL) { 457 if (value != NULL) {
457 value_map_.SetValue(pattern_pair.first, 458 value_map_.SetValue(pattern_pair.first,
458 pattern_pair.second, 459 pattern_pair.second,
459 content_type, 460 content_type,
460 ResourceIdentifier(), 461 ResourceIdentifier(),
461 value); 462 value);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 ReadContentSettingsFromPref(true); 497 ReadContentSettingsFromPref(true);
497 498
498 NotifyObservers(ContentSettingsPattern(), 499 NotifyObservers(ContentSettingsPattern(),
499 ContentSettingsPattern(), 500 ContentSettingsPattern(),
500 CONTENT_SETTINGS_TYPE_DEFAULT, 501 CONTENT_SETTINGS_TYPE_DEFAULT,
501 std::string()); 502 std::string());
502 } 503 }
503 504
504 // static 505 // static
505 void PrefProvider::CanonicalizeContentSettingsExceptions( 506 void PrefProvider::CanonicalizeContentSettingsExceptions(
506 DictionaryValue* all_settings_dictionary) { 507 base::DictionaryValue* all_settings_dictionary) {
507 DCHECK(all_settings_dictionary); 508 DCHECK(all_settings_dictionary);
508 509
509 std::vector<std::string> remove_items; 510 std::vector<std::string> remove_items;
510 std::vector<std::pair<std::string, std::string> > move_items; 511 std::vector<std::pair<std::string, std::string> > move_items;
511 for (DictionaryValue::Iterator i(*all_settings_dictionary); !i.IsAtEnd(); 512 for (base::DictionaryValue::Iterator i(*all_settings_dictionary);
513 !i.IsAtEnd();
512 i.Advance()) { 514 i.Advance()) {
513 const std::string& pattern_str(i.key()); 515 const std::string& pattern_str(i.key());
514 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair = 516 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair =
515 ParsePatternString(pattern_str); 517 ParsePatternString(pattern_str);
516 if (!pattern_pair.first.IsValid() || 518 if (!pattern_pair.first.IsValid() ||
517 !pattern_pair.second.IsValid()) { 519 !pattern_pair.second.IsValid()) {
518 LOG(ERROR) << "Invalid pattern strings: " << pattern_str; 520 LOG(ERROR) << "Invalid pattern strings: " << pattern_str;
519 continue; 521 continue;
520 } 522 }
521 523
522 const std::string canonicalized_pattern_str = CreatePatternString( 524 const std::string canonicalized_pattern_str = CreatePatternString(
523 pattern_pair.first, pattern_pair.second); 525 pattern_pair.first, pattern_pair.second);
524 526
525 if (canonicalized_pattern_str.empty() || 527 if (canonicalized_pattern_str.empty() ||
526 canonicalized_pattern_str == pattern_str) { 528 canonicalized_pattern_str == pattern_str) {
527 continue; 529 continue;
528 } 530 }
529 531
530 // Clear old pattern if prefs already have canonicalized pattern. 532 // Clear old pattern if prefs already have canonicalized pattern.
531 const DictionaryValue* new_pattern_settings_dictionary = NULL; 533 const base::DictionaryValue* new_pattern_settings_dictionary = NULL;
532 if (all_settings_dictionary->GetDictionaryWithoutPathExpansion( 534 if (all_settings_dictionary->GetDictionaryWithoutPathExpansion(
533 canonicalized_pattern_str, &new_pattern_settings_dictionary)) { 535 canonicalized_pattern_str, &new_pattern_settings_dictionary)) {
534 remove_items.push_back(pattern_str); 536 remove_items.push_back(pattern_str);
535 continue; 537 continue;
536 } 538 }
537 539
538 // Move old pattern to canonicalized pattern. 540 // Move old pattern to canonicalized pattern.
539 const DictionaryValue* old_pattern_settings_dictionary = NULL; 541 const base::DictionaryValue* old_pattern_settings_dictionary = NULL;
540 if (i.value().GetAsDictionary(&old_pattern_settings_dictionary)) { 542 if (i.value().GetAsDictionary(&old_pattern_settings_dictionary)) {
541 move_items.push_back( 543 move_items.push_back(
542 std::make_pair(pattern_str, canonicalized_pattern_str)); 544 std::make_pair(pattern_str, canonicalized_pattern_str));
543 } 545 }
544 } 546 }
545 547
546 for (size_t i = 0; i < remove_items.size(); ++i) { 548 for (size_t i = 0; i < remove_items.size(); ++i) {
547 all_settings_dictionary->RemoveWithoutPathExpansion(remove_items[i], NULL); 549 all_settings_dictionary->RemoveWithoutPathExpansion(remove_items[i], NULL);
548 } 550 }
549 551
550 for (size_t i = 0; i < move_items.size(); ++i) { 552 for (size_t i = 0; i < move_items.size(); ++i) {
551 scoped_ptr<Value> pattern_settings_dictionary; 553 scoped_ptr<base::Value> pattern_settings_dictionary;
552 all_settings_dictionary->RemoveWithoutPathExpansion( 554 all_settings_dictionary->RemoveWithoutPathExpansion(
553 move_items[i].first, &pattern_settings_dictionary); 555 move_items[i].first, &pattern_settings_dictionary);
554 all_settings_dictionary->SetWithoutPathExpansion( 556 all_settings_dictionary->SetWithoutPathExpansion(
555 move_items[i].second, pattern_settings_dictionary.release()); 557 move_items[i].second, pattern_settings_dictionary.release());
556 } 558 }
557 } 559 }
558 560
559 void PrefProvider::ShutdownOnUIThread() { 561 void PrefProvider::ShutdownOnUIThread() {
560 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
561 DCHECK(prefs_); 563 DCHECK(prefs_);
562 RemoveAllObservers(); 564 RemoveAllObservers();
563 pref_change_registrar_.RemoveAll(); 565 pref_change_registrar_.RemoveAll();
564 prefs_ = NULL; 566 prefs_ = NULL;
565 } 567 }
566 568
567 void PrefProvider::AssertLockNotHeld() const { 569 void PrefProvider::AssertLockNotHeld() const {
568 #if !defined(NDEBUG) 570 #if !defined(NDEBUG)
569 // |Lock::Acquire()| will assert if the lock is held by this thread. 571 // |Lock::Acquire()| will assert if the lock is held by this thread.
570 lock_.Acquire(); 572 lock_.Acquire();
571 lock_.Release(); 573 lock_.Release();
572 #endif 574 #endif
573 } 575 }
574 576
575 } // namespace content_settings 577 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698