 Chromium Code Reviews
 Chromium Code Reviews Issue 2808006:
  Allow randomized search engines in selection dialog....  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/
    
  
    Issue 2808006:
  Allow randomized search engines in selection dialog....  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/| Index: chrome/browser/views/first_run_search_engine_view.cc | 
| =================================================================== | 
| --- chrome/browser/views/first_run_search_engine_view.cc (revision 49796) | 
| +++ chrome/browser/views/first_run_search_engine_view.cc (working copy) | 
| @@ -4,11 +4,13 @@ | 
| #include "chrome/browser/views/first_run_search_engine_view.h" | 
| +#include <algorithm> | 
| #include <map> | 
| #include "app/l10n_util.h" | 
| #include "app/resource_bundle.h" | 
| #include "base/i18n/rtl.h" | 
| +#include "base/time.h" | 
| #include "chrome/browser/options_window.h" | 
| #include "chrome/browser/profile.h" | 
| #include "chrome/browser/search_engines/template_url.h" | 
| @@ -29,6 +31,7 @@ | 
| #include "views/view_text_utils.h" | 
| #include "views/window/window.h" | 
| +using base::Time; | 
| using TemplateURLPrepopulateData::SearchEngineType; | 
| namespace { | 
| @@ -156,10 +159,11 @@ | 
| } | 
| FirstRunSearchEngineView::FirstRunSearchEngineView( | 
| - SearchEngineSelectionObserver* observer, Profile* profile) | 
| + SearchEngineSelectionObserver* observer, Profile* profile, bool randomize) | 
| : profile_(profile), | 
| observer_(observer), | 
| - text_direction_is_rtl_(base::i18n::IsRTL()) { | 
| + text_direction_is_rtl_(base::i18n::IsRTL()), | 
| + randomize_(randomize) { | 
| DCHECK(observer); | 
| // Don't show ourselves until all the search engines have loaded from | 
| // the profile -- otherwise we have nothing to show. | 
| @@ -250,6 +254,14 @@ | 
| AddChildView(default_choice); // The button associated with the choice. | 
| } | 
| + // Randomize order of logos if option has been set. | 
| + if (randomize_) { | 
| + int seed = static_cast<int>(Time::Now().ToInternalValue()); | 
| + srand(seed); | 
| + std::random_shuffle(search_engine_choices_.begin(), | 
| + search_engine_choices_.end()); | 
| 
mattm
2010/06/16 00:20:26
I guess it's not really important for this usage,
 
Miranda Callahan
2010/06/16 15:30:00
Good idea -- I'll file a bug for it, but will let
 | 
| + } | 
| + | 
| // Now that we know how many logos to show, lay out and become visible. | 
| SetVisible(true); | 
| Layout(); |