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/first_run.h" | 5 #include "chrome/browser/first_run/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 13 matching lines...) Expand all Loading... |
24 #include "base/string_split.h" | 24 #include "base/string_split.h" |
25 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
26 #include "base/win/registry.h" | 26 #include "base/win/registry.h" |
27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
28 #include "chrome/browser/extensions/extensions_service.h" | 28 #include "chrome/browser/extensions/extensions_service.h" |
29 #include "chrome/browser/extensions/extension_updater.h" | 29 #include "chrome/browser/extensions/extension_updater.h" |
30 #include "chrome/browser/importer/importer.h" | 30 #include "chrome/browser/importer/importer.h" |
31 #include "chrome/browser/metrics/user_metrics.h" | 31 #include "chrome/browser/metrics/user_metrics.h" |
32 #include "chrome/browser/process_singleton.h" | 32 #include "chrome/browser/process_singleton.h" |
33 #include "chrome/browser/profile.h" | 33 #include "chrome/browser/profile.h" |
| 34 #include "chrome/browser/search_engines/template_url_model.h" |
34 #include "chrome/browser/views/first_run_search_engine_view.h" | 35 #include "chrome/browser/views/first_run_search_engine_view.h" |
35 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/notification_service.h" | 37 #include "chrome/common/notification_service.h" |
37 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
38 #include "chrome/common/worker_thread_ticker.h" | 39 #include "chrome/common/worker_thread_ticker.h" |
39 #include "chrome/installer/util/browser_distribution.h" | 40 #include "chrome/installer/util/browser_distribution.h" |
40 #include "chrome/installer/util/google_update_constants.h" | 41 #include "chrome/installer/util/google_update_constants.h" |
41 #include "chrome/installer/util/google_update_settings.h" | 42 #include "chrome/installer/util/google_update_settings.h" |
42 #include "chrome/installer/util/install_util.h" | 43 #include "chrome/installer/util/install_util.h" |
43 #include "chrome/installer/util/shell_util.h" | 44 #include "chrome/installer/util/shell_util.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 // static | 447 // static |
447 bool FirstRun::IsOrganic() { | 448 bool FirstRun::IsOrganic() { |
448 std::wstring brand; | 449 std::wstring brand; |
449 GoogleUpdateSettings::GetBrand(&brand); | 450 GoogleUpdateSettings::GetBrand(&brand); |
450 return GoogleUpdateSettings::IsOrganic(brand); | 451 return GoogleUpdateSettings::IsOrganic(brand); |
451 } | 452 } |
452 | 453 |
453 // static | 454 // static |
454 void FirstRun::ShowFirstRunDialog(Profile* profile, | 455 void FirstRun::ShowFirstRunDialog(Profile* profile, |
455 bool randomize_search_engine_experiment) { | 456 bool randomize_search_engine_experiment) { |
| 457 // If the default search is managed via policy, we don't ask the user to |
| 458 // choose. |
| 459 TemplateURLModel* model = profile->GetTemplateURLModel(); |
| 460 if (NULL == model || model->is_default_search_managed()) |
| 461 return; |
| 462 |
456 views::Window* search_engine_dialog = views::Window::CreateChromeWindow( | 463 views::Window* search_engine_dialog = views::Window::CreateChromeWindow( |
457 NULL, | 464 NULL, |
458 gfx::Rect(), | 465 gfx::Rect(), |
459 new FirstRunSearchEngineView(profile, | 466 new FirstRunSearchEngineView(profile, |
460 randomize_search_engine_experiment)); | 467 randomize_search_engine_experiment)); |
461 DCHECK(search_engine_dialog); | 468 DCHECK(search_engine_dialog); |
462 | 469 |
463 search_engine_dialog->Show(); | 470 search_engine_dialog->Show(); |
464 views::AcceleratorHandler accelerator_handler; | 471 views::AcceleratorHandler accelerator_handler; |
465 MessageLoopForUI::current()->Run(&accelerator_handler); | 472 MessageLoopForUI::current()->Run(&accelerator_handler); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 | 859 |
853 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { | 860 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { |
854 if (version > 10000) { | 861 if (version > 10000) { |
855 // This is a test value. We want to make sure we exercise | 862 // This is a test value. We want to make sure we exercise |
856 // returning this early. See EarlyReturnTest test harness. | 863 // returning this early. See EarlyReturnTest test harness. |
857 return Upgrade::TD_NOT_NOW; | 864 return Upgrade::TD_NOT_NOW; |
858 } | 865 } |
859 TryChromeDialog td(version); | 866 TryChromeDialog td(version); |
860 return td.ShowModal(); | 867 return td.ShowModal(); |
861 } | 868 } |
OLD | NEW |