summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-02 00:02:10 +0000
committerzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-02 00:02:10 +0000
commitedaa05ab147ea0e576dae69da7077957745c8ccc (patch)
tree8c5ff13d1158ae7771e132e2f0e11dec65448e58 /chrome
parentdff529739ad92782faaefbba447f7b7244c06ae4 (diff)
downloadchromium_src-edaa05ab147ea0e576dae69da7077957745c8ccc.zip
chromium_src-edaa05ab147ea0e576dae69da7077957745c8ccc.tar.gz
chromium_src-edaa05ab147ea0e576dae69da7077957745c8ccc.tar.bz2
Add a notification when the list of startup URLs change.
BUG=38557 TEST=Run two instances of chromes with difference profiles that are syncing. Change the startup pages. Check that the change propagates. Review URL: http://codereview.chromium.org/1562008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43413 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/pref_service.h2
-rw-r--r--chrome/browser/session_startup_pref.cc15
-rw-r--r--chrome/browser/views/options/general_page_view.cc1
3 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/pref_service.h b/chrome/browser/pref_service.h
index 85dd42c..20c2e9c 100644
--- a/chrome/browser/pref_service.h
+++ b/chrome/browser/pref_service.h
@@ -185,6 +185,8 @@ class PrefService : public NonThreadSafe,
virtual bool SerializeData(std::string* output);
private:
+ friend struct SessionStartupPref;
+
// Add a preference to the PreferenceMap. If the pref already exists, return
// false. This method takes ownership of |pref|.
void RegisterPreference(Preference* pref);
diff --git a/chrome/browser/session_startup_pref.cc b/chrome/browser/session_startup_pref.cc
index ff919d0..32d85d6 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/common/notification_service.h"
#include "chrome/common/pref_names.h"
namespace {
@@ -72,6 +73,20 @@ void SessionStartupPref::SetStartupPref(PrefService* prefs,
url_pref_list->Set(static_cast<int>(i),
new StringValue(UTF8ToWide(pref.urls[i].spec())));
}
+
+ std::wstring path_str(prefs::kURLsToRestoreOnStartup);
+ PrefService::PrefObserverMap::iterator observer_iterator =
+ prefs->pref_observers_.find(path_str);
+ if (observer_iterator != prefs->pref_observers_.end()) {
+ PrefService::NotificationObserverList::Iterator it(
+ *(observer_iterator->second));
+ NotificationObserver* observer;
+ while ((observer = it.GetNext()) != NULL) {
+ observer->Observe(NotificationType::PREF_CHANGED,
+ Source<PrefService>(prefs),
+ Details<std::wstring>(&path_str));
+ }
+ }
}
// static
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index 9cfc14f..5b86c35 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -156,7 +156,6 @@ void CustomHomePagesTableModel::Add(int index, const GURL& url) {
DCHECK(index >= 0 && index <= RowCount());
entries_.insert(entries_.begin() + static_cast<size_t>(index), Entry());
entries_[index].url = url;
- LoadFavIcon(&(entries_[index]));
if (observer_)
observer_->OnItemsAdded(index, 1);
}