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

Side by Side Diff: chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc

Issue 9994005: Separate handler initialization from page initialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dbeam review Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/options2/search_engine_manager_handler2.h" 5 #include "chrome/browser/ui/webui/options2/search_engine_manager_handler2.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 list_controller_->RemoveTemplateURL(index); 240 list_controller_->RemoveTemplateURL(index);
241 } 241 }
242 242
243 void SearchEngineManagerHandler::EditSearchEngine(const ListValue* args) { 243 void SearchEngineManagerHandler::EditSearchEngine(const ListValue* args) {
244 int index; 244 int index;
245 if (!ExtractIntegerValue(args, &index)) { 245 if (!ExtractIntegerValue(args, &index)) {
246 NOTREACHED(); 246 NOTREACHED();
247 return; 247 return;
248 } 248 }
249 249
250 // CHECK()s to track down the cause of crbug.com/121741.
251 CHECK(list_controller_.get());
252 CHECK(list_controller_->table_model());
253
254 // Allow -1, which means we are adding a new engine. 250 // Allow -1, which means we are adding a new engine.
255 if (index < -1 || index >= list_controller_->table_model()->RowCount()) 251 if (index < -1 || index >= list_controller_->table_model()->RowCount())
256 return; 252 return;
257 253
258 edit_controller_.reset(new EditSearchEngineController( 254 edit_controller_.reset(new EditSearchEngineController(
259 (index == -1) ? NULL : list_controller_->GetTemplateURL(index), this, 255 (index == -1) ? NULL : list_controller_->GetTemplateURL(index), this,
260 Profile::FromWebUI(web_ui()))); 256 Profile::FromWebUI(web_ui())));
261 } 257 }
262 258
263 void SearchEngineManagerHandler::OnEditedKeyword( 259 void SearchEngineManagerHandler::OnEditedKeyword(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 if (!args->GetString(ENGINE_NAME, &name) || 310 if (!args->GetString(ENGINE_NAME, &name) ||
315 !args->GetString(ENGINE_KEYWORD, &keyword) || 311 !args->GetString(ENGINE_KEYWORD, &keyword) ||
316 !args->GetString(ENGINE_URL, &url)) { 312 !args->GetString(ENGINE_URL, &url)) {
317 NOTREACHED(); 313 NOTREACHED();
318 return; 314 return;
319 } 315 }
320 edit_controller_->AcceptAddOrEdit(name, keyword, url); 316 edit_controller_->AcceptAddOrEdit(name, keyword, url);
321 } 317 }
322 318
323 } // namespace options2 319 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698