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 <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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; | 209 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; |
210 source_profile.source_path = file_path; | 210 source_profile.source_path = file_path; |
211 | 211 |
212 first_run::internal::ImportEndedObserver observer; | 212 first_run::internal::ImportEndedObserver observer; |
213 importer_host->SetObserver(&observer); | 213 importer_host->SetObserver(&observer); |
214 importer_host->StartImportSettings( | 214 importer_host->StartImportSettings( |
215 source_profile, profile, importer::FAVORITES, new ProfileWriter(profile)); | 215 source_profile, profile, importer::FAVORITES, new ProfileWriter(profile)); |
216 // If the import process has not errored out, block on it. | 216 // If the import process has not errored out, block on it. |
217 if (!observer.ended()) { | 217 if (!observer.ended()) { |
218 observer.set_should_quit_message_loop(); | 218 observer.set_should_quit_message_loop(); |
219 MessageLoop::current()->Run(); | 219 base::MessageLoop::current()->Run(); |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 GURL UrlFromString(const std::string& in) { | 223 GURL UrlFromString(const std::string& in) { |
224 return GURL(in); | 224 return GURL(in); |
225 } | 225 } |
226 | 226 |
227 void ConvertStringVectorToGURLVector( | 227 void ConvertStringVectorToGURLVector( |
228 const std::vector<std::string>& src, | 228 const std::vector<std::string>& src, |
229 std::vector<GURL>* ret) { | 229 std::vector<GURL>* ret) { |
(...skipping 11 matching lines...) Expand all Loading... |
241 static base::LazyInstance<base::FilePath> master_prefs_path_for_testing | 241 static base::LazyInstance<base::FilePath> master_prefs_path_for_testing |
242 = LAZY_INSTANCE_INITIALIZER; | 242 = LAZY_INSTANCE_INITIALIZER; |
243 | 243 |
244 // TODO(gab): This will go back inline above when it is moved to first_run.cc | 244 // TODO(gab): This will go back inline above when it is moved to first_run.cc |
245 // (see TODO above), but needs to be separate for now to satisfy clang error: | 245 // (see TODO above), but needs to be separate for now to satisfy clang error: |
246 // "[chromium-style] virtual methods with non-empty bodies shouldn't be declared | 246 // "[chromium-style] virtual methods with non-empty bodies shouldn't be declared |
247 // inline". | 247 // inline". |
248 void ImportEndedObserver::ImportEnded() { | 248 void ImportEndedObserver::ImportEnded() { |
249 ended_ = true; | 249 ended_ = true; |
250 if (should_quit_message_loop_) | 250 if (should_quit_message_loop_) |
251 MessageLoop::current()->Quit(); | 251 base::MessageLoop::current()->Quit(); |
252 } | 252 } |
253 | 253 |
254 installer::MasterPreferences* | 254 installer::MasterPreferences* |
255 LoadMasterPrefs(base::FilePath* master_prefs_path) { | 255 LoadMasterPrefs(base::FilePath* master_prefs_path) { |
256 if (!master_prefs_path_for_testing.Get().empty()) | 256 if (!master_prefs_path_for_testing.Get().empty()) |
257 *master_prefs_path = master_prefs_path_for_testing.Get(); | 257 *master_prefs_path = master_prefs_path_for_testing.Get(); |
258 else | 258 else |
259 *master_prefs_path = base::FilePath(MasterPrefsPath()); | 259 *master_prefs_path = base::FilePath(MasterPrefsPath()); |
260 if (master_prefs_path->empty()) | 260 if (master_prefs_path->empty()) |
261 return NULL; | 261 return NULL; |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 internal::DoPostImportPlatformSpecificTasks(); | 758 internal::DoPostImportPlatformSpecificTasks(); |
759 } | 759 } |
760 | 760 |
761 bool DidPerformProfileImport(bool* exited_successfully) { | 761 bool DidPerformProfileImport(bool* exited_successfully) { |
762 if (exited_successfully) | 762 if (exited_successfully) |
763 *exited_successfully = profile_import_exited_successfully; | 763 *exited_successfully = profile_import_exited_successfully; |
764 return did_perform_profile_import; | 764 return did_perform_profile_import; |
765 } | 765 } |
766 | 766 |
767 } // namespace first_run | 767 } // namespace first_run |
OLD | NEW |