summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/app/resources/locale_settings.grd4
-rw-r--r--chrome/app/theme/theme_resources.grd2
-rw-r--r--chrome/browser/autofill/autofill_dialog.h15
-rw-r--r--chrome/browser/autofill/autofill_dialog_gtk.cc10
-rw-r--r--chrome/browser/autofill/autofill_manager.cc21
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.cc4
-rw-r--r--chrome/browser/views/autofill_profiles_view_win.cc101
-rw-r--r--chrome/browser/views/autofill_profiles_view_win.h21
-rw-r--r--chrome/browser/views/options/content_page_view.cc22
-rw-r--r--chrome/browser/views/options/content_page_view.h6
-rw-r--r--chrome/browser/views/options/options_window_view.cc1
12 files changed, 131 insertions, 79 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 2125f4d..2bb2658 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5205,6 +5205,9 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_AUTOFILL_DIALOG_TITLE" desc="The title of the AutoFill dialog.">
AutoFill Profiles
</message>
+ <message name="IDS_AUTOFILL_LOADING" desc="The indicator that autofill data is being loaded.">
+ Loading...
+ </message>
<message name="IDS_AUTOFILL_USE_MAC_ADDRESS_BOOK" desc="Checkbox label to enable Address Book on Mac.">
Include addresses from my Address Book card
</message>
diff --git a/chrome/app/resources/locale_settings.grd b/chrome/app/resources/locale_settings.grd
index a03c3cf..847756a 100644
--- a/chrome/app/resources/locale_settings.grd
+++ b/chrome/app/resources/locale_settings.grd
@@ -591,12 +591,12 @@
<!-- The width of the AutoFill dialog in characters. -->
<message name="IDS_AUTOFILL_DIALOG_WIDTH_CHARS" use_name_for_id="true">
- 98
+ 94
</message>
<!-- The height of the AutoFill dialog in lines. -->
<message name="IDS_AUTOFILL_DIALOG_HEIGHT_LINES" use_name_for_id="true">
- 35
+ 32
</message>
<!-- The URL for About Google Translate. -->
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 29a36c0..75f0374 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -112,6 +112,8 @@
<include name="IDR_DOWNLOAD_PROGRESS_BACKGROUND_32" file="download_progress_background32.png" type="BINDATA" />
<include name="IDR_DOWNLOAD_PROGRESS_FOREGROUND_32" file="download_progress_foreground32.png" type="BINDATA" />
<include name="IDR_DOWNLOAD_ICON" file="download_icon.png" type="BINDATA" />
+ <include name="IDR_EXPAND_ARROW_DOWN_ICON" file="expand_arrow_down.png" type="BINDATA" />
+ <include name="IDR_EXPAND_ARROW_RIGHT_ICON" file="expand_arrow_right.png" type="BINDATA" />
<include name="IDR_FIND_BOX_BACKGROUND" file="find_box_bg.png" type="BINDATA" />
<include name="IDR_FIND_BOX_BACKGROUND_LEFT" file="find_box_bg_left.png" type="BINDATA" />
<include name="IDR_FIND_BOX_BACKGROUND_LEFT_RTL" file="find_box_bg_left_rtl.png" type="BINDATA" />
diff --git a/chrome/browser/autofill/autofill_dialog.h b/chrome/browser/autofill/autofill_dialog.h
index 31b497c..ab4a7d7 100644
--- a/chrome/browser/autofill/autofill_dialog.h
+++ b/chrome/browser/autofill/autofill_dialog.h
@@ -7,6 +7,7 @@
#include <vector>
+#include "app/gfx/native_widget_types.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/credit_card.h"
@@ -27,18 +28,24 @@ class AutoFillDialogObserver {
};
// Shows the AutoFill dialog, which allows the user to edit profile information.
-// |profiles| is a vector of autofill profiles that contains the current profile
-// information. The dialog fills out the profile fields using this data. Any
-// changes made to the profile information through the dialog should be
-// transferred back into |profiles| and |credit_cards|. |observer| will be
+// |profile| is profile from which you can get vectors of of autofill profiles
+// that contains the current profile information and credit cards.
+// The dialog fills out the profile fields using this data. |observer| will be
// notified by OnAutoFillDialogAccept when the user has applied changes.
//
// The PersonalDataManager owns the contents of these vectors. The lifetime of
// the contents is until the PersonalDataManager replaces them with new data
// whenever the web database is updated.
+#if defined(OS_MACOSX)
+// TODO(dhollowa): update .mm files and remove this.
void ShowAutoFillDialog(AutoFillDialogObserver* observer,
const std::vector<AutoFillProfile*>& profiles,
const std::vector<CreditCard*>& credit_cards,
Profile* profile);
+#else
+void ShowAutoFillDialog(gfx::NativeWindow parent,
+ AutoFillDialogObserver* observer,
+ Profile* profile);
+#endif
#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DIALOG_H_
diff --git a/chrome/browser/autofill/autofill_dialog_gtk.cc b/chrome/browser/autofill/autofill_dialog_gtk.cc
index e447c21..d3bcb80 100644
--- a/chrome/browser/autofill/autofill_dialog_gtk.cc
+++ b/chrome/browser/autofill/autofill_dialog_gtk.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/credit_card.h"
#include "chrome/browser/autofill/form_group.h"
+#include "chrome/browser/autofill/personal_data_manager.h"
#include "chrome/browser/gtk/gtk_util.h"
#include "chrome/browser/gtk/options/options_layout_gtk.h"
#include "chrome/browser/profile.h"
@@ -893,12 +894,13 @@ void AutoFillDialog::AddCreditCard(const CreditCard& credit_card) {
///////////////////////////////////////////////////////////////////////////////
// Factory/finder method:
-void ShowAutoFillDialog(AutoFillDialogObserver* observer,
- const std::vector<AutoFillProfile*>& profiles,
- const std::vector<CreditCard*>& credit_cards,
+void ShowAutoFillDialog(gfx::NativeWindow parent,
+ AutoFillDialogObserver* observer,
Profile *profile) {
if (!dialog) {
- dialog = new AutoFillDialog(observer, profiles, credit_cards);
+ dialog = new AutoFillDialog(observer,
+ profile->GetPersonalDataManager()->profiles(),
+ profile->GetPersonalDataManager()->credit_cards());
}
dialog->Show();
}
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 053a423f..b9e46e6 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -227,11 +227,17 @@ void AutoFillManager::OnPersonalDataLoaded() {
// remove ourselves as observer.
personal_data_->RemoveObserver(this);
- ShowAutoFillDialog(
- this,
- personal_data_->web_profiles(),
- personal_data_->credit_cards(),
- tab_contents_->profile()->GetOriginalProfile());
+#if !defined(OS_WIN)
+#if defined(OS_MACOSX)
+ ShowAutoFillDialog(this,
+ personal_data_->web_profiles(),
+ personal_data_->credit_cards(),
+ tab_contents_->profile()->GetOriginalProfile());
+#else // defined(OS_MACOSX)
+ ShowAutoFillDialog(NULL, this,
+ tab_contents_->profile()->GetOriginalProfile());
+#endif // defined(OS_MACOSX)
+#endif // !defined(OS_WIN)
}
void AutoFillManager::OnInfoBarClosed() {
@@ -254,12 +260,17 @@ void AutoFillManager::OnInfoBarAccepted() {
// uploaded form structure as the initial profile in the AutoFillDialog.
personal_data_->SaveImportedFormData();
+#if defined(OS_WIN)
+ ShowAutoFillDialog(tab_contents_->GetContentNativeView(), this,
+ tab_contents_->profile()->GetOriginalProfile());
+#else
// If the personal data manager has not loaded the data yet, set ourselves as
// its observer so that we can listen for the OnPersonalDataLoaded signal.
if (!personal_data_->IsDataLoaded())
personal_data_->SetObserver(this);
else
OnPersonalDataLoaded();
+#endif
}
void AutoFillManager::OnInfoBarCancelled() {
diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc
index ed617c0..f911c44 100644
--- a/chrome/browser/gtk/options/content_page_gtk.cc
+++ b/chrome/browser/gtk/options/content_page_gtk.cc
@@ -179,9 +179,7 @@ void ContentPageGtk::OnPersonalDataLoaded() {
// remove ourselves as observer.
personal_data_->RemoveObserver(this);
- ShowAutoFillDialog(
- personal_data_, personal_data_->profiles(),
- personal_data_->credit_cards(), profile());
+ ShowAutoFillDialog(NULL, personal_data_, profile());
}
GtkWidget* ContentPageGtk::InitPasswordSavingGroup() {
diff --git a/chrome/browser/views/autofill_profiles_view_win.cc b/chrome/browser/views/autofill_profiles_view_win.cc
index 5966b5e..54ac769 100644
--- a/chrome/browser/views/autofill_profiles_view_win.cc
+++ b/chrome/browser/views/autofill_profiles_view_win.cc
@@ -11,8 +11,12 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/message_loop.h"
-// TODO(georgey) remove this when resources available.
+#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_list.h"
+#include "chrome/browser/browser_window.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/theme_resources_util.h"
+#include "chrome/browser/window_sizer.h"
#include "gfx/size.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -73,37 +77,27 @@ int AutoFillProfilesView::ScrollViewContents::line_height_ = 0;
// AutoFillProfilesView, public:
AutoFillProfilesView::AutoFillProfilesView(
AutoFillDialogObserver* observer,
- const std::vector<AutoFillProfile*>& profiles,
- const std::vector<CreditCard*>& credit_cards)
- : observer_(observer),
+ PersonalDataManager* personal_data_manager)
+ : personal_data_manager_(personal_data_manager),
+ observer_(observer),
scroll_view_(NULL),
save_changes_(NULL) {
- profiles_set_.reserve(profiles.size());
- for (std::vector<AutoFillProfile*>::const_iterator address_it =
- profiles.begin();
- address_it != profiles.end();
- ++address_it) {
- profiles_set_.push_back(EditableSetInfo(*address_it, false));
- }
- credit_card_set_.reserve(credit_cards.size());
- for (std::vector<CreditCard*>::const_iterator cc_it = credit_cards.begin();
- cc_it != credit_cards.end();
- ++cc_it) {
- credit_card_set_.push_back(EditableSetInfo(*cc_it, false));
- }
}
AutoFillProfilesView::~AutoFillProfilesView() {
+ // Removes observer if we are observing Profile load. Does nothing otherwise.
+ if (personal_data_manager_)
+ personal_data_manager_->RemoveObserver(this);
}
-int AutoFillProfilesView::Show(AutoFillDialogObserver* observer,
- const std::vector<AutoFillProfile*>& profiles,
- const std::vector<CreditCard*>& credit_cards) {
+int AutoFillProfilesView::Show(gfx::NativeWindow parent,
+ AutoFillDialogObserver* observer,
+ PersonalDataManager* personal_data_manager) {
if (!instance_) {
- instance_ = new AutoFillProfilesView(observer, profiles, credit_cards);
+ instance_ = new AutoFillProfilesView(observer, personal_data_manager);
// |instance_| will get deleted once Close() is called.
- views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_);
+ views::Window::CreateChromeWindow(parent, gfx::Rect(), instance_);
}
if (!instance_->window()->IsVisible())
instance_->window()->Show();
@@ -261,8 +255,17 @@ void AutoFillProfilesView::ButtonPressed(views::Button* sender,
}
/////////////////////////////////////////////////////////////////////////////
+// AutoFillProfilesView, PersonalDataManager::Observer implementation.
+void AutoFillProfilesView::OnPersonalDataLoaded() {
+ personal_data_manager_->RemoveObserver(this);
+ GetData();
+ scroll_view_->RebuildView();
+}
+
+/////////////////////////////////////////////////////////////////////////////
// AutoFillProfilesView, private:
void AutoFillProfilesView::Init() {
+ GetData();
scroll_view_ = new AutoFillScrollView(this,
&profiles_set_,
&credit_card_set_);
@@ -280,6 +283,31 @@ void AutoFillProfilesView::Init() {
ValidateAndFixLabel();
}
+void AutoFillProfilesView::GetData() {
+ if (!personal_data_manager_->IsDataLoaded()) {
+ personal_data_manager_->SetObserver(this);
+ return;
+ }
+ profiles_set_.reserve(personal_data_manager_->profiles().size());
+ for (std::vector<AutoFillProfile*>::const_iterator address_it =
+ personal_data_manager_->profiles().begin();
+ address_it != personal_data_manager_->profiles().end();
+ ++address_it) {
+ profiles_set_.push_back(EditableSetInfo(*address_it, false));
+ }
+ credit_card_set_.reserve(personal_data_manager_->credit_cards().size());
+ for (std::vector<CreditCard*>::const_iterator cc_it =
+ personal_data_manager_->credit_cards().begin();
+ cc_it != personal_data_manager_->credit_cards().end();
+ ++cc_it) {
+ credit_card_set_.push_back(EditableSetInfo(*cc_it, false));
+ }
+}
+
+bool AutoFillProfilesView::IsDataReady() const {
+ return personal_data_manager_->IsDataLoaded();
+}
+
/////////////////////////////////////////////////////////////////////////////
// AutoFillProfilesView::PhoneSubView, public:
AutoFillProfilesView::PhoneSubView::PhoneSubView(
@@ -563,14 +591,16 @@ void AutoFillProfilesView::EditableSetViewContents::InitTitle(
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
SkBitmap *image = NULL;
if (editable_fields_set_->is_opened) {
- // TODO(georgey) fix this when resources available.
- image = rb.GetBitmapNamed(ThemeResourcesUtil::GetId("app_droparrow"));
+ image =
+ rb.GetBitmapNamed(ThemeResourcesUtil::GetId("expand_arrow_down_icon"));
} else {
- // TODO(georgey) fix this when resources available.
- image = rb.GetBitmapNamed(ThemeResourcesUtil::GetId("arrow_right"));
+ image =
+ rb.GetBitmapNamed(ThemeResourcesUtil::GetId("expand_arrow_right_icon"));
title_label_preview_ = new views::Label(title_preview);
}
expand_item_button_->SetImage(views::CustomButton::BS_NORMAL, image);
+ expand_item_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
+ views::ImageButton::ALIGN_MIDDLE);
title_label_ = new views::Label(title);
gfx::Font title_font =
rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD);
@@ -594,7 +624,7 @@ void AutoFillProfilesView::EditableSetViewContents::InitTitle(
title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
layout->StartRow(0, three_column_header_);
- layout->AddView(expand_item_button_);
+ layout->AddView(expand_item_button_, 2, 1);
if (editable_fields_set_->is_opened) {
layout->AddView(title_label_, 3, 1);
} else {
@@ -1005,6 +1035,12 @@ void AutoFillProfilesView::ScrollViewContents::Init() {
column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing);
column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
views::GridLayout::USE_PREF, 0, 0);
+ if (!observer_->IsDataReady()) {
+ layout->StartRow(0, single_column_filled_view_set_id);
+ layout->AddView(new views::Label(
+ l10n_util::GetString(IDS_AUTOFILL_LOADING)));
+ return;
+ }
const int single_column_left_view_set_id = 1;
column_set = layout->AddColumnSet(single_column_left_view_set_id);
column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing);
@@ -1119,10 +1155,13 @@ void AutoFillProfilesView::AutoFillScrollView::Layout() {
}
// Declared in "chrome/browser/autofill/autofill_dialog.h"
-void ShowAutoFillDialog(AutoFillDialogObserver* observer,
- const std::vector<AutoFillProfile*>& profiles,
- const std::vector<CreditCard*>& credit_cards,
+void ShowAutoFillDialog(gfx::NativeWindow parent,
+ AutoFillDialogObserver* observer,
Profile* profile) {
- AutoFillProfilesView::Show(observer, profiles, credit_cards);
+ DCHECK(profile);
+ PersonalDataManager* personal_data_manager =
+ profile->GetPersonalDataManager();
+ DCHECK(personal_data_manager);
+ AutoFillProfilesView::Show(parent, observer, personal_data_manager);
}
diff --git a/chrome/browser/views/autofill_profiles_view_win.h b/chrome/browser/views/autofill_profiles_view_win.h
index eeb522d..fcf1c7c 100644
--- a/chrome/browser/views/autofill_profiles_view_win.h
+++ b/chrome/browser/views/autofill_profiles_view_win.h
@@ -11,6 +11,7 @@
#include "app/combobox_model.h"
#include "chrome/browser/autofill/autofill_dialog.h"
#include "chrome/browser/autofill/autofill_profile.h"
+#include "chrome/browser/autofill/personal_data_manager.h"
#include "views/controls/combobox/combobox.h"
#include "views/controls/textfield/textfield.h"
#include "views/view.h"
@@ -44,13 +45,14 @@ class ScrollView;
// deletion.
class AutoFillProfilesView : public views::View,
public views::DialogDelegate,
- public views::ButtonListener {
+ public views::ButtonListener,
+ public PersonalDataManager::Observer {
public:
virtual ~AutoFillProfilesView();
- static int Show(AutoFillDialogObserver* observer,
- const std::vector<AutoFillProfile*>& profiles,
- const std::vector<CreditCard*>& credit_cards);
+ static int Show(gfx::NativeWindow parent,
+ AutoFillDialogObserver* observer,
+ PersonalDataManager* personal_data_manager);
protected:
enum EditableSetType {
@@ -101,6 +103,9 @@ class AutoFillProfilesView : public views::View,
virtual void ButtonPressed(views::Button* sender,
const views::Event& event);
+ // PersonalDataManager::Observer methods:
+ void OnPersonalDataLoaded();
+
// Helper structure to keep info on one address or credit card.
// Keeps info on one item in EditableSetViewContents.
// Also keeps info on opened status. Allows to quickly add and delete items,
@@ -127,10 +132,12 @@ class AutoFillProfilesView : public views::View,
private:
AutoFillProfilesView(AutoFillDialogObserver* observer,
- const std::vector<AutoFillProfile*>& profiles,
- const std::vector<CreditCard*>& credit_cards);
+ PersonalDataManager* personal_data_manager);
void Init();
+ void GetData();
+ bool IsDataReady() const;
+
// PhoneSubView encapsulates three phone fields (country, area, and phone)
// and label above them, so they could be used together in one grid cell.
class PhoneSubView : public views::View {
@@ -306,6 +313,7 @@ class AutoFillProfilesView : public views::View,
virtual gfx::Size GetPreferredSize();
virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
views::View* child);
+
// views::ButtonListener methods:
virtual void ButtonPressed(views::Button* sender,
const views::Event& event);
@@ -353,6 +361,7 @@ class AutoFillProfilesView : public views::View,
};
AutoFillDialogObserver* observer_;
+ PersonalDataManager* personal_data_manager_;
std::vector<EditableSetInfo> profiles_set_;
std::vector<EditableSetInfo> credit_card_set_;
diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc
index a8f515c..5e70111 100644
--- a/chrome/browser/views/options/content_page_view.cc
+++ b/chrome/browser/views/options/content_page_view.cc
@@ -73,9 +73,6 @@ ContentPageView::ContentPageView(Profile* profile)
}
ContentPageView::~ContentPageView() {
- // Removes observer if we are observing Profile load. Does nothing otherwise.
- if (profile()->GetPersonalDataManager())
- profile()->GetPersonalDataManager()->RemoveObserver(this);
if (sync_service_)
sync_service_->RemoveObserver(this);
}
@@ -113,14 +110,9 @@ void ContentPageView::ButtonPressed(
} else if (sender == change_autofill_settings_button_) {
// This button should be disabled if we lack PersonalDataManager.
DCHECK(profile()->GetPersonalDataManager());
- if (!profile()->GetPersonalDataManager()->IsDataLoaded()) {
- profile()->GetPersonalDataManager()->SetObserver(this);
- } else {
- ShowAutoFillDialog(profile()->GetPersonalDataManager(),
- profile()->GetPersonalDataManager()->profiles(),
- profile()->GetPersonalDataManager()->credit_cards(),
- profile());
- }
+ ShowAutoFillDialog(GetWindow()->GetNativeWindow(),
+ profile()->GetPersonalDataManager(),
+ profile());
} else if (sender == themes_reset_button_) {
UserMetricsRecordAction("Options_ThemesReset", profile()->GetPrefs());
profile()->ClearTheme();
@@ -418,14 +410,6 @@ void ContentPageView::OnConfirmMessageAccept() {
ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
}
-void ContentPageView::OnPersonalDataLoaded() {
- ShowAutoFillDialog(profile()->GetPersonalDataManager(),
- profile()->GetPersonalDataManager()->profiles(),
- profile()->GetPersonalDataManager()->credit_cards(),
- profile());
- profile()->GetPersonalDataManager()->RemoveObserver(this);
-}
-
void ContentPageView::InitSyncGroup() {
sync_status_label_ = new views::Label;
sync_status_label_->SetMultiLine(true);
diff --git a/chrome/browser/views/options/content_page_view.h b/chrome/browser/views/options/content_page_view.h
index dd7b456..9f5871b 100644
--- a/chrome/browser/views/options/content_page_view.h
+++ b/chrome/browser/views/options/content_page_view.h
@@ -31,8 +31,7 @@ class ContentPageView : public OptionsPageView,
public views::LinkController,
public ProfileSyncServiceObserver,
public views::ButtonListener,
- public ConfirmMessageBoxObserver,
- public PersonalDataManager::Observer {
+ public ConfirmMessageBoxObserver {
public:
explicit ContentPageView(Profile* profile);
virtual ~ContentPageView();
@@ -46,9 +45,6 @@ class ContentPageView : public OptionsPageView,
// ConfirmMessageBoxObserver implementation.
virtual void OnConfirmMessageAccept();
- // PersonalDataManager::Observer implementation.
- virtual void OnPersonalDataLoaded();
-
// ProfileSyncServiceObserver method.
virtual void OnStateChanged();
diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/views/options/options_window_view.cc
index 6b2e206..86933b65 100644
--- a/chrome/browser/views/options/options_window_view.cc
+++ b/chrome/browser/views/options/options_window_view.cc
@@ -110,6 +110,7 @@ void OptionsWindowView::ShowOptionsPage(OptionsPage page,
WindowSizer::MonitorInfoProvider* provider =
WindowSizer::CreateDefaultMonitorInfoProvider();
frame_bounds = provider->GetMonitorWorkAreaMatching(frame_bounds);
+ delete provider;
}
gfx::Point origin = frame_bounds.origin();
origin.Offset(