diff options
author | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-04 09:03:15 +0000 |
---|---|---|
committer | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-04 09:03:15 +0000 |
commit | 8c8ba50c176b3f8a12069f79e997cc935394f605 (patch) | |
tree | 3ec30c90081bb4cdf6e85c26752aaf13c0bce8f6 /chrome | |
parent | 2814695e0c32cbe3ace0922f17b16fa585c4cae2 (diff) | |
download | chromium_src-8c8ba50c176b3f8a12069f79e997cc935394f605.zip chromium_src-8c8ba50c176b3f8a12069f79e997cc935394f605.tar.gz chromium_src-8c8ba50c176b3f8a12069f79e997cc935394f605.tar.bz2 |
Get rid of PrefService::GetMutableDictionary/GetMutableList
BUG=77914
TEST=none, trybots remain green
Review URL: http://codereview.chromium.org/6791013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80298 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
3 files changed, 21 insertions, 19 deletions
diff --git a/chrome/browser/geolocation/access_token_store.cc b/chrome/browser/geolocation/access_token_store.cc index 78de68f..f76bcc5 100644 --- a/chrome/browser/geolocation/access_token_store.cc +++ b/chrome/browser/geolocation/access_token_store.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "googleurl/src/gurl.h" @@ -67,9 +68,9 @@ void ChromePrefsAccessTokenStore::DoLoadAccessTokens( void SetAccessTokenOnUIThread(const GURL& server_url, const string16& token) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DictionaryValue* access_token_dictionary = - g_browser_process->local_state()->GetMutableDictionary( - prefs::kGeolocationAccessToken); + DictionaryPrefUpdate update(g_browser_process->local_state(), + prefs::kGeolocationAccessToken); + DictionaryValue* access_token_dictionary = update.Get(); access_token_dictionary->SetWithoutPathExpansion( server_url.spec(), Value::CreateStringValue(token)); } diff --git a/chrome/browser/geolocation/geolocation_content_settings_map.cc b/chrome/browser/geolocation/geolocation_content_settings_map.cc index afeeb6e..5239bf2 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_map.cc +++ b/chrome/browser/geolocation/geolocation_content_settings_map.cc @@ -159,11 +159,9 @@ void GeolocationContentSettingsMap::SetContentSetting( if (!profile_) return; PrefService* prefs = profile_->GetPrefs(); - DictionaryValue* all_settings_dictionary = prefs->GetMutableDictionary( - prefs::kGeolocationContentSettings); - DCHECK(all_settings_dictionary); - ScopedUserPrefUpdate update(prefs, prefs::kGeolocationContentSettings); + DictionaryPrefUpdate update(prefs, prefs::kGeolocationContentSettings); + DictionaryValue* all_settings_dictionary = update.Get(); DictionaryValue* requesting_origin_settings_dictionary = NULL; all_settings_dictionary->GetDictionaryWithoutPathExpansion( requesting_origin.spec(), &requesting_origin_settings_dictionary); diff --git a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc index 8f77158..c5514ce 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc +++ b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc @@ -6,6 +6,7 @@ #include "chrome/browser/content_settings/content_settings_details.h" #include "chrome/browser/geolocation/geolocation_content_settings_map.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" @@ -247,17 +248,19 @@ TEST_F(GeolocationContentSettingsMapTests, WildCardForEmptyEmbedder) { TEST_F(GeolocationContentSettingsMapTests, IgnoreInvalidURLsInPrefs) { TestingProfile profile; - DictionaryValue* all_settings_dictionary = - profile.GetPrefs()->GetMutableDictionary( - prefs::kGeolocationContentSettings); - // For simplicity, use the overloads that do path expansion. As '.' is the - // path separator, we can't have dotted hostnames (which is fine). - all_settings_dictionary->SetInteger("http://a/.http://b/", - CONTENT_SETTING_ALLOW); - all_settings_dictionary->SetInteger("bad_requester.http://b/", - CONTENT_SETTING_ALLOW); - all_settings_dictionary->SetInteger("http://a/.bad-embedder", - CONTENT_SETTING_ALLOW); + { + DictionaryPrefUpdate update(profile.GetPrefs(), + prefs::kGeolocationContentSettings); + DictionaryValue* all_settings_dictionary = update.Get(); + // For simplicity, use the overloads that do path expansion. As '.' is the + // path separator, we can't have dotted hostnames (which is fine). + all_settings_dictionary->SetInteger("http://a/.http://b/", + CONTENT_SETTING_ALLOW); + all_settings_dictionary->SetInteger("bad_requester.http://b/", + CONTENT_SETTING_ALLOW); + all_settings_dictionary->SetInteger("http://a/.bad-embedder", + CONTENT_SETTING_ALLOW); + } GeolocationContentSettingsMap* map = profile.GetGeolocationContentSettingsMap(); |