summaryrefslogtreecommitdiffstats
path: root/chrome/browser/session_startup_pref.cc
diff options
context:
space:
mode:
authorchron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-05 23:56:16 +0000
committerchron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-05 23:56:16 +0000
commitdd8fa1a9964a4b68eea27675be52a8aceda3af0f (patch)
treed81363972e96ef6a36118846eed1d2ec0d556e35 /chrome/browser/session_startup_pref.cc
parent585926926a4dc5d5f1b99b7ec8ad00368b289aa6 (diff)
downloadchromium_src-dd8fa1a9964a4b68eea27675be52a8aceda3af0f.zip
chromium_src-dd8fa1a9964a4b68eea27675be52a8aceda3af0f.tar.gz
chromium_src-dd8fa1a9964a4b68eea27675be52a8aceda3af0f.tar.bz2
Add a scoped notifier for pref dictionaries / lists.
Other options included subclassing the pref value types, making the firenotifications public, or just friend classing. Since values can contain other values, such as dictionary within dictionary, it didn't seem like a good idea to subclass. We might want to consider combining the scoped lookup with the GetMutableList call at some point, but some callers keep a long reference so that might be a bad idea. BUG=38557 TEST=manual Review URL: http://codereview.chromium.org/1549020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43678 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/session_startup_pref.cc')
-rw-r--r--chrome/browser/session_startup_pref.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/chrome/browser/session_startup_pref.cc b/chrome/browser/session_startup_pref.cc
index ff919d0..1da5802 100644
--- a/chrome/browser/session_startup_pref.cc
+++ b/chrome/browser/session_startup_pref.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/defaults.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/scoped_pref_update.h"
#include "chrome/common/pref_names.h"
namespace {
@@ -64,6 +65,7 @@ void SessionStartupPref::SetStartupPref(PrefService* prefs,
// Always save the URLs, that way the UI can remain consistent even if the
// user changes the startup type pref.
// Ownership of the ListValue retains with the pref service.
+ ScopedPrefUpdate update(prefs, prefs::kURLsToRestoreOnStartup);
ListValue* url_pref_list =
prefs->GetMutableList(prefs::kURLsToRestoreOnStartup);
DCHECK(url_pref_list);