| 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 #include "chrome/browser/views/importer_view.h" | 5 #include "chrome/browser/views/importer_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/string16.h" |
| 9 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
| 10 #include "chrome/browser/importer/importer_data_types.h" | 12 #include "chrome/browser/importer/importer_data_types.h" |
| 11 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 12 #include "grit/locale_settings.h" | 14 #include "grit/locale_settings.h" |
| 13 #include "views/controls/button/checkbox.h" | 15 #include "views/controls/button/checkbox.h" |
| 14 #include "views/controls/label.h" | 16 #include "views/controls/label.h" |
| 15 #include "views/grid_layout.h" | 17 #include "views/grid_layout.h" |
| 16 #include "views/standard_layout.h" | 18 #include "views/standard_layout.h" |
| 17 #include "views/widget/widget.h" | 19 #include "views/widget/widget.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 178 } |
| 177 | 179 |
| 178 int ImporterView::GetItemCount() { | 180 int ImporterView::GetItemCount() { |
| 179 DCHECK(importer_host_.get()); | 181 DCHECK(importer_host_.get()); |
| 180 int item_count = importer_host_->GetAvailableProfileCount(); | 182 int item_count = importer_host_->GetAvailableProfileCount(); |
| 181 if (checkbox_items_.size() < static_cast<size_t>(item_count)) | 183 if (checkbox_items_.size() < static_cast<size_t>(item_count)) |
| 182 checkbox_items_.resize(item_count, initial_state_); | 184 checkbox_items_.resize(item_count, initial_state_); |
| 183 return item_count; | 185 return item_count; |
| 184 } | 186 } |
| 185 | 187 |
| 186 std::wstring ImporterView::GetItemAt(int index) { | 188 string16 ImporterView::GetItemAt(int index) { |
| 187 DCHECK(importer_host_.get()); | 189 DCHECK(importer_host_.get()); |
| 188 return importer_host_->GetSourceProfileNameAt(index); | 190 return WideToUTF16Hack(importer_host_->GetSourceProfileNameAt(index)); |
| 189 } | 191 } |
| 190 | 192 |
| 191 void ImporterView::ItemChanged(views::Combobox* combobox, | 193 void ImporterView::ItemChanged(views::Combobox* combobox, |
| 192 int prev_index, int new_index) { | 194 int prev_index, int new_index) { |
| 193 DCHECK(combobox); | 195 DCHECK(combobox); |
| 194 DCHECK(checkbox_items_.size() >= | 196 DCHECK(checkbox_items_.size() >= |
| 195 static_cast<size_t>(importer_host_->GetAvailableProfileCount())); | 197 static_cast<size_t>(importer_host_->GetAvailableProfileCount())); |
| 196 | 198 |
| 197 if (prev_index == new_index) | 199 if (prev_index == new_index) |
| 198 return; | 200 return; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 if (favorites_checkbox_->IsEnabled()) | 278 if (favorites_checkbox_->IsEnabled()) |
| 277 favorites_checkbox_->SetChecked(!!(items & importer::FAVORITES)); | 279 favorites_checkbox_->SetChecked(!!(items & importer::FAVORITES)); |
| 278 | 280 |
| 279 if (passwords_checkbox_->IsEnabled()) | 281 if (passwords_checkbox_->IsEnabled()) |
| 280 passwords_checkbox_->SetChecked(!!(items & importer::PASSWORDS)); | 282 passwords_checkbox_->SetChecked(!!(items & importer::PASSWORDS)); |
| 281 | 283 |
| 282 if (search_engines_checkbox_->IsEnabled()) | 284 if (search_engines_checkbox_->IsEnabled()) |
| 283 search_engines_checkbox_->SetChecked(!!(items & | 285 search_engines_checkbox_->SetChecked(!!(items & |
| 284 importer::SEARCH_ENGINES)); | 286 importer::SEARCH_ENGINES)); |
| 285 } | 287 } |
| OLD | NEW |