| 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 "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/first_run/first_run_internal.h" | 10 #include "chrome/browser/first_run/first_run_internal.h" |
| 10 #include "chrome/browser/importer/importer_host.h" | 11 #include "chrome/browser/importer/importer_host.h" |
| 11 #include "chrome/browser/importer/importer_list.h" | 12 #include "chrome/browser/importer/importer_list.h" |
| 12 #include "chrome/browser/importer/importer_progress_dialog.h" | 13 #include "chrome/browser/importer/importer_progress_dialog.h" |
| 13 #include "chrome/browser/importer/importer_progress_observer.h" | 14 #include "chrome/browser/importer/importer_progress_observer.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
| 16 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/installer/util/google_update_settings.h" |
| 17 #include "chrome/installer/util/master_preferences.h" | 21 #include "chrome/installer/util/master_preferences.h" |
| 18 #include "chrome/installer/util/master_preferences_constants.h" | 22 #include "chrome/installer/util/master_preferences_constants.h" |
| 19 | 23 |
| 20 namespace { | 24 namespace { |
| 21 | 25 |
| 22 // This class acts as an observer for the ImporterProgressObserver::ImportEnded | 26 // This class acts as an observer for the ImporterProgressObserver::ImportEnded |
| 23 // callback. When the import process is started, certain errors may cause | 27 // callback. When the import process is started, certain errors may cause |
| 24 // ImportEnded() to be called synchronously, but the typical case is that | 28 // ImportEnded() to be called synchronously, but the typical case is that |
| 25 // ImportEnded() is called asynchronously. Thus we have to handle both cases. | 29 // ImportEnded() is called asynchronously. Thus we have to handle both cases. |
| 26 class ImportEndedObserver : public importer::ImporterProgressObserver { | 30 class ImportEndedObserver : public importer::ImporterProgressObserver { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 54 // Set by the client (via set_should_quit_message_loop) if, when the import | 58 // Set by the client (via set_should_quit_message_loop) if, when the import |
| 55 // ends, this class should quit the message loop. | 59 // ends, this class should quit the message loop. |
| 56 bool should_quit_message_loop_; | 60 bool should_quit_message_loop_; |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 } // namespace | 63 } // namespace |
| 60 | 64 |
| 61 namespace first_run { | 65 namespace first_run { |
| 62 namespace internal { | 66 namespace internal { |
| 63 | 67 |
| 68 void DoPostImportPlatformSpecificTasks() { |
| 69 #if !defined(OS_CHROMEOS) |
| 70 // If stats reporting was turned on by the first run dialog then toggle |
| 71 // the pref (on Windows, the download is tagged with enable/disable stats so |
| 72 // this is POSIX-specific). |
| 73 if (GoogleUpdateSettings::GetCollectStatsConsent()) { |
| 74 g_browser_process->local_state()->SetBoolean( |
| 75 prefs::kMetricsReportingEnabled, true); |
| 76 } |
| 77 #endif |
| 78 } |
| 79 |
| 64 bool GetFirstRunSentinelFilePath(FilePath* path) { | 80 bool GetFirstRunSentinelFilePath(FilePath* path) { |
| 65 FilePath first_run_sentinel; | 81 FilePath first_run_sentinel; |
| 66 | 82 |
| 67 if (!PathService::Get(chrome::DIR_USER_DATA, &first_run_sentinel)) | 83 if (!PathService::Get(chrome::DIR_USER_DATA, &first_run_sentinel)) |
| 68 return false; | 84 return false; |
| 69 | 85 |
| 70 *path = first_run_sentinel.Append(chrome::kFirstRunSentinel); | 86 *path = first_run_sentinel.Append(chrome::kFirstRunSentinel); |
| 71 return true; | 87 return true; |
| 72 } | 88 } |
| 73 | 89 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 namespace first_run { | 143 namespace first_run { |
| 128 | 144 |
| 129 // TODO(port): Import switches need to be ported to both Mac and Linux. Not all | 145 // TODO(port): Import switches need to be ported to both Mac and Linux. Not all |
| 130 // import switches here are implemented for Linux. None are implemented for Mac | 146 // import switches here are implemented for Linux. None are implemented for Mac |
| 131 // (as this function will not be called on Mac). | 147 // (as this function will not be called on Mac). |
| 132 int ImportNow(Profile* profile, const CommandLine& cmdline) { | 148 int ImportNow(Profile* profile, const CommandLine& cmdline) { |
| 133 return internal::ImportBookmarkFromFileIfNeeded(profile, cmdline); | 149 return internal::ImportBookmarkFromFileIfNeeded(profile, cmdline); |
| 134 } | 150 } |
| 135 | 151 |
| 136 } // namespace first_run | 152 } // namespace first_run |
| OLD | NEW |