diff options
author | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 01:00:48 +0000 |
---|---|---|
committer | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 01:00:48 +0000 |
commit | 21c52bd950c03e810d3e25b65e15c06d92eb547e (patch) | |
tree | 20581d659e93857462ddce1acc794cf0e1f5d507 /chrome/browser/ui | |
parent | f1933791ead4e0c44066287396f0475e95a2e1e3 (diff) | |
download | chromium_src-21c52bd950c03e810d3e25b65e15c06d92eb547e.zip chromium_src-21c52bd950c03e810d3e25b65e15c06d92eb547e.tar.gz chromium_src-21c52bd950c03e810d3e25b65e15c06d92eb547e.tar.bz2 |
Support drag&drop for startup pages
BUG=69686
TEST=Drag & drop individual or multiple startup pages, confirm D&D works
Review URL: http://codereview.chromium.org/7044136
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88936 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r-- | chrome/browser/ui/webui/options/browser_options_handler.cc | 27 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/browser_options_handler.h | 3 |
2 files changed, 30 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(); diff --git a/chrome/browser/ui/webui/options/browser_options_handler.h b/chrome/browser/ui/webui/options/browser_options_handler.h index 7264581..021a747 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.h +++ b/chrome/browser/ui/webui/options/browser_options_handler.h @@ -79,6 +79,9 @@ class BrowserOptionsHandler : public OptionsPageUIHandler, // Sets the startup page set to the current pages. Called from WebUI. void SetStartupPagesToCurrentPages(const ListValue* args); + // Writes the current set of startup pages to prefs. Called from WebUI. + void DragDropStartupPage(const ListValue* args); + // Gets autocomplete suggestions asychronously for the given string. // Called from WebUI. void RequestAutocompleteSuggestions(const ListValue* args); |