| 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/browser_process.h" |
| 10 #include "chrome/browser/first_run/first_run_internal.h" | 10 #include "chrome/browser/first_run/first_run_internal.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool ImportSettings(Profile* profile, | 90 bool ImportSettings(Profile* profile, |
| 91 scoped_refptr<ImporterHost> importer_host, | 91 scoped_refptr<ImporterHost> importer_host, |
| 92 scoped_refptr<ImporterList> importer_list, | 92 scoped_refptr<ImporterList> importer_list, |
| 93 int items_to_import) { | 93 int items_to_import) { |
| 94 const importer::SourceProfile& source_profile = | 94 const importer::SourceProfile& source_profile = |
| 95 importer_list->GetSourceProfileAt(0); | 95 importer_list->GetSourceProfileAt(0); |
| 96 | 96 |
| 97 // Ensure that importers aren't requested to import items that they do not | 97 // Ensure that importers aren't requested to import items that they do not |
| 98 // support. | 98 // support. If there is no overlap, skip. |
| 99 items_to_import &= source_profile.services_supported; | 99 items_to_import &= source_profile.services_supported; |
| 100 if (items_to_import == 0) |
| 101 return true; |
| 100 | 102 |
| 101 scoped_ptr<ImportEndedObserver> observer(new ImportEndedObserver); | 103 scoped_ptr<ImportEndedObserver> observer(new ImportEndedObserver); |
| 102 importer_host->SetObserver(observer.get()); | 104 importer_host->SetObserver(observer.get()); |
| 103 importer_host->StartImportSettings(source_profile, | 105 importer_host->StartImportSettings(source_profile, |
| 104 profile, | 106 profile, |
| 105 items_to_import, | 107 items_to_import, |
| 106 new ProfileWriter(profile), | 108 new ProfileWriter(profile), |
| 107 true); | 109 true); |
| 108 // If the import process has not errored out, block on it. | 110 // If the import process has not errored out, block on it. |
| 109 if (!observer->ended()) { | 111 if (!observer->ended()) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 namespace first_run { | 145 namespace first_run { |
| 144 | 146 |
| 145 // TODO(port): Import switches need to be ported to both Mac and Linux. Not all | 147 // TODO(port): Import switches need to be ported to both Mac and Linux. Not all |
| 146 // import switches here are implemented for Linux. None are implemented for Mac | 148 // import switches here are implemented for Linux. None are implemented for Mac |
| 147 // (as this function will not be called on Mac). | 149 // (as this function will not be called on Mac). |
| 148 int ImportNow(Profile* profile, const CommandLine& cmdline) { | 150 int ImportNow(Profile* profile, const CommandLine& cmdline) { |
| 149 return internal::ImportBookmarkFromFileIfNeeded(profile, cmdline); | 151 return internal::ImportBookmarkFromFileIfNeeded(profile, cmdline); |
| 150 } | 152 } |
| 151 | 153 |
| 152 } // namespace first_run | 154 } // namespace first_run |
| OLD | NEW |