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

Unified Diff: chrome/browser/cocoa/preferences_window_controller.mm

Issue 668171: AutoFill Mac preference for enabling Address Book "me" card usage.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months 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/autofill/personal_data_manager.h ('k') | chrome/browser/cocoa/vertical_layout_view.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/preferences_window_controller.mm
===================================================================
--- chrome/browser/cocoa/preferences_window_controller.mm (revision 40742)
+++ chrome/browser/cocoa/preferences_window_controller.mm (working copy)
@@ -427,8 +427,10 @@
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 @@
// 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 @@
// 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 @@
// (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 @@
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 @@
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());
}
}
« no previous file with comments | « chrome/browser/autofill/personal_data_manager.h ('k') | chrome/browser/cocoa/vertical_layout_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698