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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 profile->GetPrefs()->ReloadPersistentPrefs(); | 376 profile->GetPrefs()->ReloadPersistentPrefs(); |
373 | 377 |
374 return (import_runner.exit_code() == content::RESULT_CODE_NORMAL_EXIT); | 378 return (import_runner.exit_code() == content::RESULT_CODE_NORMAL_EXIT); |
375 } | 379 } |
376 | 380 |
377 } // namespace | 381 } // namespace |
378 | 382 |
379 namespace first_run { | 383 namespace first_run { |
380 namespace internal { | 384 namespace internal { |
381 | 385 |
| 386 void DoPostImportPlatformSpecificTasks() { |
| 387 // Trigger the Active Setup command for system-level Chromes to finish |
| 388 // configuring this user's install (e.g. per-user shortcuts). |
| 389 // Delay the task slightly to give Chrome launch I/O priority while also |
| 390 // making sure shortcuts are created promptly to avoid annoying the user by |
| 391 // re-creating shortcuts he previously deleted. |
| 392 static const int64 kTiggerActiveSetupDelaySeconds = 5; |
| 393 FilePath chrome_exe; |
| 394 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
| 395 NOTREACHED(); |
| 396 } else if (!InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) { |
| 397 content::BrowserThread::GetBlockingPool()->PostDelayedTask( |
| 398 FROM_HERE, |
| 399 base::Bind(&InstallUtil::TriggerActiveSetupCommand), |
| 400 base::TimeDelta::FromSeconds(kTiggerActiveSetupDelaySeconds)); |
| 401 } |
| 402 } |
| 403 |
382 bool ImportSettings(Profile* profile, | 404 bool ImportSettings(Profile* profile, |
383 scoped_refptr<ImporterHost> importer_host, | 405 scoped_refptr<ImporterHost> importer_host, |
384 scoped_refptr<ImporterList> importer_list, | 406 scoped_refptr<ImporterList> importer_list, |
385 int items_to_import) { | 407 int items_to_import) { |
386 return ImportSettingsWin( | 408 return ImportSettingsWin( |
387 profile, | 409 profile, |
388 importer_list->GetSourceProfileAt(0).importer_type, | 410 importer_list->GetSourceProfileAt(0).importer_type, |
389 items_to_import, | 411 items_to_import, |
390 FilePath(), | 412 FilePath(), |
391 false); | 413 false); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 502 |
481 FilePath MasterPrefsPath() { | 503 FilePath MasterPrefsPath() { |
482 // The standard location of the master prefs is next to the chrome binary. | 504 // The standard location of the master prefs is next to the chrome binary. |
483 FilePath master_prefs; | 505 FilePath master_prefs; |
484 if (!PathService::Get(base::DIR_EXE, &master_prefs)) | 506 if (!PathService::Get(base::DIR_EXE, &master_prefs)) |
485 return FilePath(); | 507 return FilePath(); |
486 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); | 508 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); |
487 } | 509 } |
488 | 510 |
489 } // namespace first_run | 511 } // namespace first_run |
OLD | NEW |