| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 for (int i = 0; i < page_count; ++i) { | 75 for (int i = 0; i < page_count; ++i) { |
| 76 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); | 76 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); |
| 77 entry->SetString("title", startup_custom_pages_table_model_.GetText(i, 0)); | 77 entry->SetString("title", startup_custom_pages_table_model_.GetText(i, 0)); |
| 78 entry->SetString("url", urls[i].spec()); | 78 entry->SetString("url", urls[i].spec()); |
| 79 entry->SetString("tooltip", | 79 entry->SetString("tooltip", |
| 80 startup_custom_pages_table_model_.GetTooltip(i)); | 80 startup_custom_pages_table_model_.GetTooltip(i)); |
| 81 entry->SetInteger("modelIndex", i); | 81 entry->SetInteger("modelIndex", i); |
| 82 startup_pages.Append(std::move(entry)); | 82 startup_pages.Append(std::move(entry)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 CallJavascriptFunction("cr.webUIListenerCallback", | 85 FireWebUIListener("update-startup-pages", startup_pages); |
| 86 base::Value("update-startup-pages"), startup_pages); | |
| 87 } | 86 } |
| 88 | 87 |
| 89 void StartupPagesHandler::OnItemsChanged(int start, int length) { | 88 void StartupPagesHandler::OnItemsChanged(int start, int length) { |
| 90 OnModelChanged(); | 89 OnModelChanged(); |
| 91 } | 90 } |
| 92 | 91 |
| 93 void StartupPagesHandler::OnItemsAdded(int start, int length) { | 92 void StartupPagesHandler::OnItemsAdded(int start, int length) { |
| 94 OnModelChanged(); | 93 OnModelChanged(); |
| 95 } | 94 } |
| 96 | 95 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 192 |
| 194 void StartupPagesHandler::UpdateStartupPages() { | 193 void StartupPagesHandler::UpdateStartupPages() { |
| 195 const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref( | 194 const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref( |
| 196 Profile::FromWebUI(web_ui())->GetPrefs()); | 195 Profile::FromWebUI(web_ui())->GetPrefs()); |
| 197 startup_custom_pages_table_model_.SetURLs(startup_pref.urls); | 196 startup_custom_pages_table_model_.SetURLs(startup_pref.urls); |
| 198 // The change will go to the JS code in the | 197 // The change will go to the JS code in the |
| 199 // StartupPagesHandler::OnModelChanged() method. | 198 // StartupPagesHandler::OnModelChanged() method. |
| 200 } | 199 } |
| 201 | 200 |
| 202 } // namespace settings | 201 } // namespace settings |
| OLD | NEW |