diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-23 00:52:41 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-23 00:52:41 +0000 |
commit | dd856dfd5ce52bf74131726882c30bf3eb0de3c3 (patch) | |
tree | 51a951efc86053fc9f6776a630c74abbed30b267 | |
parent | 803ca31f4dad20ddcecb52a9486031ee66732daa (diff) | |
download | chromium_src-dd856dfd5ce52bf74131726882c30bf3eb0de3c3.zip chromium_src-dd856dfd5ce52bf74131726882c30bf3eb0de3c3.tar.gz chromium_src-dd856dfd5ce52bf74131726882c30bf3eb0de3c3.tar.bz2 |
Remove billing address handling from Autofill preferences.
Removes the billing address drop down from the Autofill preferences "Add credit card" dialog.
Nib changes: remove the billing address label and drop down from AutoFillCreditCardSheet.xib.
BUG=57976
TEST=compiles, no billing address drop down visible in any Autofill preferences UI.
Review URL: http://codereview.chromium.org/3964003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63605 0039d316-1c4b-4281-b951-d872f2087c98
18 files changed, 65 insertions, 698 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 8b2af54..c0e6778 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6745,9 +6745,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_AUTOFILL_DIALOG_EXPIRATION_DATE" desc="The label of the Expiration date entry."> Expiration date: </message> - <message name="IDS_AUTOFILL_DIALOG_BILLING_ADDRESS" desc="The label of the Billing address entry."> - Billing address: - </message> </if> <if expr="os != 'darwin'"> <message name="IDS_AUTOFILL_DIALOG_LABEL" desc="The label of the Label entry."> @@ -6798,9 +6795,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_AUTOFILL_DIALOG_EXPIRATION_DATE" desc="The label of the Expiration date entry."> Expiration date </message> - <message name="IDS_AUTOFILL_DIALOG_BILLING_ADDRESS" desc="The label of the Billing address entry."> - Billing address - </message> </if> <message name="IDS_AUTOFILL_DIALOG_FIRST_NAME" desc="The label of the First name entry."> @@ -6812,15 +6806,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_AUTOFILL_DIALOG_LAST_NAME" desc="The label of the Last name entry."> Last name </message> - <message name="IDS_AUTOFILL_DIALOG_SHIPPING_ADDRESS" desc="The label of the Shipping address entry."> - Shipping - </message> - <message name="IDS_AUTOFILL_DIALOG_CHOOSE_EXISTING_ADDRESS" desc="The label of the Choose existing address entry."> - Choose existing address - </message> - <message name="IDS_AUTOFILL_DIALOG_SAME_AS_BILLING" desc="The label of the same as billing entry."> - same as billing - </message> <message name="IDS_AUTOFILL_DIALOG_SAVE" desc="The label of the Save button on the Autofill dialog."> Save </message> diff --git a/chrome/app/nibs/AutoFillCreditCardSheet.xib b/chrome/app/nibs/AutoFillCreditCardSheet.xib index 23c4b12..0ff59ee 100644 --- a/chrome/app/nibs/AutoFillCreditCardSheet.xib +++ b/chrome/app/nibs/AutoFillCreditCardSheet.xib @@ -47,7 +47,7 @@ <object class="NSWindowTemplate" id="408614443"> <int key="NSWindowStyleMask">1</int> <int key="NSWindowBacking">2</int> - <string key="NSWindowRect">{{100, 165}, {400, 225}}</string> + <string key="NSWindowRect">{{100, 205}, {400, 185}}</string> <int key="NSWTFlags">603979776</int> <string key="NSWindowTitle">Window</string> <string key="NSWindowClass">NSWindow</string> @@ -61,7 +61,7 @@ <object class="NSTextField" id="37237013"> <reference key="NSNextResponder" ref="850204145"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 188}, {196, 17}}</string> + <string key="NSFrame">{{17, 148}, {196, 17}}</string> <reference key="NSSuperview" ref="850204145"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="359972329"> @@ -117,7 +117,7 @@ <object class="NSTextField" id="284349572"> <reference key="NSNextResponder" ref="850204145"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 159}, {146, 17}}</string> + <string key="NSFrame">{{17, 119}, {146, 17}}</string> <reference key="NSSuperview" ref="850204145"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="571336836"> @@ -165,93 +165,6 @@ </object> </object> </object> - <object class="NSTextField" id="55735488"> - <reference key="NSNextResponder" ref="850204145"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 131}, {146, 17}}</string> - <reference key="NSSuperview" ref="850204145"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="293259553"> - <int key="NSCellFlags">68288064</int> - <int key="NSCellFlags2">71435264</int> - <string key="NSContents">^IDS_AUTOFILL_DIALOG_BILLING_ADDRESS</string> - <reference key="NSSupport" ref="766015112"/> - <reference key="NSControlView" ref="55735488"/> - <reference key="NSBackgroundColor" ref="472147303"/> - <reference key="NSTextColor" ref="836547888"/> - </object> - </object> - <object class="NSPopUpButton" id="329875611"> - <reference key="NSNextResponder" ref="850204145"/> - <int key="NSvFlags">268</int> - <string key="NSFrame">{{165, 126}, {196, 26}}</string> - <reference key="NSSuperview" ref="850204145"/> - <bool key="NSEnabled">YES</bool> - <object class="NSPopUpButtonCell" key="NSCell" id="770068771"> - <int key="NSCellFlags">-2076049856</int> - <int key="NSCellFlags2">2048</int> - <reference key="NSSupport" ref="872268129"/> - <reference key="NSControlView" ref="329875611"/> - <int key="NSButtonFlags">109199615</int> - <int key="NSButtonFlags2">129</int> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">400</int> - <int key="NSPeriodicInterval">75</int> - <object class="NSMenuItem" key="NSMenuItem" id="662913685"> - <reference key="NSMenu" ref="808967741"/> - <string key="NSTitle"/> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <int key="NSState">1</int> - <object class="NSCustomResource" key="NSOnImage" id="101847514"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">NSMenuCheckmark</string> - </object> - <object class="NSCustomResource" key="NSMixedImage" id="6495337"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">NSMenuMixedState</string> - </object> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="770068771"/> - </object> - <bool key="NSMenuItemRespectAlignment">YES</bool> - <object class="NSMenu" key="NSMenu" id="808967741"> - <string key="NSTitle">OtherViews</string> - <object class="NSMutableArray" key="NSMenuItems"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="662913685"/> - <object class="NSMenuItem" id="537705532"> - <reference key="NSMenu" ref="808967741"/> - <string key="NSTitle">Item 2</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="101847514"/> - <reference key="NSMixedImage" ref="6495337"/> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="770068771"/> - </object> - <object class="NSMenuItem" id="782118437"> - <reference key="NSMenu" ref="808967741"/> - <string key="NSTitle">Item 3</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="101847514"/> - <reference key="NSMixedImage" ref="6495337"/> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="770068771"/> - </object> - </object> - </object> - <int key="NSPreferredEdge">1</int> - <bool key="NSUsesItemFromMenu">YES</bool> - <bool key="NSAltersState">YES</bool> - <int key="NSArrowPosition">2</int> - </object> - </object> <object class="NSTextField" id="467266453"> <reference key="NSNextResponder" ref="850204145"/> <int key="NSvFlags">268</int> @@ -271,7 +184,7 @@ <object class="NSTextField" id="731633316"> <reference key="NSNextResponder" ref="850204145"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{168, 158}, {190, 22}}</string> + <string key="NSFrame">{{168, 118}, {190, 22}}</string> <reference key="NSSuperview" ref="850204145"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="557583037"> @@ -350,8 +263,14 @@ <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <int key="NSState">1</int> - <reference key="NSOnImage" ref="101847514"/> - <reference key="NSMixedImage" ref="6495337"/> + <object class="NSCustomResource" key="NSOnImage" id="722308368"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSMenuCheckmark</string> + </object> + <object class="NSCustomResource" key="NSMixedImage" id="1033484486"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSMenuMixedState</string> + </object> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="200856906"/> </object> @@ -367,8 +286,8 @@ <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="101847514"/> - <reference key="NSMixedImage" ref="6495337"/> + <reference key="NSOnImage" ref="722308368"/> + <reference key="NSMixedImage" ref="1033484486"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="200856906"/> </object> @@ -378,8 +297,8 @@ <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="101847514"/> - <reference key="NSMixedImage" ref="6495337"/> + <reference key="NSOnImage" ref="722308368"/> + <reference key="NSMixedImage" ref="1033484486"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="200856906"/> </object> @@ -415,8 +334,8 @@ <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <int key="NSState">1</int> - <reference key="NSOnImage" ref="101847514"/> - <reference key="NSMixedImage" ref="6495337"/> + <reference key="NSOnImage" ref="722308368"/> + <reference key="NSMixedImage" ref="1033484486"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="7661118"/> </object> @@ -432,8 +351,8 @@ <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="101847514"/> - <reference key="NSMixedImage" ref="6495337"/> + <reference key="NSOnImage" ref="722308368"/> + <reference key="NSMixedImage" ref="1033484486"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="7661118"/> </object> @@ -443,8 +362,8 @@ <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="101847514"/> - <reference key="NSMixedImage" ref="6495337"/> + <reference key="NSOnImage" ref="722308368"/> + <reference key="NSMixedImage" ref="1033484486"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="7661118"/> </object> @@ -457,7 +376,7 @@ </object> </object> </object> - <string key="NSFrameSize">{400, 225}</string> + <string key="NSFrameSize">{400, 185}</string> <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> @@ -469,14 +388,6 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">billingAddressPopup_</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="329875611"/> - </object> - <int key="connectionID">152</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> <string key="label">owner_</string> <reference key="source" ref="708631435"/> <reference key="destination" ref="1001"/> @@ -516,22 +427,6 @@ <int key="connectionID">177</int> </object> <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">contentValues: billingAddressContents</string> - <reference key="source" ref="329875611"/> - <reference key="destination" ref="1001"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="329875611"/> - <reference key="NSDestination" ref="1001"/> - <string key="NSLabel">contentValues: billingAddressContents</string> - <string key="NSBinding">contentValues</string> - <string key="NSKeyPath">billingAddressContents</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">188</int> - </object> - <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">window</string> <reference key="source" ref="1001"/> @@ -706,13 +601,11 @@ <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="37237013"/> - <reference ref="816149117"/> <reference ref="284349572"/> + <reference ref="731633316"/> + <reference ref="816149117"/> <reference ref="289669180"/> - <reference ref="55735488"/> - <reference ref="329875611"/> <reference ref="467266453"/> - <reference ref="731633316"/> <reference ref="605627448"/> <reference ref="850579722"/> <reference ref="108322234"/> @@ -763,64 +656,6 @@ <reference key="parent" ref="289669180"/> </object> <object class="IBObjectRecord"> - <int key="objectID">54</int> - <reference key="object" ref="55735488"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="293259553"/> - </object> - <reference key="parent" ref="850204145"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">57</int> - <reference key="object" ref="293259553"/> - <reference key="parent" ref="55735488"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">102</int> - <reference key="object" ref="329875611"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="770068771"/> - </object> - <reference key="parent" ref="850204145"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">103</int> - <reference key="object" ref="770068771"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="808967741"/> - </object> - <reference key="parent" ref="329875611"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">104</int> - <reference key="object" ref="808967741"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="662913685"/> - <reference ref="537705532"/> - <reference ref="782118437"/> - </object> - <reference key="parent" ref="770068771"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">105</int> - <reference key="object" ref="662913685"/> - <reference key="parent" ref="808967741"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">106</int> - <reference key="object" ref="537705532"/> - <reference key="parent" ref="808967741"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">107</int> - <reference key="object" ref="782118437"/> - <reference key="parent" ref="808967741"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">21</int> <reference key="object" ref="467266453"/> <object class="NSMutableArray" key="children"> @@ -985,13 +820,6 @@ <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>-3.IBPluginDependency</string> - <string>102.IBPluginDependency</string> - <string>103.IBPluginDependency</string> - <string>104.IBEditorWindowLastContentRect</string> - <string>104.IBPluginDependency</string> - <string>105.IBPluginDependency</string> - <string>106.IBPluginDependency</string> - <string>107.IBPluginDependency</string> <string>17.IBPluginDependency</string> <string>18.CustomClassName</string> <string>18.IBPluginDependency</string> @@ -1028,20 +856,11 @@ <string>241.IBPluginDependency</string> <string>25.IBPluginDependency</string> <string>28.IBPluginDependency</string> - <string>54.IBPluginDependency</string> - <string>57.IBPluginDependency</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{549, 708}, {196, 63}}</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1052,9 +871,9 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{413, 619}, {400, 225}}</string> + <string>{{162, 701}, {400, 185}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{413, 619}, {400, 225}}</string> + <string>{{162, 701}, {400, 185}}</string> <boolean value="NO"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>AutoFillTextField</string> @@ -1077,8 +896,6 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> @@ -1141,7 +958,6 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>billingAddressPopup_</string> <string>caption_</string> <string>creditCardNumberField_</string> <string>expirationMonthPopup_</string> @@ -1149,7 +965,6 @@ </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>NSPopUpButton</string> <string>NSTextField</string> <string>NSTextField</string> <string>NSPopUpButton</string> @@ -1160,7 +975,6 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>billingAddressPopup_</string> <string>caption_</string> <string>creditCardNumberField_</string> <string>expirationMonthPopup_</string> @@ -1169,10 +983,6 @@ <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBToOneOutletInfo"> - <string key="name">billingAddressPopup_</string> - <string key="candidateClassName">NSPopUpButton</string> - </object> - <object class="IBToOneOutletInfo"> <string key="name">caption_</string> <string key="candidateClassName">NSTextField</string> </object> @@ -1311,6 +1121,13 @@ <string key="className">NSWindow</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/nswindow_additions.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> <string key="minorKey">browser/cocoa/themed_window.h</string> </object> </object> diff --git a/chrome/app/resources/locale_settings.grd b/chrome/app/resources/locale_settings.grd index ed25b39..484bf4e 100644 --- a/chrome/app/resources/locale_settings.grd +++ b/chrome/app/resources/locale_settings.grd @@ -373,8 +373,8 @@ <!-- The URL for the "Learn more" page for the Privacy section under Options. --> <message name="IDS_PAGE_INFO_HELP_CENTER" translateable="false"> http://www.google.com/support/chrome/bin/answer.py?hl=[GRITLANGCODE]&answer=95617 - </message> - + </message> + <!-- The width and height of the Page Info bubble characters and lines (See above). --> <message name="IDS_PAGEINFOBUBBLE_WIDTH_CHARS" use_name_for_id="true"> 50 @@ -545,7 +545,7 @@ <!-- The URL for the "Problems installing" page for the Plugins infobar --> <message name="IDS_LEARN_MORE_PLUGININSTALLER_URL" translateable="false"> - http://www.google.com/support/chrome/bin/answer.py?answer=95697&topic=14687 + http://www.google.com/support/chrome/bin/answer.py?answer=95697&topic=14687 </message> <!-- The width and height of the bookmark manager in characters and lines --> @@ -675,7 +675,7 @@ <!-- The height of the AutoFill edit Credit Card dialog in lines. --> <message name="IDS_AUTOFILL_DIALOG_EDIT_CCARD_HEIGHT_LINES" use_name_for_id="true"> - 13 + 9 </message> <!-- The URL for About Google Translate. --> diff --git a/chrome/browser/autofill/auto_fill_editor_gtk.cc b/chrome/browser/autofill/auto_fill_editor_gtk.cc index 09442d7..05675ec 100644 --- a/chrome/browser/autofill/auto_fill_editor_gtk.cc +++ b/chrome/browser/autofill/auto_fill_editor_gtk.cc @@ -530,25 +530,8 @@ class AutoFillCreditCardEditor { private: friend class DeleteTask<AutoFillCreditCardEditor>; - // Types of columns in the address_store_. - enum ColumnTypes { - // Unique if of the CreditCard. - COL_ID, - - // Title of the column. - COL_TITLE, - - COL_COUNT - }; - virtual ~AutoFillCreditCardEditor() {} - // Creates the GtkListStore used to show the billing addresses. - GtkListStore* CreateAddressStore(); - - // Creates the combobox used to show the billing addresses. - GtkWidget* CreateAddressWidget(); - // Creates the combobox for choosing the month. GtkWidget* CreateMonthWidget(); @@ -601,14 +584,11 @@ class AutoFillCreditCardEditor { GtkWidget* dialog_; GtkWidget* name_; - GtkWidget* address_; GtkWidget* number_; GtkWidget* month_; GtkWidget* year_; GtkWidget* ok_button_; - GtkListStore* address_store_; - DISALLOW_COPY_AND_ASSIGN(AutoFillCreditCardEditor); }; @@ -631,11 +611,7 @@ AutoFillCreditCardEditor::AutoFillCreditCardEditor( if (credit_card) { SetWidgetValues(credit_card); } else { - // We're creating a new credit card. Select a default billing address (if - // there are any) and select January of next year. - PersonalDataManager* data_manager = profile_->GetPersonalDataManager(); - if (!data_manager->profiles().empty()) - gtk_combo_box_set_active(GTK_COMBO_BOX(address_), 0); + // We're creating a new credit card. Select January of next year by default. gtk_combo_box_set_active(GTK_COMBO_BOX(month_), 0); gtk_combo_box_set_active(GTK_COMBO_BOX(year_), 1); } @@ -652,54 +628,6 @@ AutoFillCreditCardEditor::AutoFillCreditCardEditor( gtk_util::PresentWindow(dialog_, gtk_get_current_event_time()); } -GtkListStore* AutoFillCreditCardEditor::CreateAddressStore() { - GtkListStore* store = - gtk_list_store_new(COL_COUNT, G_TYPE_INT, G_TYPE_STRING); - - GtkTreeIter iter; - - PersonalDataManager* data_manager = profile_->GetPersonalDataManager(); - for (std::vector<AutoFillProfile*>::const_iterator i = - data_manager->profiles().begin(); - i != data_manager->profiles().end(); ++i) { - FieldTypeSet fields; - (*i)->GetAvailableFieldTypes(&fields); - if (fields.find(ADDRESS_HOME_LINE1) == fields.end() && - fields.find(ADDRESS_HOME_LINE2) == fields.end() && - fields.find(ADDRESS_HOME_APT_NUM) == fields.end() && - fields.find(ADDRESS_HOME_CITY) == fields.end() && - fields.find(ADDRESS_HOME_STATE) == fields.end() && - fields.find(ADDRESS_HOME_ZIP) == fields.end() && - fields.find(ADDRESS_HOME_COUNTRY) == fields.end()) { - // No address information in this profile; it's useless as a billing - // address. - continue; - } - - gtk_list_store_append(store, &iter); - gtk_list_store_set( - store, &iter, - COL_ID, (*i)->unique_id(), - COL_TITLE, UTF16ToUTF8((*i)->PreviewSummary()).c_str(), - -1); - } - return store; -} - -GtkWidget* AutoFillCreditCardEditor::CreateAddressWidget() { - address_store_ = CreateAddressStore(); - - GtkWidget* widget = gtk_combo_box_new_with_model( - GTK_TREE_MODEL(address_store_)); - g_object_unref(address_store_); - - GtkCellRenderer* cell = gtk_cell_renderer_text_new(); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), cell, TRUE); - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget), cell, - "text", COL_TITLE, NULL); - return widget; -} - GtkWidget* AutoFillCreditCardEditor::CreateMonthWidget() { GtkWidget* combobox = gtk_combo_box_new_text(); for (int i = 1; i <= 12; ++i) { @@ -723,16 +651,12 @@ GtkWidget* AutoFillCreditCardEditor::CreateYearWidget() { } void AutoFillCreditCardEditor::Init() { - TableBuilder main_table_builder(8, 2); + TableBuilder main_table_builder(6, 2); main_table_builder.AddWidget( CreateLabel(IDS_AUTOFILL_DIALOG_NAME_ON_CARD), 2); name_ = main_table_builder.AddWidget(gtk_entry_new(), 2); - main_table_builder.AddWidget(CreateLabel(IDS_AUTOFILL_DIALOG_BILLING_ADDRESS), - 2); - address_ = main_table_builder.AddWidget(CreateAddressWidget(), 2); - main_table_builder.AddWidget( CreateLabel(IDS_AUTOFILL_DIALOG_CREDIT_CARD_NUMBER), 2); number_ = main_table_builder.AddWidget(gtk_entry_new(), 1); @@ -785,17 +709,6 @@ void AutoFillCreditCardEditor::RegisterForTextChanged() { void AutoFillCreditCardEditor::SetWidgetValues(CreditCard* card) { SetEntryText(name_, card, CREDIT_CARD_NAME); - PersonalDataManager* data_manager = profile_->GetPersonalDataManager(); - for (std::vector<AutoFillProfile*>::const_iterator i = - data_manager->profiles().begin(); - i != data_manager->profiles().end(); ++i) { - if ((*i)->unique_id() == card->billing_address_id()) { - int index = static_cast<int>(i - data_manager->profiles().begin()); - gtk_combo_box_set_active(GTK_COMBO_BOX(address_), index); - break; - } - } - gtk_entry_set_text(GTK_ENTRY(number_), UTF16ToUTF8(card->ObfuscatedNumber()).c_str()); @@ -857,32 +770,8 @@ void AutoFillCreditCardEditor::ApplyEdits() { void AutoFillCreditCardEditor::SetCreditCardValuesFromWidgets( CreditCard* card) { - PersonalDataManager* data_manager = profile_->GetPersonalDataManager(); - SetFormValue(name_, card, CREDIT_CARD_NAME); - card->set_billing_address_id(0); - int selected_address_index = - gtk_combo_box_get_active(GTK_COMBO_BOX(address_)); - if (selected_address_index != -1) { - GtkTreeIter iter; - gtk_tree_model_iter_nth_child( - GTK_TREE_MODEL(address_store_), &iter, NULL, selected_address_index); - GValue value = { 0 }; - gtk_tree_model_get_value( - GTK_TREE_MODEL(address_store_), &iter, COL_ID, &value); - int id = g_value_get_int(&value); - for (std::vector<AutoFillProfile*>::const_iterator i = - data_manager->profiles().begin(); - i != data_manager->profiles().end(); ++i) { - if ((*i)->unique_id() == id) { - card->set_billing_address_id(id); - break; - } - } - g_value_unset(&value); - } - if (edited_number_) SetFormValue(number_, card, CREDIT_CARD_NUMBER); diff --git a/chrome/browser/autofill/autofill_credit_card_model_mac.h b/chrome/browser/autofill/autofill_credit_card_model_mac.h index 277ff555..093e7cb 100644 --- a/chrome/browser/autofill/autofill_credit_card_model_mac.h +++ b/chrome/browser/autofill/autofill_credit_card_model_mac.h @@ -25,14 +25,12 @@ class CreditCard; NSString* creditCardNumber_; NSString* expirationMonth_; NSString* expirationYear_; - NSInteger billingAddressID_; } @property (nonatomic, copy) NSString* nameOnCard; @property (nonatomic, copy) NSString* creditCardNumber; @property (nonatomic, copy) NSString* expirationMonth; @property (nonatomic, copy) NSString* expirationYear; -@property (nonatomic) NSInteger billingAddressID; // Designated initializer. Initializes the property strings to values retrieved // from the |creditCard| object. diff --git a/chrome/browser/autofill/autofill_credit_card_model_mac.mm b/chrome/browser/autofill/autofill_credit_card_model_mac.mm index 5c49ab2..1eec96f 100644 --- a/chrome/browser/autofill/autofill_credit_card_model_mac.mm +++ b/chrome/browser/autofill/autofill_credit_card_model_mac.mm @@ -15,7 +15,6 @@ @synthesize creditCardNumber = creditCardNumber_; @synthesize expirationMonth = expirationMonth_; @synthesize expirationYear = expirationYear_; -@synthesize billingAddressID = billingAddressID_; - (id)initWithCreditCard:(const CreditCard&)creditCard { if ((self = [super init])) { @@ -27,7 +26,6 @@ creditCard.GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)))]; [self setExpirationYear:SysUTF16ToNSString( creditCard.GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)))]; - [self setBillingAddressID:creditCard.billing_address_id()]; } return self; } @@ -50,7 +48,6 @@ base::SysNSStringToUTF16([self expirationMonth])); creditCard->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), base::SysNSStringToUTF16([self expirationYear])); - creditCard->set_billing_address_id([self billingAddressID]); } @end diff --git a/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm b/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm index f90f7d1..d239f9e 100644 --- a/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm +++ b/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm @@ -27,7 +27,7 @@ TEST(AutoFillCreditCardModelTest, Basic) { TEST(AutoFillCreditCardModelTest, InitializationFromCreditCard) { CreditCard credit_card(string16(), 0); autofill_test::SetCreditCardInfo(&credit_card, "Corporate", - "John Dillinger", "Visa", "123456789012", "01", "2010", 1); + "John Dillinger", "Visa", "123456789012", "01", "2010", 0); scoped_nsobject<AutoFillCreditCardModel> model( [[AutoFillCreditCardModel alloc] initWithCreditCard:credit_card]); EXPECT_TRUE(model.get()); @@ -36,13 +36,12 @@ TEST(AutoFillCreditCardModelTest, InitializationFromCreditCard) { EXPECT_TRUE([[model creditCardNumber] isEqualToString:@"123456789012"]); EXPECT_TRUE([[model expirationMonth] isEqualToString:@"01"]); EXPECT_TRUE([[model expirationYear] isEqualToString:@"2010"]); - EXPECT_EQ(1, [model billingAddressID]); } TEST(AutoFillCreditCardModelTest, CopyModelToCreditCard) { CreditCard credit_card(string16(), 0); autofill_test::SetCreditCardInfo(&credit_card, "Corporate", - "John Dillinger", "Visa", "123456789012", "01", "2010", 1); + "John Dillinger", "Visa", "123456789012", "01", "2010", 0); scoped_nsobject<AutoFillCreditCardModel> model( [[AutoFillCreditCardModel alloc] initWithCreditCard:credit_card]); EXPECT_TRUE(model.get()); @@ -51,7 +50,6 @@ TEST(AutoFillCreditCardModelTest, CopyModelToCreditCard) { [model setCreditCardNumber:@"223456789012"]; [model setExpirationMonth:@"11"]; [model setExpirationYear:@"2011"]; - [model setBillingAddressID:2]; [model copyModelToCreditCard:&credit_card]; @@ -64,7 +62,6 @@ TEST(AutoFillCreditCardModelTest, CopyModelToCreditCard) { EXPECT_EQ(ASCIIToUTF16("2011"), credit_card.GetFieldText( AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); - EXPECT_EQ(2, credit_card.billing_address_id()); } } // namespace diff --git a/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h index 76fa2ad..650fb1c 100644 --- a/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h +++ b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h @@ -27,7 +27,6 @@ typedef NSInteger AutoFillCreditCardMode; // and transcribes it to |creditCardModel| to which the view is bound. @interface AutoFillCreditCardSheetController : NSWindowController { @private - IBOutlet NSPopUpButton* billingAddressPopup_; IBOutlet NSPopUpButton* expirationMonthPopup_; IBOutlet NSPopUpButton* expirationYearPopup_; @@ -44,40 +43,24 @@ typedef NSInteger AutoFillCreditCardMode; // because it is exposed as a KVO compliant property. AutoFillCreditCardModel* creditCardModel_; - // Array of strings that populate the |billingAddressPopup_| control. We - // do not hold this as scoped_nsobject because it is exposed as a KVO - // compliant property. The values of this array may change as the list - // of addresses change in the |parentController_|. - NSArray* billingAddressContents_; - - // Array of IDs corresponding to the strings in |billingAddressContents_|. - std::vector<int> billingAddressIDs_; - // Contents of the expiration month and year popups. Strongly owned. We do // not hold them as scoped_nsobjects because they are exposed as KVO compliant // properties. NSArray* expirationMonthContents_; NSArray* expirationYearContents_; - // A reference to our parent controller. Used for fetching billing address - // labels. May be not be nil. - // Weak reference, owns us. - AutoFillDialogController* parentController_; - // Either "Add" or "Edit" mode of sheet. AutoFillCreditCardMode mode_; } @property (nonatomic, retain) AutoFillCreditCardModel* creditCardModel; -@property (nonatomic, retain) NSArray* billingAddressContents; @property (nonatomic, retain) NSArray* expirationMonthContents; @property (nonatomic, retain) NSArray* expirationYearContents; // Designated initializer. Takes a copy of the data in |creditCard|, // it is not held as a reference. - (id)initWithCreditCard:(const CreditCard&)creditCard - mode:(AutoFillCreditCardMode)mode - controller:(AutoFillDialogController*)parentController; + mode:(AutoFillCreditCardMode)mode; // IBActions for save and cancel buttons. Both invoke |endSheet:|. - (IBAction)save:(id)sender; diff --git a/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.mm b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.mm index 31fbff0..95eb140 100644 --- a/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.mm +++ b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.mm @@ -21,7 +21,6 @@ // Private methods for the |AutoFillCreditCardSheetController| class. @interface AutoFillCreditCardSheetController (PrivateMethods) -- (void)buildBillingAddressContents; - (void)buildExpirationMonthContents; - (void)buildExpirationYearContents; @end @@ -29,13 +28,11 @@ @implementation AutoFillCreditCardSheetController @synthesize creditCardModel = creditCardModel_; -@synthesize billingAddressContents = billingAddressContents_; @synthesize expirationMonthContents = expirationMonthContents_; @synthesize expirationYearContents = expirationYearContents_; - (id)initWithCreditCard:(const CreditCard&)creditCard - mode:(AutoFillCreditCardMode)mode - controller:(AutoFillDialogController*)parentController { + mode:(AutoFillCreditCardMode)mode { NSString* nibPath = [mac_util::MainAppBundle() pathForResource:@"AutoFillCreditCardSheet" ofType:@"nib"]; @@ -45,9 +42,6 @@ [self setCreditCardModel:[[[AutoFillCreditCardModel alloc] initWithCreditCard:creditCard] autorelease]]; - // We keep track of our parent controller for model-update purposes. - parentController_ = parentController; - mode_ = mode; } return self; @@ -55,7 +49,6 @@ - (void)dealloc { [creditCardModel_ release]; - [billingAddressContents_ release]; [expirationMonthContents_ release]; [expirationYearContents_ release]; [super dealloc]; @@ -63,12 +56,10 @@ - (void)awakeFromNib { // Setup initial state of popups. - [self buildBillingAddressContents]; [self buildExpirationMonthContents]; [self buildExpirationYearContents]; // Turn menu autoenable off. We manually govern this. - [billingAddressPopup_ setAutoenablesItems:NO]; [expirationMonthPopup_ setAutoenablesItems:NO]; [expirationYearPopup_ setAutoenablesItems:NO]; @@ -97,55 +88,14 @@ - (void)copyModelToCreditCard:(CreditCard*)creditCard { // The model copies the popup values blindly. We need to clear the strings // in the case that our special menus are in effect. - if ([billingAddressPopup_ indexOfSelectedItem] <= 0) - [creditCardModel_ setBillingAddressID:0]; if ([expirationMonthPopup_ indexOfSelectedItem] <= 0) [creditCardModel_ setExpirationMonth:@""]; if ([expirationYearPopup_ indexOfSelectedItem] <= 0) [creditCardModel_ setExpirationYear:@""]; - // The view does not set the billing address directly. It relies on - // the controller to translate between popup index and the billing address - // ID. Note the -1 offset. This is due to the empty menu item in the popup. - if ([billingAddressPopup_ indexOfSelectedItem] > 0) { - [creditCardModel_ setBillingAddressID: - billingAddressIDs_[[billingAddressPopup_ indexOfSelectedItem]-1]]; - } [creditCardModel_ copyModelToCreditCard:creditCard]; } -// Builds the |billingAddressContents_| array of strings from the list of -// addresses returned by the |parentController_| and additional UI string. -// Ensures that current selection is valid. If not, reset it. -- (void)buildBillingAddressContents { - NSString* menuString = l10n_util::GetNSString( - IDS_AUTOFILL_DIALOG_CHOOSE_EXISTING_ADDRESS); - - // Build the menu array and set it. - NSArray* addressStrings = nil; - [parentController_ addressLabels:&addressStrings - addressIDs:&billingAddressIDs_]; - NSArray* newArray = [[NSArray arrayWithObject:menuString] - arrayByAddingObjectsFromArray:addressStrings]; - [self setBillingAddressContents:newArray]; - - // If the addresses no longer contain our billing address then reset the - // selection. - int distance = std::distance(billingAddressIDs_.begin(), - std::find(billingAddressIDs_.begin(), - billingAddressIDs_.end(), - [creditCardModel_ billingAddressID])); - if (distance >= static_cast<int>(billingAddressIDs_.size())) { - [billingAddressPopup_ selectItemAtIndex:0]; - } else { - [billingAddressPopup_ selectItemAtIndex:distance+1]; - } - - - // Disable first item in menu. "Choose existing address" is a non-item. - [[billingAddressPopup_ itemAtIndex:0] setEnabled:NO]; -} - // Builds array of valid months. Uses special @" " to indicate no selection. - (void)buildExpirationMonthContents { NSArray* newArray = [NSArray arrayWithObjects:@" ", diff --git a/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac_unittest.mm b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac_unittest.mm index 9058070..f6c01d5 100644 --- a/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac_unittest.mm +++ b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac_unittest.mm @@ -21,8 +21,7 @@ TEST(AutoFillCreditCardSheetControllerTest, Basic) { scoped_nsobject<AutoFillCreditCardSheetController> controller( [[AutoFillCreditCardSheetController alloc] initWithCreditCard:credit_card - mode:kAutoFillCreditCardAddMode - controller:nil]); + mode:kAutoFillCreditCardAddMode]); EXPECT_TRUE(controller.get()); } diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.mm b/chrome/browser/autofill/autofill_dialog_controller_mac.mm index f48f952..46acdab 100644 --- a/chrome/browser/autofill/autofill_dialog_controller_mac.mm +++ b/chrome/browser/autofill/autofill_dialog_controller_mac.mm @@ -325,8 +325,7 @@ class PreferenceObserver : public NotificationObserver { creditCardSheetController.reset( [[AutoFillCreditCardSheetController alloc] initWithCreditCard:newCreditCard - mode:kAutoFillCreditCardAddMode - controller:self]); + mode:kAutoFillCreditCardAddMode]); // Show the sheet. [NSApp beginSheet:[creditCardSheetController window] @@ -458,8 +457,7 @@ class PreferenceObserver : public NotificationObserver { creditCardSheetController.reset( [[AutoFillCreditCardSheetController alloc] initWithCreditCard:creditCards_[i] - mode:kAutoFillCreditCardEditMode - controller:self]); + mode:kAutoFillCreditCardEditMode]); // Show the sheet. [NSApp beginSheet:[creditCardSheetController window] diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm b/chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm index e8c7dab..0e6eeab 100644 --- a/chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm +++ b/chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm @@ -114,9 +114,8 @@ class AutoFillDialogObserverMock : public AutoFillDialogObserver { : hit_(false) {} virtual ~AutoFillDialogObserverMock() {} - virtual void OnAutoFillDialogApply( - std::vector<AutoFillProfile>* profiles, - std::vector<CreditCard>* credit_cards) { + virtual void OnAutoFillDialogApply(std::vector<AutoFillProfile>* profiles, + std::vector<CreditCard>* credit_cards) { hit_ = true; std::vector<AutoFillProfile>::iterator i; @@ -265,7 +264,6 @@ TEST_F(AutoFillDialogControllerTest, CreditCardDataMutation) { credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), ASCIIToUTF16("2012")); - credit_card.set_billing_address_id(0); credit_cards().push_back(&credit_card); LoadDialog(); @@ -402,7 +400,6 @@ TEST_F(AutoFillDialogControllerTest, AddNewCreditCard) { // New credit card should match. Don't compare labels. CreditCard new_credit_card; new_credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("Don")); - new_credit_card.set_billing_address_id(0); observer_.credit_cards_[1].set_label(string16()); ASSERT_EQ(observer_.credit_cards_[1], new_credit_card); } diff --git a/chrome/browser/dom_ui/options/autofill_options_handler.cc b/chrome/browser/dom_ui/options/autofill_options_handler.cc index 808353b..62cc760 100644 --- a/chrome/browser/dom_ui/options/autofill_options_handler.cc +++ b/chrome/browser/dom_ui/options/autofill_options_handler.cc @@ -142,10 +142,6 @@ void AutoFillOptionsHandler::SetCreditCardOverlayStrings( l10n_util::GetStringUTF16(IDS_AUTOFILL_EDIT_CREDITCARD_CAPTION)); localized_strings->SetString("nameOnCardLabel", l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_NAME_ON_CARD)); - localized_strings->SetString("billingAddressLabel", - l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_BILLING_ADDRESS)); - localized_strings->SetString("chooseExistingAddress", - l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_CHOOSE_EXISTING_ADDRESS)); localized_strings->SetString("creditCardNumberLabel", l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_CREDIT_CARD_NUMBER)); localized_strings->SetString("creditCardExpirationDateLabel", @@ -306,16 +302,11 @@ void AutoFillOptionsHandler::UpdateCreditCard(const ListValue* args) { string16 value; if (args->GetString(1, &value)) credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), value); - if (args->GetString(2, &value)) { - int id = 0; - base::StringToInt(value, &id); - credit_card.set_billing_address_id(id); - } - if (args->GetString(3, &value)) + if (args->GetString(2, &value)) credit_card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), value); - if (args->GetString(4, &value)) + if (args->GetString(3, &value)) credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), value); - if (args->GetString(5, &value)) + if (args->GetString(4, &value)) credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), value); if (unique_id == 0) @@ -358,8 +349,6 @@ void AutoFillOptionsHandler::EditCreditCard(const ListValue* args) { credit_card_data->SetString( "nameOnCard", credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NAME))); - credit_card_data->SetInteger( - "billingAddress", credit_card->billing_address_id()); credit_card_data->SetString( "creditCardNumber", credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NUMBER))); diff --git a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.html b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.html index a4aef34..32d2aba 100644 --- a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.html +++ b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.html @@ -9,13 +9,6 @@ </div> <div> - <label id="billingAddressLabel"> - <span i18n-content="billingAddressLabel"></span><br> - <select id="billingAddress"></select> - </label> - </div> - - <div> <label id="creditCardNumberLabel"> <span i18n-content="creditCardNumberLabel"></span><br> <input type="text" id="creditCardNumber"> diff --git a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js index 47d4ad3..0050e77 100644 --- a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js +++ b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js @@ -8,9 +8,6 @@ cr.define('options', function() { // The unique ID of the loaded credit card. var uniqueID; - // The unique IDs of the billing addresses. - var billingAddressIDs; - /** * AutoFillEditCreditCardOverlay class * Encapsulated handling of the 'Add Page' overlay page. @@ -43,7 +40,6 @@ cr.define('options', function() { } self.uniqueID = 0; - self.billingAddressIDs = new Array(); self.clearInputFields_(); self.connectInputEvents_(); self.setDefaultSelectOptions_(); @@ -65,19 +61,12 @@ cr.define('options', function() { * @private */ saveCreditCard_: function() { - var creditCard = new Array(6); + var creditCard = new Array(5); creditCard[0] = String(this.uniqueID); creditCard[1] = $('nameOnCard').value; - creditCard[2] = '0'; - creditCard[3] = $('creditCardNumber').value; - creditCard[4] = $('expirationMonth').value; - creditCard[5] = $('expirationYear').value; - - // Set the ID if available. - if (this.billingAddressIDs.length != 0) { - creditCard[2] = - String(this.billingAddressIDs[$('billingAddress').selectedIndex]); - } + creditCard[2] = $('creditCardNumber').value; + creditCard[3] = $('expirationMonth').value; + creditCard[4] = $('expirationYear').value; chrome.send('updateCreditCard', creditCard); }, @@ -90,9 +79,10 @@ cr.define('options', function() { */ connectInputEvents_: function() { var self = this; - $('nameOnCard').oninput = $('billingAddress').onchange = - $('creditCardNumber').oninput = $('expirationMonth').onchange = - $('expirationYear').onchange = function(event) { + $('nameOnCard').oninput = $('creditCardNumber').oninput = + $('expirationMonth').onchange = $('expirationYear').onchange = + // TODO(isherman): What should the indentation of this line be? + function(event) { self.inputFieldChanged_(); } }, @@ -108,33 +98,11 @@ cr.define('options', function() { }, /** - * Clears the options from the billing address select control. - * @private - */ - clearBillingAddressControl_: function() { - $('billingAddress').length = 0; - }, - - /** - * Sets the default billing address in the 'Billing address' select control. - * @private - */ - setDefaultBillingAddress_: function() { - this.clearBillingAddressControl_(); - - var existingAddress = - new Option(localStrings.getString('chooseExistingAddress')); - $('billingAddress').add(existingAddress, null); - }, - - /** - * Sets the default values of the options in the 'Billing address' and - * 'Expiration date' select controls. + * Sets the default values of the options in the 'Expiration date' select + * controls. * @private */ setDefaultSelectOptions_: function() { - this.setDefaultBillingAddress_(); - // Set the 'Expiration month' default options. var expirationMonth = $('expirationMonth'); for (var i = 1; i <= 12; ++i) { @@ -169,7 +137,6 @@ cr.define('options', function() { */ clearInputFields_: function() { $('nameOnCard').value = ''; - $('billingAddress').selectedIndex = 0; $('creditCardNumber').value = ''; $('expirationMonth').selectedIndex = 0; $('expirationYear').selectedIndex = 0; @@ -189,12 +156,6 @@ cr.define('options', function() { // reload the select options just to be safe. this.setDefaultSelectOptions_(); - var id = parseInt(creditCard['billingAddress']); - for (var i = 0; i < this.billingAddressIDs.length; ++i) { - if (this.billingAddressIDs[i] == id) - $('billingAddress').selectedIndex = i; - } - var idx = parseInt(creditCard['expirationMonth'], 10); $('expirationMonth').selectedIndex = idx - 1; @@ -218,30 +179,6 @@ cr.define('options', function() { this.inputFieldChanged_(); this.uniqueID = creditCard['uniqueID']; }, - - /** - * Sets the 'billingAddress' select control with the address labels in - * |addresses|. Also stores the unique IDs of the corresponding addresses - * on this object. - * @private - */ - setBillingAddresses_: function(addresses) { - this.billingAddressIDs = new Array(addresses.length); - - if (addresses.length == 0) { - this.setDefaultBillingAddress_(); - return; - } - - this.clearBillingAddressControl_(); - - for (var i = 0; i < addresses.length; ++i) { - var address = addresses[i]; - var option = new Option(address['label']); - this.billingAddressIDs[i] = address['uniqueID']; - billingAddress.add(option, null); - } - }, }; AutoFillEditCreditCardOverlay.clearInputFields = function(title) { @@ -256,10 +193,6 @@ cr.define('options', function() { $('autoFillCreditCardTitle').textContent = title; }; - AutoFillEditCreditCardOverlay.setBillingAddresses = function(addresses) { - AutoFillEditCreditCardOverlay.getInstance().setBillingAddresses_(addresses); - }; - // Export return { AutoFillEditCreditCardOverlay: AutoFillEditCreditCardOverlay diff --git a/chrome/browser/resources/options/autofill_options.js b/chrome/browser/resources/options/autofill_options.js index 4b606ec..aa3ed73 100644 --- a/chrome/browser/resources/options/autofill_options.js +++ b/chrome/browser/resources/options/autofill_options.js @@ -157,7 +157,6 @@ cr.define('options', function() { profileList.add(option, blankAddress); } - AutoFillEditCreditCardOverlay.setBillingAddresses(addresses); this.updateButtonState_(); }, diff --git a/chrome/browser/views/autofill_profiles_view_win.cc b/chrome/browser/views/autofill_profiles_view_win.cc index 5c991f8..7315953 100644 --- a/chrome/browser/views/autofill_profiles_view_win.cc +++ b/chrome/browser/views/autofill_profiles_view_win.cc @@ -104,7 +104,6 @@ AutoFillProfilesView::AutoFillProfilesView( remove_button_(NULL), scroll_view_(NULL), focus_manager_(NULL), - billing_model_(true), child_dialog_opened_(false) { DCHECK(preferences_); enable_auto_fill_.Init(prefs::kAutoFillEnabled, preferences_, this); @@ -165,7 +164,7 @@ void AutoFillProfilesView::AddClicked(int group_type) { NOTREACHED(); } EditableSetViewContents *edit_view = new - EditableSetViewContents(this, &billing_model_, true, *info); + EditableSetViewContents(this, true, *info); views::Window::CreateChromeWindow(window()->GetNativeWindow(), gfx::Rect(), edit_view); edit_view->window()->Show(); @@ -185,7 +184,7 @@ void AutoFillProfilesView::EditClicked() { it = credit_card_set_.begin() + (index - profiles_set_.size()); EditableSetViewContents *edit_view = new - EditableSetViewContents(this, &billing_model_, false, *it); + EditableSetViewContents(this, false, *it); views::Window::CreateChromeWindow(window()->GetNativeWindow(), gfx::Rect(), edit_view); edit_view->window()->Show(); @@ -203,7 +202,6 @@ void AutoFillProfilesView::DeleteClicked() { last_view_row = table_model_->RowCount() - 1; if (last_view_row >= 0) scroll_view_->Select(scroll_view_->ViewToModel(last_view_row)); - UpdateBillingModel(); UpdateWidgetState(); SaveData(); } @@ -238,7 +236,6 @@ void AutoFillProfilesView::EditAccepted(EditableSetInfo* data, else credit_card_set_.push_back(*data); } - UpdateBillingModel(); UpdateWidgetState(); SaveData(); } @@ -270,10 +267,6 @@ void AutoFillProfilesView::UpdateProfileLabels() { AutoFillProfile::AdjustInferredLabels(&profiles); } -void AutoFillProfilesView::UpdateBillingModel() { - billing_model_.SetAddressLabels(profiles_set_); -} - void AutoFillProfilesView::ChildWindowOpened() { child_dialog_opened_ = true; UpdateWidgetState(); @@ -492,8 +485,6 @@ void AutoFillProfilesView::Init() { l10n_util::GetString(IDS_OPTIONS_AUTOFILL_ENABLE)); enable_auto_fill_button_->set_listener(this); - billing_model_.SetAddressLabels(profiles_set_); - table_model_.reset(new ContentListTableModel(&profiles_set_, &credit_card_set_)); std::vector<TableColumn> columns; @@ -732,14 +723,11 @@ AutoFillProfilesView::EditableSetViewContents::TextFieldToAutoFill // AutoFillProfilesView::EditableSetViewContents, public: AutoFillProfilesView::EditableSetViewContents::EditableSetViewContents( AutoFillProfilesView* observer, - AddressComboBoxModel* billing_model, bool new_item, const EditableSetInfo& field_set) : temporary_info_(field_set), has_credit_card_number_been_edited_(false), observer_(observer), - billing_model_(billing_model), - combo_box_billing_(NULL), new_item_(new_item) { ZeroMemory(text_fields_, sizeof(text_fields_)); } @@ -863,7 +851,6 @@ AutoFillProfilesView::EditableSetViewContents::GetWindowTitle() const { } void AutoFillProfilesView::EditableSetViewContents::WindowClosing() { - billing_model_->ClearComboBoxes(); observer_->ChildWindowClosed(); } @@ -876,7 +863,6 @@ bool AutoFillProfilesView::EditableSetViewContents::Cancel() { // Remove added item - it is last in the list. if (temporary_info_.is_address) { observer_->profiles_set_.pop_back(); - observer_->UpdateBillingModel(); } else { observer_->credit_card_set_.pop_back(); } @@ -946,16 +932,7 @@ bool AutoFillProfilesView::EditableSetViewContents::HandleKeystroke( // views::Combobox::Listener implementations: void AutoFillProfilesView::EditableSetViewContents::ItemChanged( views::Combobox* combo_box, int prev_index, int new_index) { - DCHECK(billing_model_); - if (combo_box == combo_box_billing_) { - if (new_index == -1) { - NOTREACHED(); - } else { - DCHECK(new_index < static_cast<int>(observer_->profiles_set_.size())); - temporary_info_.credit_card.set_billing_address_id( - observer_->profiles_set_[new_index].address.unique_id()); - } - } else if (combo_box == combo_box_month_) { + if (combo_box == combo_box_month_) { if (new_index == -1) { NOTREACHED(); } else { @@ -1078,7 +1055,6 @@ void AutoFillProfilesView::EditableSetViewContents::InitAddressFields( void AutoFillProfilesView::EditableSetViewContents::InitCreditCardFields( views::GridLayout* layout) { DCHECK(!temporary_info_.is_address); - DCHECK(billing_model_); // Create combo box models. combo_box_model_month_.reset(new StringVectorComboboxModel); @@ -1120,20 +1096,6 @@ void AutoFillProfilesView::EditableSetViewContents::InitCreditCardFields( layout->StartRow(0, double_column_fill_view_set_id_); layout->AddView(text_fields_[TEXT_CC_NAME]); - // Address combo boxes. - combo_box_billing_ = new views::Combobox(billing_model_); - combo_box_billing_->set_listener(this); - int billing_id = temporary_info_.credit_card.billing_address_id(); - if (billing_id) - combo_box_billing_->SetSelectedItem(billing_model_->GetIndex(billing_id)); - billing_model_->UsedWithComboBox(combo_box_billing_); - - layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); - layout->StartRow(0, double_column_fill_view_set_id_); - layout->AddView(CreateLeftAlignedLabel(IDS_AUTOFILL_DIALOG_BILLING_ADDRESS)); - layout->StartRow(0, double_column_fill_view_set_id_); - layout->AddView(combo_box_billing_); - // Layout credit card info layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); layout->StartRow(0, double_column_ccnumber_cvc_); @@ -1288,78 +1250,6 @@ bool AutoFillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews( return false; } -///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::AddressComboBoxModel, public: -AutoFillProfilesView::AddressComboBoxModel::AddressComboBoxModel( - bool is_billing) - : is_billing_(is_billing) { -} - -void AutoFillProfilesView::AddressComboBoxModel::SetAddressLabels( - const std::vector<EditableSetInfo>& address_labels) { - address_labels_.clear(); - for (size_t i = 0; i < address_labels.size(); ++i) { - const EditableSetInfo& item = address_labels[i]; - DCHECK(item.is_address); - FieldTypeSet fields; - item.address.GetAvailableFieldTypes(&fields); - if (fields.find(ADDRESS_HOME_LINE1) == fields.end() && - fields.find(ADDRESS_HOME_LINE2) == fields.end() && - fields.find(ADDRESS_HOME_APT_NUM) == fields.end() && - fields.find(ADDRESS_HOME_CITY) == fields.end() && - fields.find(ADDRESS_HOME_STATE) == fields.end() && - fields.find(ADDRESS_HOME_ZIP) == fields.end() && - fields.find(ADDRESS_HOME_COUNTRY) == fields.end()) { - // No address information in this profile; it's useless as a billing - // address. - continue; - } - address_labels_.push_back(item); - } - NotifyChanged(); -} - -void AutoFillProfilesView::AddressComboBoxModel::UsedWithComboBox( - views::Combobox* combo_box) { - combo_boxes_.push_back(combo_box); -} - -void AutoFillProfilesView::AddressComboBoxModel::NotifyChanged() { - for (std::list<views::Combobox*>::iterator it = combo_boxes_.begin(); - it != combo_boxes_.end(); - ++it) - (*it)->ModelChanged(); -} - -int AutoFillProfilesView::AddressComboBoxModel::GetIndex(int unique_id) { - int shift = is_billing_ ? 0 : 1; - for (size_t i = 0; i < address_labels_.size(); ++i) { - if (address_labels_.at(i).address.unique_id() == unique_id) - return i + shift; - } - return -1; -} - -///////////////////////////////////////////////////////////////////////////// -// AutoFillProfilesView::AddressComboBoxModel, ComboboxModel methods -int AutoFillProfilesView::AddressComboBoxModel::GetItemCount() { - int shift = is_billing_ ? 0 : 1; - return static_cast<int>(address_labels_.size()) + shift; -} - -string16 AutoFillProfilesView::AddressComboBoxModel::GetItemAt(int index) { - int shift = is_billing_ ? 0 : 1; - DCHECK(index < (static_cast<int>(address_labels_.size()) + shift)); - if (!is_billing_ && !index) - return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SAME_AS_BILLING); - DCHECK(address_labels_.at(index - shift).is_address); - string16 label = - WideToUTF16Hack(address_labels_.at(index - shift).address.Label()); - if (label.empty()) - label = l10n_util::GetStringUTF16(IDS_AUTOFILL_NEW_ADDRESS); - return label; -} - void AutoFillProfilesView::StringVectorComboboxModel::set_cb_strings( std::vector<std::wstring> *source) { cb_strings_.swap(*source); diff --git a/chrome/browser/views/autofill_profiles_view_win.h b/chrome/browser/views/autofill_profiles_view_win.h index dc0f051..e1a6c25 100644 --- a/chrome/browser/views/autofill_profiles_view_win.h +++ b/chrome/browser/views/autofill_profiles_view_win.h @@ -92,10 +92,6 @@ class AutoFillProfilesView : public views::View, // Updates inferred labels. void UpdateProfileLabels(); - // Updates the billing model. This is invoked any time the profile_set_ - // changes. - void UpdateBillingModel(); - // Following two functions are called from opened child dialog to // disable/enable buttons. void ChildWindowOpened(); @@ -249,7 +245,6 @@ class AutoFillProfilesView : public views::View, }; // Forward declaration. - class AddressComboBoxModel; class StringVectorComboboxModel; // Sub-view for editing/adding a credit card or address. @@ -260,7 +255,6 @@ class AutoFillProfilesView : public views::View, public views::Combobox::Listener { public: EditableSetViewContents(AutoFillProfilesView* observer, - AddressComboBoxModel* billing_model, bool new_item, const EditableSetInfo& field_set); virtual ~EditableSetViewContents() {} @@ -339,8 +333,6 @@ class AutoFillProfilesView : public views::View, EditableSetInfo temporary_info_; bool has_credit_card_number_been_edited_; AutoFillProfilesView* observer_; - AddressComboBoxModel* billing_model_; - views::Combobox* combo_box_billing_; scoped_ptr<StringVectorComboboxModel> combo_box_model_month_; views::Combobox* combo_box_month_; scoped_ptr<StringVectorComboboxModel> combo_box_model_year_; @@ -368,43 +360,6 @@ class AutoFillProfilesView : public views::View, DISALLOW_COPY_AND_ASSIGN(EditableSetViewContents); }; - // Encapsulates ComboboxModel for address. - class AddressComboBoxModel : public ComboboxModel { - public: - explicit AddressComboBoxModel(bool is_billing); - virtual ~AddressComboBoxModel() {} - - // Updates address_labels_ from |address_labels|. - void SetAddressLabels(const std::vector<EditableSetInfo>& address_labels); - - // When you add a CB view that relies on this model, call this function - // so the CB can be notified if strings change. Can be called multiple - // times if several combo boxes relying on the model. - // Model does not own |combo_box|. - void UsedWithComboBox(views::Combobox *combo_box); - - // Need to be called when comboboxes are destroyed. - void ClearComboBoxes() { combo_boxes_.clear(); } - - // Call this function if one of the labels has changed - void NotifyChanged(); - - // Gets index of the item in the model or -1 if not found. - int GetIndex(int unique_id); - - // Overridden from ComboboxModel: - // Public as they are used from EditableSetViewContents. - virtual int GetItemCount(); - virtual string16 GetItemAt(int index); - - private: - std::list<views::Combobox*> combo_boxes_; - std::vector<EditableSetInfo> address_labels_; - bool is_billing_; - - DISALLOW_COPY_AND_ASSIGN(AddressComboBoxModel); - }; - class StringVectorComboboxModel : public ComboboxModel { public: StringVectorComboboxModel() {} @@ -468,8 +423,6 @@ class AutoFillProfilesView : public views::View, std::vector<EditableSetInfo> profiles_set_; std::vector<EditableSetInfo> credit_card_set_; - AddressComboBoxModel billing_model_; - BooleanPrefMember enable_auto_fill_; views::Checkbox* enable_auto_fill_button_; |