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

Unified Diff: chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc

Issue 1634353002: [MD settings] delay SetObserver in StartupUrl settings until page is loaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review nit Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc
diff --git a/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc b/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc
index e9b7be0940379515db33db302917385c61039bc9..233df7c3022041e7d9874885b1c08b363cf80017 100644
--- a/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc
+++ b/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc
@@ -26,22 +26,6 @@ void StartupPagesHandler::RegisterMessages() {
if (Profile::FromWebUI(web_ui())->IsOffTheRecord())
return;
- startup_custom_pages_table_model_.SetObserver(this);
-
- PrefService* prefService = Profile::FromWebUI(web_ui())->GetPrefs();
- SessionStartupPref pref = SessionStartupPref::GetStartupPref(
- prefService);
- startup_custom_pages_table_model_.SetURLs(pref.urls);
-
- if (pref.urls.empty())
- pref.type = SessionStartupPref::DEFAULT;
-
- pref_change_registrar_.Init(prefService);
- pref_change_registrar_.Add(
- prefs::kURLsToRestoreOnStartup,
- base::Bind(&StartupPagesHandler::UpdateStartupPages,
- base::Unretained(this)));
-
web_ui()->RegisterMessageCallback("addStartupPage",
base::Bind(&StartupPagesHandler::AddStartupPage,
base::Unretained(this)));
@@ -109,6 +93,22 @@ void StartupPagesHandler::AddStartupPage(const base::ListValue* args) {
}
void StartupPagesHandler::OnStartupPrefsPageLoad(const base::ListValue* args) {
+ startup_custom_pages_table_model_.SetObserver(this);
+
+ PrefService* prefService = Profile::FromWebUI(web_ui())->GetPrefs();
+ SessionStartupPref pref = SessionStartupPref::GetStartupPref(
+ prefService);
+ startup_custom_pages_table_model_.SetURLs(pref.urls);
+
+ if (pref.urls.empty())
+ pref.type = SessionStartupPref::DEFAULT;
+
+ pref_change_registrar_.Init(prefService);
+ pref_change_registrar_.Add(
+ prefs::kURLsToRestoreOnStartup,
+ base::Bind(&StartupPagesHandler::UpdateStartupPages,
+ base::Unretained(this)));
+
const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref(
Profile::FromWebUI(web_ui())->GetPrefs());
startup_custom_pages_table_model_.SetURLs(startup_pref.urls);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698