OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/first_run.h" | 5 #include "chrome/browser/first_run.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 | 10 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 out_prefs->dont_import_items += importer::SEARCH_ENGINES; | 317 out_prefs->dont_import_items += importer::SEARCH_ENGINES; |
318 } | 318 } |
319 } | 319 } |
320 | 320 |
321 if (InSearchExperimentLocale() && | 321 if (InSearchExperimentLocale() && |
322 installer_util::GetDistroBooleanPreference(prefs.get(), | 322 installer_util::GetDistroBooleanPreference(prefs.get(), |
323 installer_util::master_preferences::kSearchEngineExperimentPref, | 323 installer_util::master_preferences::kSearchEngineExperimentPref, |
324 &value) && value) { | 324 &value) && value) { |
325 // Set the first run dialog to include the search choice window. | 325 // Set the first run dialog to include the search choice window. |
326 out_prefs->run_search_engine_experiment = true; | 326 out_prefs->run_search_engine_experiment = true; |
| 327 // Check to see if search engine logos should be randomized. |
| 328 if (installer_util::GetDistroBooleanPreference(prefs.get(), |
| 329 installer_util::master_preferences:: |
| 330 kSearchEngineExperimentRandomizePref, |
| 331 &value) && value) { |
| 332 out_prefs->randomize_search_engine_experiment = true; |
| 333 } |
327 // Set the first run bubble to minimal. | 334 // Set the first run bubble to minimal. |
328 FirstRun::SetMinimalFirstRunBubblePref(); | 335 FirstRun::SetMinimalFirstRunBubblePref(); |
329 } | 336 } |
330 | 337 |
331 // Note we are skipping all other master preferences if skip-first-run-ui | 338 // Note we are skipping all other master preferences if skip-first-run-ui |
332 // is *not* specified. | 339 // is *not* specified. |
333 if (!installer_util::GetDistroBooleanPreference(prefs.get(), | 340 if (!installer_util::GetDistroBooleanPreference(prefs.get(), |
334 installer_util::master_preferences::kDistroSkipFirstRunPref, &value) || | 341 installer_util::master_preferences::kDistroSkipFirstRunPref, &value) || |
335 !value) | 342 !value) |
336 return true; | 343 return true; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 if (!GetNewerChromeFile(&new_chrome_exe)) | 491 if (!GetNewerChromeFile(&new_chrome_exe)) |
485 return false; | 492 return false; |
486 return file_util::PathExists(new_chrome_exe); | 493 return file_util::PathExists(new_chrome_exe); |
487 } | 494 } |
488 | 495 |
489 bool OpenFirstRunDialog(Profile* profile, | 496 bool OpenFirstRunDialog(Profile* profile, |
490 bool homepage_defined, | 497 bool homepage_defined, |
491 int import_items, | 498 int import_items, |
492 int dont_import_items, | 499 int dont_import_items, |
493 bool search_engine_experiment, | 500 bool search_engine_experiment, |
| 501 bool randomize_search_engine_experiment, |
494 ProcessSingleton* process_singleton) { | 502 ProcessSingleton* process_singleton) { |
495 DCHECK(profile); | 503 DCHECK(profile); |
496 DCHECK(process_singleton); | 504 DCHECK(process_singleton); |
497 | 505 |
498 // We need the FirstRunView to outlive its parent, as we retrieve the accept | 506 // We need the FirstRunView to outlive its parent, as we retrieve the accept |
499 // state from it after the dialog has been closed. | 507 // state from it after the dialog has been closed. |
500 scoped_ptr<FirstRunView> first_run_view( | 508 scoped_ptr<FirstRunView> first_run_view( |
501 new FirstRunView(profile, | 509 new FirstRunView(profile, |
502 homepage_defined, | 510 homepage_defined, |
503 import_items, | 511 import_items, |
504 dont_import_items, | 512 dont_import_items, |
505 search_engine_experiment)); | 513 search_engine_experiment, |
| 514 randomize_search_engine_experiment)); |
506 first_run_view->set_parent_owned(false); | 515 first_run_view->set_parent_owned(false); |
507 views::Window* first_run_ui = views::Window::CreateChromeWindow( | 516 views::Window* first_run_ui = views::Window::CreateChromeWindow( |
508 NULL, gfx::Rect(), first_run_view.get()); | 517 NULL, gfx::Rect(), first_run_view.get()); |
509 DCHECK(first_run_ui); | 518 DCHECK(first_run_ui); |
510 | 519 |
511 // We need to avoid dispatching new tabs when we are doing the import | 520 // We need to avoid dispatching new tabs when we are doing the import |
512 // because that will lead to data corruption or a crash. Lock() does that. | 521 // because that will lead to data corruption or a crash. Lock() does that. |
513 // If a CopyData message does come in while the First Run UI is visible, | 522 // If a CopyData message does come in while the First Run UI is visible, |
514 // then we will attempt to set first_run_ui as the foreground window. | 523 // then we will attempt to set first_run_ui as the foreground window. |
515 process_singleton->Lock(first_run_ui->GetNativeWindow()); | 524 process_singleton->Lock(first_run_ui->GetNativeWindow()); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 | 1032 |
1024 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { | 1033 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { |
1025 if (version > 10000) { | 1034 if (version > 10000) { |
1026 // This is a test value. We want to make sure we exercise | 1035 // This is a test value. We want to make sure we exercise |
1027 // returning this early. See EarlyReturnTest test harness. | 1036 // returning this early. See EarlyReturnTest test harness. |
1028 return Upgrade::TD_NOT_NOW; | 1037 return Upgrade::TD_NOT_NOW; |
1029 } | 1038 } |
1030 TryChromeDialog td; | 1039 TryChromeDialog td; |
1031 return td.ShowModal(); | 1040 return td.ShowModal(); |
1032 } | 1041 } |
OLD | NEW |