summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-06 00:35:09 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-06 00:35:09 +0000
commitd60677ca2916e3869a643b904f54b3b2c1f266cc (patch)
treed352191de550668fd38927f6f2fdb607369393c0 /chrome/browser/cocoa
parentebc1b688ec329581638e14253cc4fabb500a37a6 (diff)
downloadchromium_src-d60677ca2916e3869a643b904f54b3b2c1f266cc.zip
chromium_src-d60677ca2916e3869a643b904f54b3b2c1f266cc.tar.gz
chromium_src-d60677ca2916e3869a643b904f54b3b2c1f266cc.tar.bz2
AutoFill Mac preference for enabling Address Book "me" card usage.
Adds a boolean preference to specify whether to use the Mac user's Address Book "me" card as a source of information for AutoFill addresses. This CL adds the Mac UI and the preference setup only. It does not cover the functionality for fetching the actual Address Book data. The changes to AutoFillDialog.xib add the checkbox UI and bind the checkbox to the |auxiliaryEnabled| property in the controller class. The |addressSection_| outlet is set to the spacer following the new checkbox. Unit tests are included for the addition of the preference at the mac dialog controller level. BUG=36496 TEST=PersonalDataManagerTest, AutoFillDialogControllerTest Review URL: http://codereview.chromium.org/668171 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/preferences_window_controller.mm31
-rw-r--r--chrome/browser/cocoa/vertical_layout_view.mm2
2 files changed, 21 insertions, 12 deletions
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm
index 8422df7..f380661 100644
--- a/chrome/browser/cocoa/preferences_window_controller.mm
+++ b/chrome/browser/cocoa/preferences_window_controller.mm
@@ -427,8 +427,10 @@ class PrefObserverBridge : public NotificationObserver,
class PersonalDataManagerObserver : public PersonalDataManager::Observer {
public:
explicit PersonalDataManagerObserver(
- PersonalDataManager* personal_data_manager)
- : personal_data_manager_(personal_data_manager) {
+ PersonalDataManager* personal_data_manager,
+ Profile* profile)
+ : personal_data_manager_(personal_data_manager),
+ profile_(profile) {
}
virtual ~PersonalDataManagerObserver();
@@ -439,7 +441,8 @@ class PersonalDataManagerObserver : public PersonalDataManager::Observer {
// Static method to dispatch to |ShowAutoFillDialog| method in autofill
// module. This is public to facilitate direct external call when the
// data manager has already loaded its data.
- static void ShowAutoFillDialog(PersonalDataManager* personal_data_manager);
+ static void ShowAutoFillDialog(PersonalDataManager* personal_data_manager,
+ Profile* profile);
private:
// Utility method to remove |this| from |personal_data_manager_| as an
@@ -452,6 +455,9 @@ class PersonalDataManagerObserver : public PersonalDataManager::Observer {
// Weak reference.
PersonalDataManager* personal_data_manager_;
+ // Profile of caller. Held as weak reference. May not be NULL.
+ Profile* profile_;
+
private:
DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerObserver);
};
@@ -474,24 +480,26 @@ void PersonalDataManagerObserver::RemoveObserver() {
// (deleting |this| in the process).
void PersonalDataManagerObserver::OnPersonalDataLoaded() {
RemoveObserver();
- PersonalDataManagerObserver::ShowAutoFillDialog(personal_data_manager_);
+ PersonalDataManagerObserver::ShowAutoFillDialog(personal_data_manager_,
+ profile_);
}
// Dispatches request to show the autofill dialog. If there are no profiles
// in the |personal_data_manager| the we create a new one here. Similary with
// credit card info.
void PersonalDataManagerObserver::ShowAutoFillDialog(
- PersonalDataManager* personal_data_manager) {
+ PersonalDataManager* personal_data_manager, Profile* profile) {
+ DCHECK(profile);
if (!personal_data_manager)
return;
std::vector<AutoFillProfile*> profiles = personal_data_manager->profiles();
- AutoFillProfile profile(ASCIIToUTF16(""), 0);
+ AutoFillProfile autofill_profile(ASCIIToUTF16(""), 0);
if (profiles.size() == 0) {
string16 new_profile_name =
l10n_util::GetStringUTF16(IDS_AUTOFILL_NEW_ADDRESS);
- profile.set_label(new_profile_name);
- profiles.push_back(&profile);
+ autofill_profile.set_label(new_profile_name);
+ profiles.push_back(&autofill_profile);
}
std::vector<CreditCard*> credit_cards = personal_data_manager->credit_cards();
@@ -503,7 +511,7 @@ void PersonalDataManagerObserver::ShowAutoFillDialog(
credit_cards.push_back(&credit_card);
}
- ::ShowAutoFillDialog(personal_data_manager, profiles, credit_cards);
+ ::ShowAutoFillDialog(personal_data_manager, profiles, credit_cards, profile);
}
@@ -1267,12 +1275,13 @@ const int kDisabledIndex = 1;
if (personalDataManager->IsDataLoaded()) {
// |personalDataManager| data is loaded, we can proceed with the dialog.
- PersonalDataManagerObserver::ShowAutoFillDialog(personalDataManager);
+ PersonalDataManagerObserver::ShowAutoFillDialog(personalDataManager,
+ profile_);
} else {
// |personalDataManager| data is NOT loaded, so we load it here, installing
// our observer.
personalDataManagerObserver_.reset(
- new PersonalDataManagerObserver(personalDataManager));
+ new PersonalDataManagerObserver(personalDataManager, profile_));
personalDataManager->SetObserver(personalDataManagerObserver_.get());
}
}
diff --git a/chrome/browser/cocoa/vertical_layout_view.mm b/chrome/browser/cocoa/vertical_layout_view.mm
index b4e6a5e..f2070db 100644
--- a/chrome/browser/cocoa/vertical_layout_view.mm
+++ b/chrome/browser/cocoa/vertical_layout_view.mm
@@ -29,7 +29,7 @@
}
// Override the default |viewWillDraw| to indicate to drawing machinery proper
-// arrangement of subvies.
+// arrangement of subviews.
- (void)viewWillDraw {
// Reposition child views prior to super's descent into its |viewWillDraw|
// pass.