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 <shlobj.h> | 7 #include <shlobj.h> |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } // namespace internal | 437 } // namespace internal |
438 } // namespace first_run | 438 } // namespace first_run |
439 | 439 |
440 namespace first_run { | 440 namespace first_run { |
441 | 441 |
442 void AutoImport( | 442 void AutoImport( |
443 Profile* profile, | 443 Profile* profile, |
444 bool homepage_defined, | 444 bool homepage_defined, |
445 int import_items, | 445 int import_items, |
446 int dont_import_items, | 446 int dont_import_items, |
447 bool search_engine_experiment, | |
448 bool randomize_search_engine_experiment, | |
449 bool make_chrome_default, | 447 bool make_chrome_default, |
450 ProcessSingleton* process_singleton) { | 448 ProcessSingleton* process_singleton) { |
451 #if !defined(USE_AURA) | 449 #if !defined(USE_AURA) |
452 // We need to avoid dispatching new tabs when we are importing because | 450 // We need to avoid dispatching new tabs when we are importing because |
453 // that will lead to data corruption or a crash. Because there is no UI for | 451 // that will lead to data corruption or a crash. Because there is no UI for |
454 // the import process, we pass NULL as the window to bring to the foreground | 452 // the import process, we pass NULL as the window to bring to the foreground |
455 // when a CopyData message comes in; this causes the message to be silently | 453 // when a CopyData message comes in; this causes the message to be silently |
456 // discarded, which is the correct behavior during the import process. | 454 // discarded, which is the correct behavior during the import process. |
457 process_singleton->Lock(NULL); | 455 process_singleton->Lock(NULL); |
458 | 456 |
459 PlatformSetup(); | 457 PlatformSetup(); |
460 | 458 |
461 scoped_refptr<ImporterHost> importer_host; | 459 scoped_refptr<ImporterHost> importer_host; |
462 importer_host = new ImporterHost; | 460 importer_host = new ImporterHost; |
463 | 461 |
464 internal::AutoImportPlatformCommon(importer_host, profile, homepage_defined, | 462 internal::AutoImportPlatformCommon(importer_host, profile, homepage_defined, |
465 import_items, dont_import_items, | 463 import_items, dont_import_items, |
466 search_engine_experiment, | |
467 randomize_search_engine_experiment, | |
468 make_chrome_default); | 464 make_chrome_default); |
469 | 465 |
470 process_singleton->Unlock(); | 466 process_singleton->Unlock(); |
471 CreateSentinel(); | 467 CreateSentinel(); |
472 #endif // !defined(USE_AURA) | 468 #endif // !defined(USE_AURA) |
473 } | 469 } |
474 | 470 |
475 int ImportNow(Profile* profile, const CommandLine& cmdline) { | 471 int ImportNow(Profile* profile, const CommandLine& cmdline) { |
476 int return_code = internal::ImportBookmarkFromFileIfNeeded(profile, cmdline); | 472 int return_code = internal::ImportBookmarkFromFileIfNeeded(profile, cmdline); |
477 #if !defined(USE_AURA) | 473 #if !defined(USE_AURA) |
478 if (cmdline.HasSwitch(switches::kImport)) { | 474 if (cmdline.HasSwitch(switches::kImport)) { |
479 return_code = ImportFromBrowser(profile, cmdline); | 475 return_code = ImportFromBrowser(profile, cmdline); |
480 } | 476 } |
481 #endif | 477 #endif |
482 return return_code; | 478 return return_code; |
483 } | 479 } |
484 | 480 |
485 FilePath MasterPrefsPath() { | 481 FilePath MasterPrefsPath() { |
486 // The standard location of the master prefs is next to the chrome binary. | 482 // The standard location of the master prefs is next to the chrome binary. |
487 FilePath master_prefs; | 483 FilePath master_prefs; |
488 if (!PathService::Get(base::DIR_EXE, &master_prefs)) | 484 if (!PathService::Get(base::DIR_EXE, &master_prefs)) |
489 return FilePath(); | 485 return FilePath(); |
490 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); | 486 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); |
491 } | 487 } |
492 | 488 |
493 } // namespace first_run | 489 } // namespace first_run |
OLD | NEW |