| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import "chrome/browser/cocoa/import_settings_dialog.h" | 5 #import "chrome/browser/cocoa/import_settings_dialog.h" |
| 6 | 6 |
| 7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/importer/importer_data_types.h" | 9 #include "chrome/browser/importer/importer_data_types.h" |
| 10 #include "chrome/browser/importer/importer_list.h" | 10 #include "chrome/browser/importer/importer_list.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 - (void)runModalDialog { | 167 - (void)runModalDialog { |
| 168 importSettingsDialogVisible = true; | 168 importSettingsDialogVisible = true; |
| 169 [NSApp runModalForWindow:[self window]]; | 169 [NSApp runModalForWindow:[self window]]; |
| 170 } | 170 } |
| 171 | 171 |
| 172 - (IBAction)ok:(id)sender { | 172 - (IBAction)ok:(id)sender { |
| 173 [self closeDialog]; | 173 [self closeDialog]; |
| 174 const importer::ProfileInfo& sourceProfile = | 174 const importer::ProfileInfo& sourceProfile = |
| 175 importerList_.get()->GetSourceProfileInfoAt([self sourceBrowserIndex]); | 175 importerList_.get()->GetSourceProfileInfoAt([self sourceBrowserIndex]); |
| 176 uint16 items = sourceProfile.services_supported; | 176 uint16 items = sourceProfile.services_supported; |
| 177 // ProfileInfo.services_supported is a uint16 while the call to | 177 uint16 servicesToImport = items & [self servicesToImport]; |
| 178 // StartImportingWithUI requires an int16. | |
| 179 int16 servicesToImport = static_cast<int16>(items & [self servicesToImport]); | |
| 180 if (servicesToImport) { | 178 if (servicesToImport) { |
| 181 if (profile_) { | 179 if (profile_) { |
| 182 ImporterHost* importerHost = new ExternalProcessImporterHost; | 180 ImporterHost* importerHost = new ExternalProcessImporterHost; |
| 183 // Note that a side effect of the following call is to cause the | 181 // Note that a side effect of the following call is to cause the |
| 184 // importerHost to be disposed once the import has completed. | 182 // importerHost to be disposed once the import has completed. |
| 185 StartImportingWithUI(nil, servicesToImport, importerHost, | 183 StartImportingWithUI(nil, servicesToImport, importerHost, |
| 186 sourceProfile, profile_, nil, false); | 184 sourceProfile, profile_, nil, false); |
| 187 } | 185 } |
| 188 } else { | 186 } else { |
| 189 LOG(WARNING) << "There were no settings to import from '" | 187 LOG(WARNING) << "There were no settings to import from '" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 236 |
| 239 // KVO accessor which returns YES if at least one of the services | 237 // KVO accessor which returns YES if at least one of the services |
| 240 // provided by the selected profile has been marked for importing | 238 // provided by the selected profile has been marked for importing |
| 241 // and bound to the OK button's enable property. | 239 // and bound to the OK button's enable property. |
| 242 - (BOOL)importSomething { | 240 - (BOOL)importSomething { |
| 243 return [self importHistory] || [self importFavorites] || | 241 return [self importHistory] || [self importFavorites] || |
| 244 [self importPasswords] || [self importSearchEngines]; | 242 [self importPasswords] || [self importSearchEngines]; |
| 245 } | 243 } |
| 246 | 244 |
| 247 @end | 245 @end |
| OLD | NEW |