Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3610)

Unified Diff: chrome/browser/ui/views/importer_view.cc

Issue 5873005: Views: Implement the ImporterList::Observer in ImporterView to enable the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/importer_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « chrome/browser/ui/views/importer_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698