| Index: chrome/browser/ui/webui/options/browser_options_handler.cc
|
| diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| index 6a31815782c5918746e5954af9d78fd0f2a6b24b..3eadb9aaab8dcdbf2063e33e0911dbf5455610ee 100644
|
| --- a/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| @@ -114,6 +114,9 @@ void BrowserOptionsHandler::RegisterMessages() {
|
| "setStartupPagesToCurrentPages",
|
| NewCallback(this, &BrowserOptionsHandler::SetStartupPagesToCurrentPages));
|
| web_ui_->RegisterMessageCallback(
|
| + "dragDropStartupPage",
|
| + NewCallback(this, &BrowserOptionsHandler::DragDropStartupPage));
|
| + web_ui_->RegisterMessageCallback(
|
| "requestAutocompleteSuggestions",
|
| NewCallback(this,
|
| &BrowserOptionsHandler::RequestAutocompleteSuggestions));
|
| @@ -405,6 +408,30 @@ void BrowserOptionsHandler::EditStartupPage(const ListValue* args) {
|
| startup_custom_pages_table_model_->SetURLs(urls);
|
| }
|
|
|
| +void BrowserOptionsHandler::DragDropStartupPage(const ListValue* args) {
|
| + CHECK_EQ(args->GetSize(), 2U);
|
| +
|
| + std::string value;
|
| + int to_index;
|
| +
|
| + CHECK(args->GetString(0, &value));
|
| + base::StringToInt(value, &to_index);
|
| +
|
| + ListValue* selected;
|
| + CHECK(args->GetList(1, &selected));
|
| +
|
| + std::vector<int> index_list;
|
| + for (size_t i = 0; i < selected->GetSize(); ++i) {
|
| + int index;
|
| + CHECK(selected->GetString(i, &value));
|
| + base::StringToInt(value, &index);
|
| + index_list.push_back(index);
|
| + }
|
| +
|
| + startup_custom_pages_table_model_->MoveURLs(to_index, index_list);
|
| + SaveStartupPagesPref();
|
| +}
|
| +
|
| void BrowserOptionsHandler::SaveStartupPagesPref() {
|
| PrefService* prefs = web_ui_->GetProfile()->GetPrefs();
|
|
|
|
|