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

Side by Side Diff: chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc

Issue 1845473002: MD Settings: convert startup pages to use BrowserProxy/WebUIListeners (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dschuyler review Created 4 years, 8 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
« no previous file with comments | « chrome/browser/resources/settings/settings_resources.grd ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ui/webui/settings/settings_startup_pages_handler.h" 5 #include "chrome/browser/ui/webui/settings/settings_startup_pages_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "chrome/browser/prefs/session_startup_pref.h" 10 #include "chrome/browser/prefs/session_startup_pref.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 for (int i = 0; i < page_count; ++i) { 52 for (int i = 0; i < page_count; ++i) {
53 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); 53 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
54 entry->SetString("title", startup_custom_pages_table_model_.GetText(i, 0)); 54 entry->SetString("title", startup_custom_pages_table_model_.GetText(i, 0));
55 entry->SetString("url", urls[i].spec()); 55 entry->SetString("url", urls[i].spec());
56 entry->SetString("tooltip", 56 entry->SetString("tooltip",
57 startup_custom_pages_table_model_.GetTooltip(i)); 57 startup_custom_pages_table_model_.GetTooltip(i));
58 entry->SetInteger("modelIndex", i); 58 entry->SetInteger("modelIndex", i);
59 startup_pages.Append(entry.release()); 59 startup_pages.Append(entry.release());
60 } 60 }
61 61
62 web_ui()->CallJavascriptFunction("Settings.updateStartupPages", 62 web_ui()->CallJavascriptFunction("cr.webUIListenerCallback",
63 base::StringValue("update-startup-pages"),
63 startup_pages); 64 startup_pages);
64 } 65 }
65 66
66 void StartupPagesHandler::OnItemsChanged(int start, int length) { 67 void StartupPagesHandler::OnItemsChanged(int start, int length) {
67 OnModelChanged(); 68 OnModelChanged();
68 } 69 }
69 70
70 void StartupPagesHandler::OnItemsAdded(int start, int length) { 71 void StartupPagesHandler::OnItemsAdded(int start, int length) {
71 OnModelChanged(); 72 OnModelChanged();
72 } 73 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 158
158 void StartupPagesHandler::UpdateStartupPages() { 159 void StartupPagesHandler::UpdateStartupPages() {
159 const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref( 160 const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref(
160 Profile::FromWebUI(web_ui())->GetPrefs()); 161 Profile::FromWebUI(web_ui())->GetPrefs());
161 startup_custom_pages_table_model_.SetURLs(startup_pref.urls); 162 startup_custom_pages_table_model_.SetURLs(startup_pref.urls);
162 // The change will go to the JS code in the 163 // The change will go to the JS code in the
163 // StartupPagesHandler::OnModelChanged() method. 164 // StartupPagesHandler::OnModelChanged() method.
164 } 165 }
165 166
166 } // namespace settings 167 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698