| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 | 125 |
| 126 void StartupPagesHandler::HandleEditStartupPage(const base::ListValue* args) { | 126 void StartupPagesHandler::HandleEditStartupPage(const base::ListValue* args) { |
| 127 CHECK_EQ(args->GetSize(), 3U); | 127 CHECK_EQ(args->GetSize(), 3U); |
| 128 const base::Value* callback_id; | 128 const base::Value* callback_id; |
| 129 CHECK(args->Get(0, &callback_id)); | 129 CHECK(args->Get(0, &callback_id)); |
| 130 int index; | 130 int index; |
| 131 CHECK(args->GetInteger(1, &index)); | 131 CHECK(args->GetInteger(1, &index)); |
| 132 | 132 |
| 133 if (index < 0 || index > startup_custom_pages_table_model_.RowCount()) { | 133 if (index < 0 || index > startup_custom_pages_table_model_.RowCount()) { |
| 134 RejectJavascriptCallback(*callback_id, *base::Value::CreateNullValue()); | 134 RejectJavascriptCallback(*callback_id, base::Value()); |
| 135 NOTREACHED(); | 135 NOTREACHED(); |
| 136 return; | 136 return; |
| 137 } | 137 } |
| 138 | 138 |
| 139 std::string url_string; | 139 std::string url_string; |
| 140 CHECK(args->GetString(2, &url_string)); | 140 CHECK(args->GetString(2, &url_string)); |
| 141 | 141 |
| 142 GURL fixed_url; | 142 GURL fixed_url; |
| 143 if (settings_utils::FixupAndValidateStartupPage(url_string, &fixed_url)) { | 143 if (settings_utils::FixupAndValidateStartupPage(url_string, &fixed_url)) { |
| 144 std::vector<GURL> urls = startup_custom_pages_table_model_.GetURLs(); | 144 std::vector<GURL> urls = startup_custom_pages_table_model_.GetURLs(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 void StartupPagesHandler::UpdateStartupPages() { | 194 void StartupPagesHandler::UpdateStartupPages() { |
| 195 const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref( | 195 const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref( |
| 196 Profile::FromWebUI(web_ui())->GetPrefs()); | 196 Profile::FromWebUI(web_ui())->GetPrefs()); |
| 197 startup_custom_pages_table_model_.SetURLs(startup_pref.urls); | 197 startup_custom_pages_table_model_.SetURLs(startup_pref.urls); |
| 198 // The change will go to the JS code in the | 198 // The change will go to the JS code in the |
| 199 // StartupPagesHandler::OnModelChanged() method. | 199 // StartupPagesHandler::OnModelChanged() method. |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace settings | 202 } // namespace settings |
| OLD | NEW |