summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/options/browser_options_handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/webui/options/browser_options_handler.cc')
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 6a31815..3eadb9a 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();