Index: chrome/browser/ui/views/importer_view.cc |
diff --git a/chrome/browser/ui/views/importer_view.cc b/chrome/browser/ui/views/importer_view.cc |
index 4ef686fcdf2860515060aecd9d3e92b3986602cf..e2ab33f230eedc3f8f5e8c6c502baf42f44884d0 100644 |
--- a/chrome/browser/ui/views/importer_view.cc |
+++ b/chrome/browser/ui/views/importer_view.cc |
@@ -5,7 +5,7 @@ |
#include "chrome/browser/views/importer_view.h" |
#include "app/l10n_util.h" |
-#include "base/string16.h" |
+#include "base/compiler_specific.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/browser_list.h" |
#include "chrome/browser/browser_window.h" |
@@ -42,7 +42,7 @@ ImporterView::ImporterView(Profile* profile, int initial_state) |
passwords_checkbox_(NULL), |
search_engines_checkbox_(NULL), |
profile_(profile), |
- importer_host_(new ImporterHost()), |
+ ALLOW_THIS_IN_INITIALIZER_LIST(importer_host_(new ImporterHost(this))), |
initial_state_(initial_state) { |
DCHECK(profile); |
SetupControl(); |
@@ -179,15 +179,27 @@ void ImporterView::ButtonPressed( |
int ImporterView::GetItemCount() { |
DCHECK(importer_host_.get()); |
- int item_count = importer_host_->GetAvailableProfileCount(); |
- if (checkbox_items_.size() < static_cast<size_t>(item_count)) |
- checkbox_items_.resize(item_count, initial_state_); |
+ |
+ int item_count; |
sky
2010/12/16 23:07:22
This code should live in SourceProfilesLoaded, and
James Hawkins
2010/12/16 23:32:13
Done.
|
+ if (!importer_host_->source_profiles_loaded()) { |
+ item_count = 1; |
+ } else { |
+ item_count = importer_host_->GetAvailableProfileCount(); |
+ |
+ if (checkbox_items_.size() < static_cast<size_t>(item_count)) |
+ checkbox_items_.resize(item_count, initial_state_); |
+ } |
+ |
return item_count; |
} |
string16 ImporterView::GetItemAt(int index) { |
DCHECK(importer_host_.get()); |
- return WideToUTF16Hack(importer_host_->GetSourceProfileNameAt(index)); |
+ |
+ if (!importer_host_->source_profiles_loaded()) |
+ return l10n_util::GetStringUTF16(IDS_IMPORT_LOADING_PROFILES); |
+ else |
+ return WideToUTF16Hack(importer_host_->GetSourceProfileNameAt(index)); |
} |
void ImporterView::ItemChanged(views::Combobox* combobox, |
@@ -213,6 +225,11 @@ void ImporterView::ItemChanged(views::Combobox* combobox, |
SetCheckedItems(new_items); |
} |
+void ImporterView::SourceProfilesLoaded() { |
+ // Reload the profile combobox. |
+ profile_combobox_->ModelChanged(); |
+} |
+ |
void ImporterView::ImportCanceled() { |
ImportComplete(); |
} |