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

Unified Diff: chrome/browser/views/first_run_search_engine_view.cc

Issue 3007032: Minor fixes of search engine dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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/search_engines/template_url_prepopulate_data.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/first_run_search_engine_view.cc
===================================================================
--- chrome/browser/views/first_run_search_engine_view.cc (revision 54904)
+++ chrome/browser/views/first_run_search_engine_view.cc (working copy)
@@ -153,10 +153,12 @@
std::vector<const TemplateURL*> template_urls =
search_engines_model_->GetTemplateURLs();
- // If we have fewer than three search engines, signal that the search engine
- // experiment is over, leaving imported default search engine setting intact.
- if (template_urls.size() < 3)
+ // If we have fewer than two search engines, end search engine dialog
+ // immediately, leaving imported default search engine setting intact.
+ if (template_urls.size() < 2) {
+ MessageLoop::current()->Quit();
return;
+ }
std::vector<const TemplateURL*>::iterator search_engine_iter;
@@ -184,9 +186,12 @@
}
// Now that we know what size the logos should be, create new search engine
- // choices for the view:
+ // choices for the view. If there are 2 search engines, only show 2
+ // choices; for 3 or more, show 3 (unless the default is not one of the
+ // top 3, in which case show 4).
for (search_engine_iter = template_urls.begin();
- search_engine_iter < template_urls.begin() + 3;
+ search_engine_iter < template_urls.begin() +
+ (template_urls.size() < 3 ? 2 : 3);
++search_engine_iter) {
// Push first three engines into buttons:
SearchEngineChoice* choice = new SearchEngineChoice(this,
@@ -335,8 +340,10 @@
next_h_space = search_engine_choices_[1]->GetView()->x() + logo_width +
logo_padding;
- search_engine_choices_[2]->SetChoiceViewBounds(
- next_h_space, next_v_space, logo_width, logo_height);
+ if (num_choices > 2) {
+ search_engine_choices_[2]->SetChoiceViewBounds(
+ next_h_space, next_v_space, logo_width, logo_height);
+ }
if (num_choices > 3) {
next_h_space = search_engine_choices_[2]->GetView()->x() + logo_width +
@@ -359,8 +366,10 @@
search_engine_choices_[1]->SetBounds(next_h_space, next_v_space,
button_width, button_height);
next_h_space = search_engine_choices_[1]->x() + logo_width + logo_padding;
- search_engine_choices_[2]->SetBounds(next_h_space, next_v_space,
- button_width, button_height);
+ if (num_choices > 2) {
+ search_engine_choices_[2]->SetBounds(next_h_space, next_v_space,
+ button_width, button_height);
+ }
if (num_choices > 3) {
next_h_space = search_engine_choices_[2]->x() + logo_width +
« no previous file with comments | « chrome/browser/search_engines/template_url_prepopulate_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698