Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: chrome/browser/first_run/first_run.cc

Issue 12314093: Capture the exit status of the first-run AutoImport and make it available to tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable WaitForImport on Linux Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "googleurl/src/gurl.h" 58 #include "googleurl/src/gurl.h"
59 59
60 using content::UserMetricsAction; 60 using content::UserMetricsAction;
61 61
62 namespace { 62 namespace {
63 63
64 // Flags for functions of similar name. 64 // Flags for functions of similar name.
65 bool should_show_welcome_page_ = false; 65 bool should_show_welcome_page_ = false;
66 bool should_do_autofill_personal_data_manager_first_run_ = false; 66 bool should_do_autofill_personal_data_manager_first_run_ = false;
67 67
68 // Flags indicating whether a first-run profile auto import was performed, and
69 // whether the importer process exited successfully.
70 bool did_perform_profile_import = false;
71 bool profile_import_exited_successfully = false;
72
68 // Helper class that performs delayed first-run tasks that need more of the 73 // Helper class that performs delayed first-run tasks that need more of the
69 // chrome infrastructure to be up and running before they can be attempted. 74 // chrome infrastructure to be up and running before they can be attempted.
70 class FirstRunDelayedTasks : public content::NotificationObserver { 75 class FirstRunDelayedTasks : public content::NotificationObserver {
71 public: 76 public:
72 enum Tasks { 77 enum Tasks {
73 NO_TASK, 78 NO_TASK,
74 INSTALL_EXTENSIONS 79 INSTALL_EXTENSIONS
75 }; 80 };
76 81
77 explicit FirstRunDelayedTasks(Tasks task) { 82 explicit FirstRunDelayedTasks(Tasks task) {
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 dont_import_items, 693 dont_import_items,
689 importer::SEARCH_ENGINES, 694 importer::SEARCH_ENGINES,
690 items); 695 items);
691 SetImportItem(user_prefs, 696 SetImportItem(user_prefs,
692 prefs::kImportBookmarks, 697 prefs::kImportBookmarks,
693 import_items, 698 import_items,
694 dont_import_items, 699 dont_import_items,
695 importer::FAVORITES, 700 importer::FAVORITES,
696 items); 701 items);
697 702
698 internal::ImportSettings(profile, importer_host, importer_list, items); 703 profile_import_exited_successfully =
704 internal::ImportSettings(profile, importer_host, importer_list, items);
705 DCHECK(profile_import_exited_successfully);
699 } 706 }
700 707
701 content::RecordAction(UserMetricsAction("FirstRunDef_Accept")); 708 content::RecordAction(UserMetricsAction("FirstRunDef_Accept"));
702 709
703 process_singleton->Unlock(); 710 process_singleton->Unlock();
704 first_run::CreateSentinel(); 711 first_run::CreateSentinel();
705 #endif // !defined(USE_AURA) 712 #endif // !defined(USE_AURA)
713 did_perform_profile_import = true;
706 } 714 }
707 715
708 void DoPostImportTasks(Profile* profile, bool make_chrome_default) { 716 void DoPostImportTasks(Profile* profile, bool make_chrome_default) {
709 if (make_chrome_default && 717 if (make_chrome_default &&
710 ShellIntegration::CanSetAsDefaultBrowser() == 718 ShellIntegration::CanSetAsDefaultBrowser() ==
711 ShellIntegration::SET_DEFAULT_UNATTENDED) { 719 ShellIntegration::SET_DEFAULT_UNATTENDED) {
712 ShellIntegration::SetAsDefaultBrowser(); 720 ShellIntegration::SetAsDefaultBrowser();
713 } 721 }
714 722
715 #if !defined(USE_AURA) 723 #if !defined(USE_AURA)
(...skipping 12 matching lines...) Expand all
728 TemplateURLServiceFactory::GetForProfile(profile); 736 TemplateURLServiceFactory::GetForProfile(profile);
729 if (template_url && template_url->GetDefaultSearchProvider()) 737 if (template_url && template_url->GetDefaultSearchProvider())
730 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); 738 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon();
731 SetShouldShowWelcomePage(); 739 SetShouldShowWelcomePage();
732 SetShouldDoPersonalDataManagerFirstRun(); 740 SetShouldDoPersonalDataManagerFirstRun();
733 #endif // !defined(USE_AURA) 741 #endif // !defined(USE_AURA)
734 742
735 internal::DoPostImportPlatformSpecificTasks(); 743 internal::DoPostImportPlatformSpecificTasks();
736 } 744 }
737 745
746 bool DidPerformProfileImport(bool* exited_successfully) {
747 if (exited_successfully)
748 *exited_successfully = profile_import_exited_successfully;
749 return did_perform_profile_import;
750 }
751
738 } // namespace first_run 752 } // namespace first_run
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698