Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: chrome/browser/ui/webui/options/startup_pages_handler.cc

Issue 12548008: Really fix crash when dragging and dropping in chrome://settings/startup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Trim quotes Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/startup_overlay.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/startup_pages_handler.cc
diff --git a/chrome/browser/ui/webui/options/startup_pages_handler.cc b/chrome/browser/ui/webui/options/startup_pages_handler.cc
index c0b208ebbf9c63b55e4a32a01fc232f65dbdeb90..b6f90421720127590e4dc42ad8dc7c3b729077ab 100644
--- a/chrome/browser/ui/webui/options/startup_pages_handler.cc
+++ b/chrome/browser/ui/webui/options/startup_pages_handler.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/prefs/pref_service.h"
-#include "base/strings/string_number_conversions.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_controller.h"
#include "chrome/browser/autocomplete/autocomplete_input.h"
@@ -113,7 +112,7 @@ void StartupPagesHandler::OnModelChanged() {
entry->SetString("url", urls[i].spec());
entry->SetString("tooltip",
startup_custom_pages_table_model_->GetTooltip(i));
- entry->SetString("modelIndex", base::IntToString(i));
+ entry->SetInteger("modelIndex", i);
startup_pages.Append(entry);
}
@@ -140,11 +139,9 @@ void StartupPagesHandler::SetStartupPagesToCurrentPages(
void StartupPagesHandler::RemoveStartupPages(const ListValue* args) {
for (int i = args->GetSize() - 1; i >= 0; --i) {
- std::string string_value;
- CHECK(args->GetString(i, &string_value));
-
int selected_index;
- base::StringToInt(string_value, &selected_index);
+ CHECK(args->GetInteger(i, &selected_index));
+
if (selected_index < 0 ||
selected_index >= startup_custom_pages_table_model_->RowCount()) {
NOTREACHED();
@@ -168,11 +165,9 @@ void StartupPagesHandler::AddStartupPage(const ListValue* args) {
void StartupPagesHandler::EditStartupPage(const ListValue* args) {
std::string url_string;
- std::string index_string;
int index;
CHECK_EQ(args->GetSize(), 2U);
- CHECK(args->GetString(0, &index_string));
- CHECK(base::StringToInt(index_string, &index));
+ CHECK(args->GetInteger(0, &index));
CHECK(args->GetString(1, &url_string));
if (index < 0 || index > startup_custom_pages_table_model_->RowCount()) {
@@ -188,17 +183,9 @@ void StartupPagesHandler::EditStartupPage(const ListValue* args) {
void StartupPagesHandler::DragDropStartupPage(const ListValue* args) {
CHECK_EQ(args->GetSize(), 2U);
- // TODO(dcheng): Due to http://crbug.com/122102, we can receive drag and drop
- // events even if there are no entries in the model. Remove this check once
- // that bug is fixed.
- if (startup_custom_pages_table_model_->RowCount() == 0)
- return;
-
- std::string value;
int to_index;
- CHECK(args->GetString(0, &value));
- base::StringToInt(value, &to_index);
+ CHECK(args->GetInteger(0, &to_index));
const ListValue* selected;
CHECK(args->GetList(1, &selected));
@@ -206,8 +193,7 @@ void StartupPagesHandler::DragDropStartupPage(const ListValue* args) {
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);
+ CHECK(selected->GetInteger(i, &index));
index_list.push_back(index);
}
« no previous file with comments | « chrome/browser/resources/options/startup_overlay.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698