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

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

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again; base::File changes conflicted. Created 7 years, 10 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_default_provider.h" 5 #include "chrome/browser/content_settings/content_settings_default_provider.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "chrome/browser/content_settings/content_settings_rule.h" 14 #include "chrome/browser/content_settings/content_settings_rule.h"
15 #include "chrome/browser/content_settings/content_settings_utils.h" 15 #include "chrome/browser/content_settings/content_settings_utils.h"
16 #include "chrome/browser/prefs/pref_registry_syncable.h"
16 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/prefs/scoped_user_pref_update.h" 18 #include "chrome/browser/prefs/scoped_user_pref_update.h"
18 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/content_settings.h" 20 #include "chrome/common/content_settings.h"
20 #include "chrome/common/content_settings_pattern.h" 21 #include "chrome/common/content_settings_pattern.h"
21 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/notification_details.h" 24 #include "content/public/browser/notification_details.h"
24 #include "content/public/browser/notification_source.h" 25 #include "content/public/browser/notification_source.h"
25 #include "content/public/browser/user_metrics.h" 26 #include "content/public/browser/user_metrics.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 value_.release()); 81 value_.release());
81 } 82 }
82 83
83 private: 84 private:
84 scoped_ptr<base::Value> value_; 85 scoped_ptr<base::Value> value_;
85 }; 86 };
86 87
87 } // namespace 88 } // namespace
88 89
89 // static 90 // static
90 void DefaultProvider::RegisterUserPrefs(PrefServiceSyncable* prefs) { 91 void DefaultProvider::RegisterUserPrefs(PrefRegistrySyncable* registry) {
91 // The registration of the preference prefs::kDefaultContentSettings should 92 // The registration of the preference prefs::kDefaultContentSettings should
92 // also include the default values for default content settings. This allows 93 // also include the default values for default content settings. This allows
93 // functional tests to get default content settings by reading the preference 94 // functional tests to get default content settings by reading the preference
94 // prefs::kDefaultContentSettings via pyauto. 95 // prefs::kDefaultContentSettings via pyauto.
95 // TODO(markusheintz): Write pyauto hooks for the content settings map as 96 // TODO(markusheintz): Write pyauto hooks for the content settings map as
96 // content settings should be read from the host content settings map. 97 // content settings should be read from the host content settings map.
97 DictionaryValue* default_content_settings = new DictionaryValue(); 98 DictionaryValue* default_content_settings = new DictionaryValue();
98 prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings, 99 registry->RegisterDictionaryPref(prefs::kDefaultContentSettings,
99 default_content_settings, 100 default_content_settings,
100 PrefServiceSyncable::SYNCABLE_PREF); 101 PrefRegistrySyncable::SYNCABLE_PREF);
101 } 102 }
102 103
103 DefaultProvider::DefaultProvider(PrefService* prefs, bool incognito) 104 DefaultProvider::DefaultProvider(PrefService* prefs, bool incognito)
104 : prefs_(prefs), 105 : prefs_(prefs),
105 is_incognito_(incognito), 106 is_incognito_(incognito),
106 updating_preferences_(false) { 107 updating_preferences_(false) {
107 DCHECK(prefs_); 108 DCHECK(prefs_);
108 109
109 // Read global defaults. 110 // Read global defaults.
110 ReadDefaultSettings(true); 111 ReadDefaultSettings(true);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // Migrate obsolete cookie prompt mode. 326 // Migrate obsolete cookie prompt mode.
326 if (ValueToContentSetting( 327 if (ValueToContentSetting(
327 default_settings_[CONTENT_SETTINGS_TYPE_COOKIES].get()) == 328 default_settings_[CONTENT_SETTINGS_TYPE_COOKIES].get()) ==
328 CONTENT_SETTING_ASK) { 329 CONTENT_SETTING_ASK) {
329 default_settings_[CONTENT_SETTINGS_TYPE_COOKIES].reset( 330 default_settings_[CONTENT_SETTINGS_TYPE_COOKIES].reset(
330 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); 331 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK));
331 } 332 }
332 } 333 }
333 334
334 } // namespace content_settings 335 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698