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

Side by Side Diff: chrome/browser/ui/search_engines/template_url_table_model.cc

Issue 231863008: Rename SetDefaultSearchProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 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/search_engines/template_url_table_model.h" 5 #include "chrome/browser/ui/search_engines/template_url_table_model.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 return -1; 335 return -1;
336 } 336 }
337 337
338 TemplateURL* keyword = GetTemplateURL(index); 338 TemplateURL* keyword = GetTemplateURL(index);
339 const TemplateURL* current_default = 339 const TemplateURL* current_default =
340 template_url_service_->GetDefaultSearchProvider(); 340 template_url_service_->GetDefaultSearchProvider();
341 if (current_default == keyword) 341 if (current_default == keyword)
342 return -1; 342 return -1;
343 343
344 template_url_service_->RemoveObserver(this); 344 template_url_service_->RemoveObserver(this);
345 template_url_service_->SetDefaultSearchProvider(keyword); 345 template_url_service_->SetUserSelectedDefaultSearchProvider(keyword);
346 template_url_service_->AddObserver(this); 346 template_url_service_->AddObserver(this);
347 347
348 // The formatting of the default engine is different; notify the table that 348 // The formatting of the default engine is different; notify the table that
349 // both old and new entries have changed. 349 // both old and new entries have changed.
350 if (current_default != NULL) { 350 if (current_default != NULL) {
351 int old_index = IndexOfTemplateURL(current_default); 351 int old_index = IndexOfTemplateURL(current_default);
352 // current_default may not be in the list of TemplateURLs if the database is 352 // current_default may not be in the list of TemplateURLs if the database is
353 // corrupt and the default TemplateURL is used from preferences 353 // corrupt and the default TemplateURL is used from preferences
354 if (old_index >= 0) 354 if (old_index >= 0)
355 NotifyChanged(old_index); 355 NotifyChanged(old_index);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 return entry.Pass(); 391 return entry.Pass();
392 } 392 }
393 393
394 void TemplateURLTableModel::AddEntry(int index, scoped_ptr<ModelEntry> entry) { 394 void TemplateURLTableModel::AddEntry(int index, scoped_ptr<ModelEntry> entry) {
395 entries_.insert(entries_.begin() + index, entry.release()); 395 entries_.insert(entries_.begin() + index, entry.release());
396 if (index <= last_other_engine_index_) 396 if (index <= last_other_engine_index_)
397 ++last_other_engine_index_; 397 ++last_other_engine_index_;
398 if (observer_) 398 if (observer_)
399 observer_->OnItemsAdded(index, 1); 399 observer_->OnItemsAdded(index, 1);
400 } 400 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper_unittest.cc ('k') | chrome/browser/ui/webui/options/browser_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698