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 <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 Loading... |
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 Loading... |
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 |
OLD | NEW |