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

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

Issue 568173004: Use base::StringPairs where appropriate from /chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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
11 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
16 #include "base/prefs/scoped_user_pref_update.h" 16 #include "base/prefs/scoped_user_pref_update.h"
17 #include "base/strings/string_split.h"
17 #include "base/time/clock.h" 18 #include "base/time/clock.h"
18 #include "base/time/default_clock.h" 19 #include "base/time/default_clock.h"
19 #include "chrome/browser/content_settings/content_settings_rule.h" 20 #include "chrome/browser/content_settings/content_settings_rule.h"
20 #include "chrome/browser/content_settings/content_settings_utils.h" 21 #include "chrome/browser/content_settings/content_settings_utils.h"
21 #include "chrome/browser/content_settings/host_content_settings_map.h" 22 #include "chrome/browser/content_settings/host_content_settings_map.h"
22 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
24 #include "components/content_settings/core/common/content_settings.h" 25 #include "components/content_settings/core/common/content_settings.h"
25 #include "components/content_settings/core/common/content_settings_pattern.h" 26 #include "components/content_settings/core/common/content_settings_pattern.h"
26 #include "components/pref_registry/pref_registry_syncable.h" 27 #include "components/pref_registry/pref_registry_syncable.h"
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 CONTENT_SETTINGS_TYPE_DEFAULT, 503 CONTENT_SETTINGS_TYPE_DEFAULT,
503 std::string()); 504 std::string());
504 } 505 }
505 506
506 // static 507 // static
507 void PrefProvider::CanonicalizeContentSettingsExceptions( 508 void PrefProvider::CanonicalizeContentSettingsExceptions(
508 base::DictionaryValue* all_settings_dictionary) { 509 base::DictionaryValue* all_settings_dictionary) {
509 DCHECK(all_settings_dictionary); 510 DCHECK(all_settings_dictionary);
510 511
511 std::vector<std::string> remove_items; 512 std::vector<std::string> remove_items;
512 std::vector<std::pair<std::string, std::string> > move_items; 513 base::StringPairs move_items;
513 for (base::DictionaryValue::Iterator i(*all_settings_dictionary); 514 for (base::DictionaryValue::Iterator i(*all_settings_dictionary);
514 !i.IsAtEnd(); 515 !i.IsAtEnd();
515 i.Advance()) { 516 i.Advance()) {
516 const std::string& pattern_str(i.key()); 517 const std::string& pattern_str(i.key());
517 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair = 518 std::pair<ContentSettingsPattern, ContentSettingsPattern> pattern_pair =
518 ParsePatternString(pattern_str); 519 ParsePatternString(pattern_str);
519 if (!pattern_pair.first.IsValid() || 520 if (!pattern_pair.first.IsValid() ||
520 !pattern_pair.second.IsValid()) { 521 !pattern_pair.second.IsValid()) {
521 LOG(ERROR) << "Invalid pattern strings: " << pattern_str; 522 LOG(ERROR) << "Invalid pattern strings: " << pattern_str;
522 continue; 523 continue;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 lock_.Acquire(); 653 lock_.Acquire();
653 lock_.Release(); 654 lock_.Release();
654 #endif 655 #endif
655 } 656 }
656 657
657 void PrefProvider::SetClockForTesting(scoped_ptr<base::Clock> clock) { 658 void PrefProvider::SetClockForTesting(scoped_ptr<base::Clock> clock) {
658 clock_ = clock.Pass(); 659 clock_ = clock.Pass();
659 } 660 }
660 661
661 } // namespace content_settings 662 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698