| 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/common/importer_data_types.h" |
| 10 #include "chrome/browser/importer/importer_list.h" | 10 #include "chrome/browser/importer/importer_list.h" |
| 11 #include "chrome/browser/profile.h" | 11 #include "chrome/browser/profile.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 bool importSettingsDialogVisible = false; | 15 bool importSettingsDialogVisible = false; |
| 16 | 16 |
| 17 } // namespace | 17 } // namespace |
| 18 | 18 |
| 19 @interface ImportSettingsDialogController () | 19 @interface ImportSettingsDialogController () |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // checkbox enabling. | 114 // checkbox enabling. |
| 115 importerList_.reset(new ImporterList); | 115 importerList_.reset(new ImporterList); |
| 116 ImporterList& importerList(*(importerList_.get())); | 116 ImporterList& importerList(*(importerList_.get())); |
| 117 importerList.DetectSourceProfiles(); | 117 importerList.DetectSourceProfiles(); |
| 118 int profilesCount = importerList.GetAvailableProfileCount(); | 118 int profilesCount = importerList.GetAvailableProfileCount(); |
| 119 // There shoule be at least the default profile so this should never be zero. | 119 // There shoule be at least the default profile so this should never be zero. |
| 120 DCHECK(profilesCount > 0); | 120 DCHECK(profilesCount > 0); |
| 121 NSMutableArray* browserProfiles = | 121 NSMutableArray* browserProfiles = |
| 122 [NSMutableArray arrayWithCapacity:profilesCount]; | 122 [NSMutableArray arrayWithCapacity:profilesCount]; |
| 123 for (int i = 0; i < profilesCount; ++i) { | 123 for (int i = 0; i < profilesCount; ++i) { |
| 124 const importer::ProfileInfo& sourceProfile = importerList.GetSourceProfileIn
foAt(i); | 124 const importer::ProfileInfo& sourceProfile = |
| 125 importerList.GetSourceProfileInfoAt(i); |
| 125 NSString* browserName = | 126 NSString* browserName = |
| 126 base::SysWideToNSString(sourceProfile.description); | 127 base::SysWideToNSString(sourceProfile.description); |
| 127 uint16 browserServices = sourceProfile.services_supported; | 128 uint16 browserServices = sourceProfile.services_supported; |
| 128 ImportSettingsProfile* settingsProfile = | 129 ImportSettingsProfile* settingsProfile = |
| 129 [ImportSettingsProfile | 130 [ImportSettingsProfile |
| 130 importSettingsProfileWithBrowserName:browserName | 131 importSettingsProfileWithBrowserName:browserName |
| 131 services:browserServices]; | 132 services:browserServices]; |
| 132 [browserProfiles addObject:settingsProfile]; | 133 [browserProfiles addObject:settingsProfile]; |
| 133 } | 134 } |
| 134 if ((self = [self initWithProfiles:browserProfiles])) { | 135 if ((self = [self initWithProfiles:browserProfiles])) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 238 |
| 238 // KVO accessor which returns YES if at least one of the services | 239 // KVO accessor which returns YES if at least one of the services |
| 239 // provided by the selected profile has been marked for importing | 240 // provided by the selected profile has been marked for importing |
| 240 // and bound to the OK button's enable property. | 241 // and bound to the OK button's enable property. |
| 241 - (BOOL)importSomething { | 242 - (BOOL)importSomething { |
| 242 return [self importHistory] || [self importFavorites] || | 243 return [self importHistory] || [self importFavorites] || |
| 243 [self importPasswords] || [self importSearchEngines]; | 244 [self importPasswords] || [self importSearchEngines]; |
| 244 } | 245 } |
| 245 | 246 |
| 246 @end | 247 @end |
| OLD | NEW |