OLD | NEW |
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/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/environment.h" | 12 #include "base/environment.h" |
| 13 #include "base/file_path.h" |
13 #include "base/file_util.h" | 14 #include "base/file_util.h" |
14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
15 #include "base/process_util.h" | 16 #include "base/process_util.h" |
16 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
17 #include "base/string_split.h" | 18 #include "base/string_split.h" |
18 #include "base/stringprintf.h" | 19 #include "base/stringprintf.h" |
| 20 #include "base/threading/sequenced_worker_pool.h" |
| 21 #include "base/time.h" |
19 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
20 #include "base/win/metro.h" | 23 #include "base/win/metro.h" |
21 #include "base/win/object_watcher.h" | 24 #include "base/win/object_watcher.h" |
22 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
23 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/first_run/first_run_import_observer.h" | 27 #include "chrome/browser/first_run/first_run_import_observer.h" |
25 #include "chrome/browser/first_run/first_run_internal.h" | 28 #include "chrome/browser/first_run/first_run_internal.h" |
26 #include "chrome/browser/importer/importer_host.h" | 29 #include "chrome/browser/importer/importer_host.h" |
27 #include "chrome/browser/importer/importer_list.h" | 30 #include "chrome/browser/importer/importer_list.h" |
28 #include "chrome/browser/importer/importer_progress_dialog.h" | 31 #include "chrome/browser/importer/importer_progress_dialog.h" |
29 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
30 #include "chrome/browser/process_singleton.h" | 33 #include "chrome/browser/process_singleton.h" |
31 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/shell_integration.h" | 35 #include "chrome/browser/shell_integration.h" |
33 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
34 #include "chrome/common/chrome_paths.h" | 37 #include "chrome/common/chrome_paths.h" |
35 #include "chrome/common/chrome_result_codes.h" | 38 #include "chrome/common/chrome_result_codes.h" |
36 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
38 #include "chrome/common/worker_thread_ticker.h" | 41 #include "chrome/common/worker_thread_ticker.h" |
39 #include "chrome/installer/util/browser_distribution.h" | 42 #include "chrome/installer/util/browser_distribution.h" |
40 #include "chrome/installer/util/google_update_settings.h" | 43 #include "chrome/installer/util/google_update_settings.h" |
41 #include "chrome/installer/util/install_util.h" | 44 #include "chrome/installer/util/install_util.h" |
42 #include "chrome/installer/util/master_preferences.h" | 45 #include "chrome/installer/util/master_preferences.h" |
43 #include "chrome/installer/util/master_preferences_constants.h" | 46 #include "chrome/installer/util/master_preferences_constants.h" |
44 #include "chrome/installer/util/shell_util.h" | 47 #include "chrome/installer/util/shell_util.h" |
45 #include "chrome/installer/util/util_constants.h" | 48 #include "chrome/installer/util/util_constants.h" |
| 49 #include "content/public/browser/browser_thread.h" |
46 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
47 #include "content/public/browser/user_metrics.h" | 51 #include "content/public/browser/user_metrics.h" |
48 #include "google_update/google_update_idl.h" | 52 #include "google_update/google_update_idl.h" |
49 #include "grit/chromium_strings.h" | 53 #include "grit/chromium_strings.h" |
50 #include "grit/generated_resources.h" | 54 #include "grit/generated_resources.h" |
51 #include "grit/locale_settings.h" | 55 #include "grit/locale_settings.h" |
52 #include "grit/theme_resources.h" | 56 #include "grit/theme_resources.h" |
53 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
54 #include "ui/base/layout.h" | 58 #include "ui/base/layout.h" |
55 #include "ui/base/ui_base_switches.h" | 59 #include "ui/base/ui_base_switches.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 profile->GetPrefs()->ReloadPersistentPrefs(); | 372 profile->GetPrefs()->ReloadPersistentPrefs(); |
369 | 373 |
370 return (import_runner.exit_code() == content::RESULT_CODE_NORMAL_EXIT); | 374 return (import_runner.exit_code() == content::RESULT_CODE_NORMAL_EXIT); |
371 } | 375 } |
372 | 376 |
373 } // namespace | 377 } // namespace |
374 | 378 |
375 namespace first_run { | 379 namespace first_run { |
376 namespace internal { | 380 namespace internal { |
377 | 381 |
| 382 void DoPostImportPlatformSpecificTasks() { |
| 383 // Trigger the Active Setup command for system-level Chromes to finish |
| 384 // configuring this user's install (e.g. per-user shortcuts). |
| 385 // Delay the task slightly to give Chrome launch I/O priority while also |
| 386 // making sure shortcuts are created promptly to avoid annoying the user by |
| 387 // re-creating shortcuts he previously deleted. |
| 388 static const int64 kTiggerActiveSetupDelaySeconds = 5; |
| 389 FilePath chrome_exe; |
| 390 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
| 391 NOTREACHED(); |
| 392 } else if (!InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) { |
| 393 content::BrowserThread::GetBlockingPool()->PostDelayedTask( |
| 394 FROM_HERE, |
| 395 base::Bind(&InstallUtil::TriggerActiveSetupCommand), |
| 396 base::TimeDelta::FromSeconds(kTiggerActiveSetupDelaySeconds)); |
| 397 } |
| 398 } |
| 399 |
378 bool ImportSettings(Profile* profile, | 400 bool ImportSettings(Profile* profile, |
379 scoped_refptr<ImporterHost> importer_host, | 401 scoped_refptr<ImporterHost> importer_host, |
380 scoped_refptr<ImporterList> importer_list, | 402 scoped_refptr<ImporterList> importer_list, |
381 int items_to_import) { | 403 int items_to_import) { |
382 return ImportSettingsWin( | 404 return ImportSettingsWin( |
383 profile, | 405 profile, |
384 importer_list->GetSourceProfileAt(0).importer_type, | 406 importer_list->GetSourceProfileAt(0).importer_type, |
385 items_to_import, | 407 items_to_import, |
386 FilePath(), | 408 FilePath(), |
387 false); | 409 false); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 498 |
477 FilePath MasterPrefsPath() { | 499 FilePath MasterPrefsPath() { |
478 // The standard location of the master prefs is next to the chrome binary. | 500 // The standard location of the master prefs is next to the chrome binary. |
479 FilePath master_prefs; | 501 FilePath master_prefs; |
480 if (!PathService::Get(base::DIR_EXE, &master_prefs)) | 502 if (!PathService::Get(base::DIR_EXE, &master_prefs)) |
481 return FilePath(); | 503 return FilePath(); |
482 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); | 504 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); |
483 } | 505 } |
484 | 506 |
485 } // namespace first_run | 507 } // namespace first_run |
OLD | NEW |