OLD | NEW |
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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); | 79 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); |
80 entry->SetString("title", startup_custom_pages_table_model_.GetText(i, 0)); | 80 entry->SetString("title", startup_custom_pages_table_model_.GetText(i, 0)); |
81 entry->SetString("url", urls[i].spec()); | 81 entry->SetString("url", urls[i].spec()); |
82 entry->SetString("tooltip", | 82 entry->SetString("tooltip", |
83 startup_custom_pages_table_model_.GetTooltip(i)); | 83 startup_custom_pages_table_model_.GetTooltip(i)); |
84 entry->SetInteger("modelIndex", i); | 84 entry->SetInteger("modelIndex", i); |
85 startup_pages.Append(std::move(entry)); | 85 startup_pages.Append(std::move(entry)); |
86 } | 86 } |
87 | 87 |
88 CallJavascriptFunction("cr.webUIListenerCallback", | 88 CallJavascriptFunction("cr.webUIListenerCallback", |
89 base::StringValue("update-startup-pages"), | 89 base::Value("update-startup-pages"), startup_pages); |
90 startup_pages); | |
91 } | 90 } |
92 | 91 |
93 void StartupPagesHandler::OnItemsChanged(int start, int length) { | 92 void StartupPagesHandler::OnItemsChanged(int start, int length) { |
94 OnModelChanged(); | 93 OnModelChanged(); |
95 } | 94 } |
96 | 95 |
97 void StartupPagesHandler::OnItemsAdded(int start, int length) { | 96 void StartupPagesHandler::OnItemsAdded(int start, int length) { |
98 OnModelChanged(); | 97 OnModelChanged(); |
99 } | 98 } |
100 | 99 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 210 |
212 void StartupPagesHandler::UpdateStartupPages() { | 211 void StartupPagesHandler::UpdateStartupPages() { |
213 const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref( | 212 const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref( |
214 Profile::FromWebUI(web_ui())->GetPrefs()); | 213 Profile::FromWebUI(web_ui())->GetPrefs()); |
215 startup_custom_pages_table_model_.SetURLs(startup_pref.urls); | 214 startup_custom_pages_table_model_.SetURLs(startup_pref.urls); |
216 // The change will go to the JS code in the | 215 // The change will go to the JS code in the |
217 // StartupPagesHandler::OnModelChanged() method. | 216 // StartupPagesHandler::OnModelChanged() method. |
218 } | 217 } |
219 | 218 |
220 } // namespace settings | 219 } // namespace settings |
OLD | NEW |