summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-09 22:49:29 +0000
committererikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-09 22:49:29 +0000
commitdbf46869b07c09eb74515ba2c8e9a727b0a09c65 (patch)
treeec846297229d2676596e537b3a26e22e6896a8bb
parent0118084bff852fa6d58bd0a55b8bb73915422968 (diff)
downloadchromium_src-dbf46869b07c09eb74515ba2c8e9a727b0a09c65.zip
chromium_src-dbf46869b07c09eb74515ba2c8e9a727b0a09c65.tar.gz
chromium_src-dbf46869b07c09eb74515ba2c8e9a727b0a09c65.tar.bz2
Revert 3 mac autofill CLs.
274040 is suspected of causing a renderer crash. The other 2 CLs depend on 274040. All three are being reverted. https://code.google.com/p/chromium/issues/detail?id=382144 Mac: Autofill should not immediately request access to address book. 27cd8ff93067dafdd8aa90eceb83625fb1c9e4fd Review URL: https://codereview.chromium.org/286243002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274040 Mac: Update layout of the autofill element to get contact permissions. 1f9532b4910b25577e34f30242294764552d8fe3 Review URL: https://codereview.chromium.org/296603002 svn://svn.chromium.org/chrome/trunk/src@274185 Mac: Clean up autofill integration with Address Book. 9fd5ae686798e2741145ef7b67ae59bd97a7217f Review URL: https://codereview.chromium.org/301343002 svn://svn.chromium.org/chrome/trunk/src@275367 TBR=isherman@chromium.org NOTREECHECKS=true NOTRY=true BUG=382144 Review URL: https://codereview.chromium.org/321823004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275867 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd4
-rw-r--r--chrome/browser/prefs/browser_prefs.cc4
-rw-r--r--chrome/browser/resources/options/autofill_options.html3
-rw-r--r--chrome/browser/resources/options/autofill_options.js13
-rw-r--r--chrome/browser/sync/test/integration/two_client_preferences_sync_test.cc6
-rw-r--r--chrome/browser/ui/autofill/autofill_popup_controller_impl.cc3
-rw-r--r--chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm149
-rw-r--r--chrome/browser/ui/webui/options/autofill_options_handler.cc12
-rw-r--r--chrome/browser/ui/webui/options/autofill_options_handler.h7
-rw-r--r--components/autofill.gypi1
-rw-r--r--components/autofill/content/browser/content_autofill_driver.cc10
-rw-r--r--components/autofill/content/browser/content_autofill_driver.h1
-rw-r--r--components/autofill/content/common/autofill_messages.h8
-rw-r--r--components/autofill/content/renderer/autofill_agent.cc5
-rw-r--r--components/autofill/content/renderer/autofill_agent.h1
-rw-r--r--components/autofill/core/browser/autofill_driver.h4
-rw-r--r--components/autofill/core/browser/autofill_external_delegate.cc101
-rw-r--r--components/autofill/core/browser/autofill_external_delegate.h8
-rw-r--r--components/autofill/core/browser/autofill_manager.cc67
-rw-r--r--components/autofill/core/browser/autofill_manager.h17
-rw-r--r--components/autofill/core/browser/autofill_manager_unittest.cc14
-rw-r--r--components/autofill/core/browser/autofill_test_utils.cc11
-rw-r--r--components/autofill/core/browser/personal_data_manager.cc8
-rw-r--r--components/autofill/core/browser/personal_data_manager.h12
-rw-r--r--components/autofill/core/browser/personal_data_manager_mac.mm90
-rw-r--r--components/autofill/core/browser/popup_item_ids.h3
-rw-r--r--components/autofill/core/browser/test_autofill_driver.cc2
-rw-r--r--components/autofill/core/browser/test_autofill_driver.h1
-rw-r--r--components/autofill/core/common/autofill_pref_names.cc21
-rw-r--r--components/autofill/core/common/autofill_pref_names.h3
-rw-r--r--components/autofill_strings.grdp7
-rw-r--r--components/resources/autofill_scaled_resources.grdp1
-rw-r--r--components/resources/default_100_percent/common/autofill/mac_contacts_icon.pngbin876 -> 0 bytes
-rw-r--r--components/resources/default_200_percent/common/autofill/mac_contacts_icon.pngbin2337 -> 0 bytes
-rw-r--r--tools/metrics/histograms/histograms.xml20
35 files changed, 80 insertions, 537 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 0b97e72..1e40831 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -9781,8 +9781,8 @@ Chrome ran out of memory.
Autofill settings
</message>
<if expr="is_macosx">
- <message name="IDS_AUTOFILL_USE_MAC_ADDRESS_BOOK" desc="Checkbox label to enable access to the user's Address Book on Mac. On Mac 10.8+ the application that manages the Address Book is called Contacts.">
- Include addresses from your Contacts card
+ <message name="IDS_AUTOFILL_USE_MAC_ADDRESS_BOOK" desc="Checkbox label to enable Address Book on Mac.">
+ Include addresses from your Address Book card
</message>
</if>
<message name="IDS_AUTOFILL_ADDRESSES_GROUP_NAME" desc="The name of the Addresses group of the Autofill dialog.">
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 9a241528..73928ad 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -520,10 +520,6 @@ void MigrateUserPrefs(Profile* profile) {
#if defined(ENABLE_MANAGED_USERS)
ManagedUserService::MigrateUserPrefs(prefs);
#endif
-
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- autofill::AutofillManager::MigrateUserPrefs(prefs);
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
}
void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) {
diff --git a/chrome/browser/resources/options/autofill_options.html b/chrome/browser/resources/options/autofill_options.html
index f24da00..27a869a 100644
--- a/chrome/browser/resources/options/autofill_options.html
+++ b/chrome/browser/resources/options/autofill_options.html
@@ -5,8 +5,7 @@
<if expr="is_macosx">
<div class="checkbox">
<label>
- <input pref="autofill.use_mac_address_book" type="checkbox"
- id="autofill-use-mac-address-book-checkbox"
+ <input pref="autofill.auxiliary_profiles_enabled" type="checkbox"
metric="Options_AutofillAuxiliaryProfiles">
<span i18n-content="auxiliaryProfilesEnabled"></span>
</label>
diff --git a/chrome/browser/resources/options/autofill_options.js b/chrome/browser/resources/options/autofill_options.js
index bc4c90c..65fb719 100644
--- a/chrome/browser/resources/options/autofill_options.js
+++ b/chrome/browser/resources/options/autofill_options.js
@@ -55,19 +55,6 @@ cr.define('options', function() {
$('autofill-options-confirm').onclick = function(event) {
OptionsPage.closeOverlay();
};
-<if expr="is_macosx">
- $('autofill-use-mac-address-book-checkbox').onchange = function(event) {
- if (this.checked) {
- setTimeout(function() {
- // Prompt the user to give Chrome access to the user's Address
- // Book, if the user was not previously prompted. The dialog that
- // appears blocks the Chrome process, so wait for a small period of
- // time to allow the checkbox to appear filled in.
- chrome.send('accessAddressBook');
- }, 10);
- }
- };
-</if>
// TODO(jhawkins): What happens when Autofill is disabled whilst on the
// Autofill options page?
diff --git a/chrome/browser/sync/test/integration/two_client_preferences_sync_test.cc b/chrome/browser/sync/test/integration/two_client_preferences_sync_test.cc
index a4bbeab..99b0528 100644
--- a/chrome/browser/sync/test/integration/two_client_preferences_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_preferences_sync_test.cc
@@ -390,14 +390,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
ChangeBooleanPref(0, autofill::prefs::kAutofillAuxiliaryProfilesEnabled);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
- // kAutofillAuxiliaryProfilesEnabled is only synced on Mac and Android.
-#if defined(OS_MACOSX) || defined(OS_ANDROID)
+ // kAutofillAuxiliaryProfilesEnabled is only synced on Mac.
+#if defined(OS_MACOSX)
ASSERT_TRUE(
BooleanPrefMatches(autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
#else
ASSERT_FALSE(
BooleanPrefMatches(autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
-#endif // defined(OS_MACOSX) || defined(OS_ANDROID)
+#endif // OS_MACOSX
}
// TCM ID - 3717298.
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
index c0cbd53..c8471d2 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -59,9 +59,6 @@ const DataResource kDataResources[] = {
{ "jcbCC", IDR_AUTOFILL_CC_JCB },
{ "masterCardCC", IDR_AUTOFILL_CC_MASTERCARD },
{ "visaCC", IDR_AUTOFILL_CC_VISA },
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- { "macContactsIcon", IDR_AUTOFILL_MAC_CONTACTS_ICON },
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
};
} // namespace
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm
index ab2a029..8807dcb 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm
@@ -28,40 +28,12 @@ using autofill::AutofillPopupView;
// Draws an Autofill suggestion in the given |bounds|, labeled with the given
// |name| and |subtext| hint. If the suggestion |isSelected|, then it is drawn
// with a highlight. |index| determines the font to use, as well as the icon,
-// if the row requires it -- such as for credit cards. |imageFirst| indicates
-// whether the image should be drawn before the name, and with the same
-// alignment, or whether it should be drawn afterwards, with the opposite
-// alignment.
+// if the row requires it -- such as for credit cards.
- (void)drawSuggestionWithName:(NSString*)name
subtext:(NSString*)subtext
index:(size_t)index
bounds:(NSRect)bounds
- selected:(BOOL)isSelected
- imageFirst:(BOOL)imageFirst
- textYOffset:(CGFloat)textYOffset;
-
-// This comment block applies to all three draw* methods that follow.
-// If |rightAlign| == YES.
-// Draws the widget with right border aligned to |x|.
-// Returns the x value of left border of the widget.
-// If |rightAlign| == NO.
-// Draws the widget with left border aligned to |x|.
-// Returns the x value of right border of the widget.
-- (CGFloat)drawName:(NSString*)name
- atX:(CGFloat)x
- index:(size_t)index
- rightAlign:(BOOL)rightAlign
- bounds:(NSRect)bounds
- textYOffset:(CGFloat)textYOffset;
-- (CGFloat)drawIconAtIndex:(size_t)index
- atX:(CGFloat)x
- rightAlign:(BOOL)rightAlign
- bounds:(NSRect)bounds;
-- (CGFloat)drawSubtext:(NSString*)subtext
- atX:(CGFloat)x
- rightAlign:(BOOL)rightAlign
- bounds:(NSRect)bounds
- textYOffset:(CGFloat)textYOffset;
+ selected:(BOOL)isSelected;
// Returns the icon for the row with the given |index|, or |nil| if there is
// none.
@@ -107,30 +79,16 @@ using autofill::AutofillPopupView;
if (controller_->identifiers()[i] == autofill::POPUP_ITEM_ID_SEPARATOR) {
[self drawSeparatorWithBounds:rowBounds];
- continue;
- }
-
- // Additional offset applied to the text in the vertical direction.
- CGFloat textYOffset = 0;
- BOOL imageFirst = NO;
- if (controller_->identifiers()[i] ==
- autofill::POPUP_ITEM_ID_MAC_ACCESS_CONTACTS) {
- // Due to the weighting of the asset used for this autofill entry, the
- // text needs to be bumped up by 1 pt to make it look vertically aligned.
- textYOffset = -1;
- imageFirst = YES;
+ } else {
+ NSString* name = SysUTF16ToNSString(controller_->names()[i]);
+ NSString* subtext = SysUTF16ToNSString(controller_->subtexts()[i]);
+ BOOL isSelected = static_cast<int>(i) == controller_->selected_line();
+ [self drawSuggestionWithName:name
+ subtext:subtext
+ index:i
+ bounds:rowBounds
+ selected:isSelected];
}
-
- NSString* name = SysUTF16ToNSString(controller_->names()[i]);
- NSString* subtext = SysUTF16ToNSString(controller_->subtexts()[i]);
- BOOL isSelected = static_cast<int>(i) == controller_->selected_line();
- [self drawSuggestionWithName:name
- subtext:subtext
- index:i
- bounds:rowBounds
- selected:isSelected
- imageFirst:imageFirst
- textYOffset:textYOffset];
}
}
@@ -157,9 +115,7 @@ using autofill::AutofillPopupView;
subtext:(NSString*)subtext
index:(size_t)index
bounds:(NSRect)bounds
- selected:(BOOL)isSelected
- imageFirst:(BOOL)imageFirst
- textYOffset:(CGFloat)textYOffset {
+ selected:(BOOL)isSelected {
// If this row is selected, highlight it.
if (isSelected) {
[[self highlightColor] set];
@@ -168,38 +124,6 @@ using autofill::AutofillPopupView;
BOOL isRTL = controller_->IsRTL();
- // The X values of the left and right borders of the autofill widget.
- CGFloat leftX = NSMinX(bounds) + AutofillPopupView::kEndPadding;
- CGFloat rightX = NSMaxX(bounds) - AutofillPopupView::kEndPadding;
-
- // Draw left side if isRTL == NO, right side if isRTL == YES.
- CGFloat x = isRTL ? rightX : leftX;
- if (imageFirst)
- x = [self drawIconAtIndex:index atX:x rightAlign:isRTL bounds:bounds];
- [self drawName:name
- atX:x
- index:index
- rightAlign:isRTL
- bounds:bounds
- textYOffset:textYOffset];
-
- // Draw right side if isRTL == NO, left side if isRTL == YES.
- x = isRTL ? leftX : rightX;
- if (!imageFirst)
- x = [self drawIconAtIndex:index atX:x rightAlign:!isRTL bounds:bounds];
- [self drawSubtext:subtext
- atX:x
- rightAlign:!isRTL
- bounds:bounds
- textYOffset:textYOffset];
-}
-
-- (CGFloat)drawName:(NSString*)name
- atX:(CGFloat)x
- index:(size_t)index
- rightAlign:(BOOL)rightAlign
- bounds:(NSRect)bounds
- textYOffset:(CGFloat)textYOffset {
NSColor* nameColor =
controller_->IsWarning(index) ? [self warningColor] : [self nameColor];
NSDictionary* nameAttributes =
@@ -209,26 +133,26 @@ using autofill::AutofillPopupView;
NSFontAttributeName, nameColor, NSForegroundColorAttributeName,
nil];
NSSize nameSize = [name sizeWithAttributes:nameAttributes];
- x -= rightAlign ? nameSize.width : 0;
+ CGFloat x = bounds.origin.x +
+ (isRTL ?
+ bounds.size.width - AutofillPopupView::kEndPadding - nameSize.width :
+ AutofillPopupView::kEndPadding);
CGFloat y = bounds.origin.y + (bounds.size.height - nameSize.height) / 2;
- y += textYOffset;
[name drawAtPoint:NSMakePoint(x, y) withAttributes:nameAttributes];
- x += rightAlign ? 0 : nameSize.width;
- return x;
-}
+ // The x-coordinate will be updated as each element is drawn.
+ x = bounds.origin.x +
+ (isRTL ?
+ AutofillPopupView::kEndPadding :
+ bounds.size.width - AutofillPopupView::kEndPadding);
-- (CGFloat)drawIconAtIndex:(size_t)index
- atX:(CGFloat)x
- rightAlign:(BOOL)rightAlign
- bounds:(NSRect)bounds {
+ // Draw the Autofill icon, if one exists.
NSImage* icon = [self iconAtIndex:index];
- if (!icon)
- return x;
- NSSize iconSize = [icon size];
- x -= rightAlign ? iconSize.width : 0;
- CGFloat y = bounds.origin.y + (bounds.size.height - iconSize.height) / 2;
+ if (icon) {
+ NSSize iconSize = [icon size];
+ x += isRTL ? 0 : -iconSize.width;
+ y = bounds.origin.y + (bounds.size.height - iconSize.height) / 2;
[icon drawInRect:NSMakeRect(x, y, iconSize.width, iconSize.height)
fromRect:NSZeroRect
operation:NSCompositeSourceOver
@@ -236,16 +160,12 @@ using autofill::AutofillPopupView;
respectFlipped:YES
hints:nil];
- x += rightAlign ? -AutofillPopupView::kIconPadding
- : iconSize.width + AutofillPopupView::kIconPadding;
- return x;
-}
+ x += isRTL ?
+ iconSize.width + AutofillPopupView::kIconPadding :
+ -AutofillPopupView::kIconPadding;
+ }
-- (CGFloat)drawSubtext:(NSString*)subtext
- atX:(CGFloat)x
- rightAlign:(BOOL)rightAlign
- bounds:(NSRect)bounds
- textYOffset:(CGFloat)textYOffset {
+ // Draw the subtext.
NSDictionary* subtextAttributes =
[NSDictionary dictionaryWithObjectsAndKeys:
controller_->subtext_font_list().GetPrimaryFont().GetNativeFont(),
@@ -254,13 +174,10 @@ using autofill::AutofillPopupView;
NSForegroundColorAttributeName,
nil];
NSSize subtextSize = [subtext sizeWithAttributes:subtextAttributes];
- x -= rightAlign ? subtextSize.width : 0;
- CGFloat y = bounds.origin.y + (bounds.size.height - subtextSize.height) / 2;
- y += textYOffset;
+ x += isRTL ? 0 : -subtextSize.width;
+ y = bounds.origin.y + (bounds.size.height - subtextSize.height) / 2;
[subtext drawAtPoint:NSMakePoint(x, y) withAttributes:subtextAttributes];
- x += rightAlign ? 0 : subtextSize.width;
- return x;
}
- (NSImage*)iconAtIndex:(size_t)index {
diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc
index 6b98cef..75087f6 100644
--- a/chrome/browser/ui/webui/options/autofill_options_handler.cc
+++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc
@@ -333,12 +333,6 @@ void AutofillOptionsHandler::RegisterMessages() {
personal_data_ = autofill::PersonalDataManagerFactory::GetForProfile(
Profile::FromWebUI(web_ui()));
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- web_ui()->RegisterMessageCallback(
- "accessAddressBook",
- base::Bind(&AutofillOptionsHandler::AccessAddressBook,
- base::Unretained(this)));
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
web_ui()->RegisterMessageCallback(
"removeData",
base::Bind(&AutofillOptionsHandler::RemoveData,
@@ -443,12 +437,6 @@ void AutofillOptionsHandler::LoadAutofillData() {
credit_cards);
}
-#if defined(OS_MACOSX) && !defined(OS_IOS)
-void AutofillOptionsHandler::AccessAddressBook(const base::ListValue* args) {
- personal_data_->AccessAddressBook();
-}
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
void AutofillOptionsHandler::RemoveData(const base::ListValue* args) {
DCHECK(IsPersonalDataLoaded());
diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.h b/chrome/browser/ui/webui/options/autofill_options_handler.h
index bd7a100..a98a986 100644
--- a/chrome/browser/ui/webui/options/autofill_options_handler.h
+++ b/chrome/browser/ui/webui/options/autofill_options_handler.h
@@ -46,13 +46,6 @@ class AutofillOptionsHandler : public OptionsPageUIHandler,
// Loads Autofill addresses and credit cards using the PersonalDataManager.
void LoadAutofillData();
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- // The user wants to grant Chrome access to the user's Address Book.
- // Immediately try to access the Address Book so that the blocking dialog is
- // shown in context, rather than at a later, surprising time.
- void AccessAddressBook(const base::ListValue* args);
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
// Removes data from the PersonalDataManager.
// |args| - A string, the GUID of the address or credit card to remove.
void RemoveData(const base::ListValue* args);
diff --git a/components/autofill.gypi b/components/autofill.gypi
index 777284f..180ef88 100644
--- a/components/autofill.gypi
+++ b/components/autofill.gypi
@@ -183,7 +183,6 @@
'autofill/core/browser/phone_number.h',
'autofill/core/browser/phone_number_i18n.cc',
'autofill/core/browser/phone_number_i18n.h',
- 'autofill/core/browser/popup_item_ids.h',
'autofill/core/browser/state_names.cc',
'autofill/core/browser/state_names.h',
'autofill/core/browser/validation.cc',
diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc
index 6707177..af74877 100644
--- a/components/autofill/content/browser/content_autofill_driver.cc
+++ b/components/autofill/content/browser/content_autofill_driver.cc
@@ -108,13 +108,6 @@ void ContentAutofillDriver::SendFormDataToRenderer(
}
}
-void ContentAutofillDriver::PingRenderer() {
- if (!RendererIsAvailable())
- return;
- content::RenderViewHost* host = web_contents()->GetRenderViewHost();
- host->Send(new AutofillMsg_Ping(host->GetRoutingID()));
-}
-
void ContentAutofillDriver::SendAutofillTypePredictionsToRenderer(
const std::vector<FormStructure*>& forms) {
if (!CommandLine::ForCurrentProcess()->HasSwitch(
@@ -188,9 +181,6 @@ bool ContentAutofillDriver::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_FORWARD(AutofillHostMsg_DidPreviewAutofillFormData,
autofill_manager_.get(),
AutofillManager::OnDidPreviewAutofillFormData)
- IPC_MESSAGE_FORWARD(AutofillHostMsg_PingAck,
- &autofill_external_delegate_,
- AutofillExternalDelegate::OnPingAck)
IPC_MESSAGE_FORWARD(AutofillHostMsg_DidFillAutofillFormData,
autofill_manager_.get(),
AutofillManager::OnDidFillAutofillFormData)
diff --git a/components/autofill/content/browser/content_autofill_driver.h b/components/autofill/content/browser/content_autofill_driver.h
index e0294f5..0bb6934 100644
--- a/components/autofill/content/browser/content_autofill_driver.h
+++ b/components/autofill/content/browser/content_autofill_driver.h
@@ -50,7 +50,6 @@ class ContentAutofillDriver : public AutofillDriver,
virtual void SendFormDataToRenderer(int query_id,
RendererFormDataAction action,
const FormData& data) OVERRIDE;
- virtual void PingRenderer() OVERRIDE;
virtual void SendAutofillTypePredictionsToRenderer(
const std::vector<FormStructure*>& forms) OVERRIDE;
virtual void RendererShouldAcceptDataListSuggestion(
diff --git a/components/autofill/content/common/autofill_messages.h b/components/autofill/content/common/autofill_messages.h
index f9a99fe..cb9fc6a 100644
--- a/components/autofill/content/common/autofill_messages.h
+++ b/components/autofill/content/common/autofill_messages.h
@@ -94,11 +94,6 @@ IPC_ENUM_TRAITS_MAX_VALUE(
// Autofill messages sent from the browser to the renderer.
-// Instructs the renderer to immediately return an IPC acknowledging the ping.
-// This is used to correctly sequence events, since IPCs are guaranteed to be
-// processed in order.
-IPC_MESSAGE_ROUTED0(AutofillMsg_Ping)
-
// Instructs the renderer to fill the active form with the given form data.
IPC_MESSAGE_ROUTED2(AutofillMsg_FillForm,
int /* query_id */,
@@ -232,9 +227,6 @@ IPC_MESSAGE_ROUTED5(AutofillHostMsg_QueryFormFieldAutofill,
// Sent when a form is previewed with Autofill suggestions.
IPC_MESSAGE_ROUTED0(AutofillHostMsg_DidPreviewAutofillFormData)
-// Sent immediately after the renderer receives a ping IPC.
-IPC_MESSAGE_ROUTED0(AutofillHostMsg_PingAck)
-
// Sent when a form is filled with Autofill suggestions.
IPC_MESSAGE_ROUTED1(AutofillHostMsg_DidFillAutofillFormData,
base::TimeTicks /* timestamp */)
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index 525bc3f..6d48fb5 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -150,7 +150,6 @@ AutofillAgent::~AutofillAgent() {}
bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message)
- IPC_MESSAGE_HANDLER(AutofillMsg_Ping, OnPing)
IPC_MESSAGE_HANDLER(AutofillMsg_FillForm, OnFillForm)
IPC_MESSAGE_HANDLER(AutofillMsg_PreviewForm, OnPreviewForm)
IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable,
@@ -456,10 +455,6 @@ void AutofillAgent::OnFillForm(int query_id, const FormData& form) {
base::TimeTicks::Now()));
}
-void AutofillAgent::OnPing() {
- Send(new AutofillHostMsg_PingAck(routing_id()));
-}
-
void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) {
if (!render_view()->GetWebView() || query_id != autofill_query_id_)
return;
diff --git a/components/autofill/content/renderer/autofill_agent.h b/components/autofill/content/renderer/autofill_agent.h
index dafcd70..54a7c46 100644
--- a/components/autofill/content/renderer/autofill_agent.h
+++ b/components/autofill/content/renderer/autofill_agent.h
@@ -97,7 +97,6 @@ class AutofillAgent : public content::RenderViewObserver,
void OnFieldTypePredictionsAvailable(
const std::vector<FormDataPredictions>& forms);
void OnFillForm(int query_id, const FormData& form);
- void OnPing();
void OnPreviewForm(int query_id, const FormData& form);
// For external Autofill selection.
diff --git a/components/autofill/core/browser/autofill_driver.h b/components/autofill/core/browser/autofill_driver.h
index 748ad6e..efc5696 100644
--- a/components/autofill/core/browser/autofill_driver.h
+++ b/components/autofill/core/browser/autofill_driver.h
@@ -58,9 +58,6 @@ class AutofillDriver {
RendererFormDataAction action,
const FormData& data) = 0;
- // Pings renderer. The renderer will return an IPC acknowledging the ping.
- virtual void PingRenderer() = 0;
-
// Sends the field type predictions specified in |forms| to the renderer. This
// method is a no-op if the renderer is not available or the appropriate
// command-line flag is not set.
@@ -84,6 +81,7 @@ class AutofillDriver {
// Tells the renderer to preview the node with suggested text.
virtual void RendererShouldPreviewFieldWithValue(
const base::string16& value) = 0;
+
};
} // namespace autofill
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc
index 57777c8..bd66234 100644
--- a/components/autofill/core/browser/autofill_external_delegate.cc
+++ b/components/autofill/core/browser/autofill_external_delegate.cc
@@ -4,8 +4,6 @@
#include "components/autofill/core/browser/autofill_external_delegate.h"
-#include "base/message_loop/message_loop.h"
-#include "base/metrics/histogram.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autocomplete_history_manager.h"
#include "components/autofill/core/browser/autofill_driver.h"
@@ -14,35 +12,11 @@
#include "grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
-#if defined(OS_MACOSX) && !defined(OS_IOS)
-namespace {
-
-enum AccessAddressBookEventType {
- // An Autofill entry was shown that prompts the user to give Chrome access to
- // the user's Address Book.
- SHOWED_ACCESS_ADDRESS_BOOK_ENTRY = 0,
-
- // The user selected the Autofill entry which prompts Chrome to access the
- // user's Address Book.
- SELECTED_ACCESS_ADDRESS_BOOK_ENTRY = 1,
-
- // Always keep this at the end.
- ACCESS_ADDRESS_BOOK_ENTRY_MAX,
-};
-
-// Emits an entry for the histogram.
-void EmitHistogram(AccessAddressBookEventType type) {
- UMA_HISTOGRAM_ENUMERATION(
- "Autofill.MacAddressBook", type, ACCESS_ADDRESS_BOOK_ENTRY_MAX);
-}
-
-} // namespace
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
namespace autofill {
-AutofillExternalDelegate::AutofillExternalDelegate(AutofillManager* manager,
- AutofillDriver* driver)
+AutofillExternalDelegate::AutofillExternalDelegate(
+ AutofillManager* manager,
+ AutofillDriver* driver)
: manager_(manager),
driver_(driver),
query_id_(0),
@@ -117,20 +91,6 @@ void AutofillExternalDelegate::OnSuggestionsReturned(
// updated to match.
InsertDataListValues(&values, &labels, &icons, &ids);
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- if (values.empty() &&
- manager_->ShouldShowAccessAddressBookSuggestion(query_form_,
- query_field_)) {
- values.push_back(
- l10n_util::GetStringUTF16(IDS_AUTOFILL_ACCESS_MAC_CONTACTS));
- labels.push_back(base::string16());
- icons.push_back(base::ASCIIToUTF16("macContactsIcon"));
- ids.push_back(POPUP_ITEM_ID_MAC_ACCESS_CONTACTS);
-
- EmitHistogram(SHOWED_ACCESS_ADDRESS_BOOK_ENTRY);
- }
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
if (values.empty()) {
// No suggestions, any popup currently showing is obsolete.
manager_->client()->HideAutofillPopup();
@@ -195,40 +155,6 @@ void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value,
} else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) {
// User selected an Autocomplete, so we fill directly.
driver_->RendererShouldFillFieldWithValue(value);
- } else if (identifier == POPUP_ITEM_ID_MAC_ACCESS_CONTACTS) {
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- EmitHistogram(SELECTED_ACCESS_ADDRESS_BOOK_ENTRY);
-
- // User wants to give Chrome access to user's address book.
- manager_->AccessAddressBook();
-
- // There is no deterministic method for deciding whether a blocking dialog
- // was presented. The following comments and code assume that a blocking
- // dialog was presented, but still behave correctly if no dialog was
- // presented.
-
- // A blocking dialog was presented, and the user has already responded to
- // the dialog. The presentation of the dialog added an NSEvent to the
- // NSRunLoop which will cause all windows to lose focus. When the NSEvent
- // is processed, it will be sent to the renderer which will cause the text
- // field to lose focus. This returns an IPC to Chrome which will dismiss
- // the Autofill popup. We post a task which we expect to run after the
- // NSEvent has been processed by the NSRunLoop. It pings the renderer,
- // which returns an IPC acknowledging the ping. At that time, redisplay
- // the popup. FIFO processing of IPCs ensures that all side effects of the
- // NSEvent will have been processed.
-
- // 10ms sits nicely under the 16ms threshold for 60 fps, and likely gives
- // the NSApplication run loop sufficient time to process the NSEvent. In
- // testing, a delay of 0ms was always sufficient.
- base::TimeDelta delay(base::TimeDelta::FromMilliseconds(10));
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&AutofillExternalDelegate::PingRenderer, GetWeakPtr()),
- delay);
-#else
- NOTREACHED();
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
} else {
FillAutofillFormData(identifier, false);
}
@@ -258,15 +184,6 @@ void AutofillExternalDelegate::Reset() {
manager_->client()->HideAutofillPopup();
}
-void AutofillExternalDelegate::OnPingAck() {
- // Reissue the most recent query, which will reopen the Autofill popup.
- manager_->OnQueryFormFieldAutofill(query_id_,
- query_form_,
- query_field_,
- element_bounds_,
- display_warning_if_disabled_);
-}
-
base::WeakPtr<AutofillExternalDelegate> AutofillExternalDelegate::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
@@ -300,7 +217,7 @@ void AutofillExternalDelegate::ApplyAutofillWarnings(
// suggestions to show, show a warning instead. Otherwise, clear out the
// list of suggestions.
if (!unique_ids->empty() && (*unique_ids)[0] > 0) {
- // If Autofill is disabled and we had suggestions, show a warning instead.
+ // If autofill is disabled and we had suggestions, show a warning instead.
values->assign(
1, l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED));
labels->assign(1, base::string16());
@@ -314,8 +231,8 @@ void AutofillExternalDelegate::ApplyAutofillWarnings(
}
} else if (unique_ids->size() > 1 &&
(*unique_ids)[0] == POPUP_ITEM_ID_WARNING_MESSAGE) {
- // If we received a warning instead of suggestions from Autofill but regular
- // suggestions from autocomplete, don't show the Autofill warning.
+ // If we received a warning instead of suggestions from autofill but regular
+ // suggestions from autocomplete, don't show the autofill warning.
values->erase(values->begin());
labels->erase(labels->begin());
icons->erase(icons->begin());
@@ -389,10 +306,4 @@ void AutofillExternalDelegate::InsertDataListValues(
POPUP_ITEM_ID_DATALIST_ENTRY);
}
-#if defined(OS_MACOSX) && !defined(OS_IOS)
-void AutofillExternalDelegate::PingRenderer() {
- driver_->PingRenderer();
-}
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
} // namespace autofill
diff --git a/components/autofill/core/browser/autofill_external_delegate.h b/components/autofill/core/browser/autofill_external_delegate.h
index b1e4111..672b2d6 100644
--- a/components/autofill/core/browser/autofill_external_delegate.h
+++ b/components/autofill/core/browser/autofill_external_delegate.h
@@ -80,9 +80,6 @@ class AutofillExternalDelegate
// values or settings.
void Reset();
- // The renderer sent an IPC acknowledging an earlier ping IPC.
- void OnPingAck();
-
protected:
base::WeakPtr<AutofillExternalDelegate> GetWeakPtr();
@@ -114,11 +111,6 @@ class AutofillExternalDelegate
std::vector<base::string16>* icons,
std::vector<int>* unique_ids);
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- // Pings the renderer.
- void PingRenderer();
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
AutofillManager* manager_; // weak.
// Provides driver-level context to the shared code of the component. Must
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 370a8f0..50ed127 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -212,7 +212,7 @@ void AutofillManager::RegisterProfilePrefs(
#endif // defined(OS_MACOSX) || defined(OS_ANDROID)
#if defined(OS_MACOSX)
registry->RegisterBooleanPref(
- prefs::kAutofillMacAddressBookQueried,
+ prefs::kAutofillAuxiliaryProfilesQueried,
false,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
#endif // defined(OS_MACOSX)
@@ -224,50 +224,7 @@ void AutofillManager::RegisterProfilePrefs(
prefs::kAutofillNegativeUploadRate,
kAutofillNegativeUploadRateDefaultValue,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
-
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- registry->RegisterBooleanPref(
- prefs::kAutofillUseMacAddressBook,
- false,
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-}
-
-#if defined(OS_MACOSX) && !defined(OS_IOS)
-void AutofillManager::MigrateUserPrefs(PrefService* prefs) {
- const PrefService::Preference* pref =
- prefs->FindPreference(prefs::kAutofillUseMacAddressBook);
-
- // If the pref is not its default value, then the migration has already been
- // performed.
- if (!pref->IsDefaultValue())
- return;
-
- // Whether Chrome has already tried to access the user's Address Book.
- const PrefService::Preference* pref_accessed =
- prefs->FindPreference(prefs::kAutofillMacAddressBookQueried);
- // Whether the user wants to use the Address Book to populate Autofill.
- const PrefService::Preference* pref_enabled =
- prefs->FindPreference(prefs::kAutofillAuxiliaryProfilesEnabled);
-
- if (pref_accessed->IsDefaultValue() && pref_enabled->IsDefaultValue()) {
- // This is likely a new user. Reset the default value to prevent the
- // migration from happening again.
- prefs->SetBoolean(prefs::kAutofillUseMacAddressBook,
- prefs->GetBoolean(prefs::kAutofillUseMacAddressBook));
- return;
- }
-
- bool accessed;
- bool enabled;
- bool success = pref_accessed->GetValue()->GetAsBoolean(&accessed);
- DCHECK(success);
- success = pref_enabled->GetValue()->GetAsBoolean(&enabled);
- DCHECK(success);
-
- prefs->SetBoolean(prefs::kAutofillUseMacAddressBook, accessed && enabled);
}
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) {
// TODO(jrg): consider passing delegate into the ctor. That won't
@@ -281,28 +238,6 @@ void AutofillManager::ShowAutofillSettings() {
client_->ShowAutofillSettings();
}
-#if defined(OS_MACOSX) && !defined(OS_IOS)
-bool AutofillManager::ShouldShowAccessAddressBookSuggestion(
- const FormData& form,
- const FormFieldData& field) {
- if (!personal_data_)
- return false;
- FormStructure* form_structure = NULL;
- AutofillField* autofill_field = NULL;
- if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field))
- return false;
-
- return personal_data_->ShouldShowAccessAddressBookSuggestion(
- autofill_field->Type());
-}
-
-bool AutofillManager::AccessAddressBook() {
- if (!personal_data_)
- return false;
- return personal_data_->AccessAddressBook();
-}
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
bool AutofillManager::OnFormSubmitted(const FormData& form,
const TimeTicks& timestamp) {
if (!IsValidFormData(form))
diff --git a/components/autofill/core/browser/autofill_manager.h b/components/autofill/core/browser/autofill_manager.h
index 120b14d..b179606 100644
--- a/components/autofill/core/browser/autofill_manager.h
+++ b/components/autofill/core/browser/autofill_manager.h
@@ -73,10 +73,6 @@ class AutofillManager : public AutofillDownloadManager::Observer {
// Registers our Enable/Disable Autofill pref.
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- static void MigrateUserPrefs(PrefService* prefs);
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
AutofillManager(AutofillDriver* driver,
AutofillClient* client,
const std::string& app_locale,
@@ -88,19 +84,6 @@ class AutofillManager : public AutofillDownloadManager::Observer {
void ShowAutofillSettings();
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- // Whether the field represented by |fieldData| should show an entry to prompt
- // the user to give Chrome access to the user's address book.
- bool ShouldShowAccessAddressBookSuggestion(const FormData& data,
- const FormFieldData& field_data);
-
- // If Chrome has not prompted for access to the user's address book, the
- // method prompts the user for permission and blocks the process. Otherwise,
- // this method has no effect. The return value reflects whether the user was
- // prompted with a modal dialog.
- bool AccessAddressBook();
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
// Called from our external delegate so they cannot be private.
virtual void FillOrPreviewForm(AutofillDriver::RendererFormDataAction action,
int query_id,
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc
index a8d3573..731e58a 100644
--- a/components/autofill/core/browser/autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -1551,14 +1551,8 @@ TEST_F(AutofillManagerTest, FillAddressForm) {
// Test that we correctly fill an address form from an auxiliary profile.
TEST_F(AutofillManagerTest, FillAddressFormFromAuxiliaryProfile) {
personal_data_.ClearAutofillProfiles();
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- autofill_client_.GetPrefs()->SetBoolean(
- ::autofill::prefs::kAutofillUseMacAddressBook, true);
-#else
autofill_client_.GetPrefs()->SetBoolean(
::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true);
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
personal_data_.CreateTestAuxiliaryProfiles();
// Set up our form data.
@@ -2480,12 +2474,12 @@ TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) {
PrefService* prefs = autofill_client_.GetPrefs();
#if defined(OS_MACOSX) || defined(OS_ANDROID)
// Auxiliary profiles is implemented on Mac and Android only.
- // OSX: This preference exists for legacy reasons. It is no longer used.
+ // OSX: enables Mac Address Book integration.
// Android: enables integration with user's contact profile.
ASSERT_TRUE(
prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
- prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled,
- false);
+ prefs->SetBoolean(
+ ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, false);
prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled);
ASSERT_TRUE(
prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
@@ -2496,7 +2490,7 @@ TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) {
prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled);
ASSERT_FALSE(
prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
-#endif // defined(OS_MACOSX) || defined(OS_ANDROID)
+#endif
}
TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUpload) {
diff --git a/components/autofill/core/browser/autofill_test_utils.cc b/components/autofill/core/browser/autofill_test_utils.cc
index 0393d86..081defa 100644
--- a/components/autofill/core/browser/autofill_test_utils.cc
+++ b/components/autofill/core/browser/autofill_test_utils.cc
@@ -206,17 +206,12 @@ void DisableSystemServices(PrefService* prefs) {
// Use a mock Keychain rather than the OS one to store credit card data.
#if defined(OS_MACOSX)
OSCrypt::UseMockKeychain(true);
-#endif // defined(OS_MACOSX)
+#endif
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- // Don't use the Address Book on Mac, as it reaches out to system services.
- if (prefs)
- prefs->SetBoolean(prefs::kAutofillUseMacAddressBook, false);
-#else
- // Disable auxiliary profiles for unit testing by default.
+ // Disable auxiliary profiles for unit testing. These reach out to system
+ // services on the Mac.
if (prefs)
prefs->SetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled, false);
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
}
} // namespace test
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index 5454b1c..1d4173e 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -525,13 +525,9 @@ bool PersonalDataManager::IsDataLoaded() const {
}
const std::vector<AutofillProfile*>& PersonalDataManager::GetProfiles() const {
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- if (!pref_service_->GetBoolean(prefs::kAutofillUseMacAddressBook))
+ if (!pref_service_->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled)) {
return web_profiles();
-#else
- if (!pref_service_->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled))
- return web_profiles();
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
+ }
profiles_.clear();
diff --git a/components/autofill/core/browser/personal_data_manager.h b/components/autofill/core/browser/personal_data_manager.h
index e82e1a7..9ddc98e 100644
--- a/components/autofill/core/browser/personal_data_manager.h
+++ b/components/autofill/core/browser/personal_data_manager.h
@@ -200,18 +200,6 @@ class PersonalDataManager : public KeyedService,
// will only update when Chrome is restarted.
virtual const std::string& GetDefaultCountryCodeForNewAddress() const;
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- // If Chrome has not prompted for access to the user's address book, the
- // method prompts the user for permission and blocks the process. Otherwise,
- // this method has no effect. The return value reflects whether the user was
- // prompted with a modal dialog.
- bool AccessAddressBook();
-
- // Whether an autofill suggestion should be displayed to prompt the user to
- // grant Chrome access to the user's address book.
- bool ShouldShowAccessAddressBookSuggestion(AutofillType type);
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
protected:
// Only PersonalDataManagerFactory and certain tests can create instances of
// PersonalDataManager.
diff --git a/components/autofill/core/browser/personal_data_manager_mac.mm b/components/autofill/core/browser/personal_data_manager_mac.mm
index 2be22fc..8cae978 100644
--- a/components/autofill/core/browser/personal_data_manager_mac.mm
+++ b/components/autofill/core/browser/personal_data_manager_mac.mm
@@ -21,10 +21,8 @@
#include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/autofill_type.h"
-#include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/browser/phone_number.h"
#include "components/autofill/core/common/autofill_pref_names.h"
-#include "components/autofill/core/common/form_data.h"
#include "grit/components_strings.h"
#include "ui/base/l10n/l10n_util_mac.h"
@@ -33,39 +31,6 @@ namespace {
const char kAddressBookOrigin[] = "OS X Address Book";
-// Whether Chrome has prompted the user for permission to access the user's
-// address book.
-bool HasPromptedForAccessToAddressBook(PrefService* pref_service) {
- return pref_service->GetBoolean(prefs::kAutofillMacAddressBookQueried);
-}
-
-// Whether the user wants Chrome to use the AddressBook to populate Autofill
-// entries.
-bool ShouldUseAddressBook(PrefService* pref_service) {
- return pref_service->GetBoolean(prefs::kAutofillUseMacAddressBook);
-}
-
-ABAddressBook* GetAddressBook(PrefService* pref_service) {
- bool first_access = !HasPromptedForAccessToAddressBook(pref_service);
-
- // +[ABAddressBook sharedAddressBook] throws an exception internally in
- // circumstances that aren't clear. The exceptions are only observed in crash
- // reports, so it is unknown whether they would be caught by AppKit and nil
- // returned, or if they would take down the app. In either case, avoid
- // crashing. http://crbug.com/129022
- ABAddressBook* addressBook = base::mac::RunBlockIgnoringExceptions(
- ^{ return [ABAddressBook sharedAddressBook]; });
- UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBookAvailable", addressBook != nil);
-
- if (first_access) {
- UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBookAvailableOnFirstAttempt",
- addressBook != nil);
- }
-
- pref_service->SetBoolean(prefs::kAutofillMacAddressBookQueried, true);
- return addressBook;
-}
-
// This implementation makes use of the Address Book API. Profiles are
// generated that correspond to addresses in the "me" card that reside in the
// user's Address Book. The caller passes a vector of profiles into the
@@ -116,12 +81,20 @@ void AuxiliaryProfilesImpl::GetAddressBookMeCard(const std::string& app_locale,
PrefService* pref_service) {
profiles_.clear();
- // The user does not want Chrome to use the AddressBook to populate Autofill
- // entries.
- if (!ShouldUseAddressBook(pref_service))
- return;
-
- ABAddressBook* addressBook = GetAddressBook(pref_service);
+ // +[ABAddressBook sharedAddressBook] throws an exception internally in
+ // circumstances that aren't clear. The exceptions are only observed in crash
+ // reports, so it is unknown whether they would be caught by AppKit and nil
+ // returned, or if they would take down the app. In either case, avoid
+ // crashing. http://crbug.com/129022
+ ABAddressBook* addressBook = base::mac::RunBlockIgnoringExceptions(^{
+ return [ABAddressBook sharedAddressBook];
+ });
+ UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBookAvailable", addressBook != nil);
+ if (!pref_service->GetBoolean(prefs::kAutofillAuxiliaryProfilesQueried)) {
+ pref_service->SetBoolean(prefs::kAutofillAuxiliaryProfilesQueried, true);
+ UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBookAvailableOnFirstAttempt",
+ addressBook != nil);
+ }
ABPerson* me = [addressBook me];
if (!me)
@@ -308,39 +281,4 @@ void PersonalDataManager::LoadAuxiliaryProfiles() const {
impl.GetAddressBookMeCard(app_locale_, pref_service_);
}
-bool PersonalDataManager::AccessAddressBook() {
- // The user is attempting to give Chrome access to the user's Address Book.
- // This implicitly acknowledges that the user wants to use auxiliary
- // profiles.
- pref_service_->SetBoolean(prefs::kAutofillUseMacAddressBook, true);
-
- // Request permissions.
- GetAddressBook(pref_service_);
- return true;
-}
-
-bool PersonalDataManager::ShouldShowAccessAddressBookSuggestion(
- AutofillType type) {
- if (HasPromptedForAccessToAddressBook(pref_service_))
- return false;
-
- switch (type.group()) {
- case ADDRESS_BILLING:
- case ADDRESS_HOME:
- case EMAIL:
- case NAME:
- case NAME_BILLING:
- case PHONE_BILLING:
- case PHONE_HOME:
- return true;
- case NO_GROUP:
- case COMPANY:
- case CREDIT_CARD:
- case PASSWORD_FIELD:
- return false;
- }
-
- return false;
-}
-
} // namespace autofill
diff --git a/components/autofill/core/browser/popup_item_ids.h b/components/autofill/core/browser/popup_item_ids.h
index 7a8e843..628e000 100644
--- a/components/autofill/core/browser/popup_item_ids.h
+++ b/components/autofill/core/browser/popup_item_ids.h
@@ -16,8 +16,7 @@ enum PopupItemId {
POPUP_ITEM_ID_SEPARATOR = -3,
POPUP_ITEM_ID_CLEAR_FORM = -4,
POPUP_ITEM_ID_AUTOFILL_OPTIONS = -5,
- POPUP_ITEM_ID_DATALIST_ENTRY = -6,
- POPUP_ITEM_ID_MAC_ACCESS_CONTACTS = -7,
+ POPUP_ITEM_ID_DATALIST_ENTRY = -6
};
} // namespace autofill
diff --git a/components/autofill/core/browser/test_autofill_driver.cc b/components/autofill/core/browser/test_autofill_driver.cc
index f67c1b1..ad796c0 100644
--- a/components/autofill/core/browser/test_autofill_driver.cc
+++ b/components/autofill/core/browser/test_autofill_driver.cc
@@ -39,8 +39,6 @@ void TestAutofillDriver::SendFormDataToRenderer(int query_id,
const FormData& form_data) {
}
-void TestAutofillDriver::PingRenderer() {}
-
void TestAutofillDriver::SendAutofillTypePredictionsToRenderer(
const std::vector<FormStructure*>& forms) {
}
diff --git a/components/autofill/core/browser/test_autofill_driver.h b/components/autofill/core/browser/test_autofill_driver.h
index 34a8552..e515ca7 100644
--- a/components/autofill/core/browser/test_autofill_driver.h
+++ b/components/autofill/core/browser/test_autofill_driver.h
@@ -32,7 +32,6 @@ class TestAutofillDriver : public AutofillDriver {
virtual void SendFormDataToRenderer(int query_id,
RendererFormDataAction action,
const FormData& data) OVERRIDE;
- virtual void PingRenderer() OVERRIDE;
virtual void SendAutofillTypePredictionsToRenderer(
const std::vector<FormStructure*>& forms) OVERRIDE;
virtual void RendererShouldAcceptDataListSuggestion(
diff --git a/components/autofill/core/common/autofill_pref_names.cc b/components/autofill/core/common/autofill_pref_names.cc
index f35cb77..d7385bb3 100644
--- a/components/autofill/core/common/autofill_pref_names.cc
+++ b/components/autofill/core/common/autofill_pref_names.cc
@@ -7,30 +7,25 @@
namespace autofill {
namespace prefs {
-// Boolean that is true when auxiliary Autofill profiles are enabled. This pref
-// is only relevant to Android.
+// Boolean that is true when auxiliary Autofill profiles are enabled.
+// Currently applies to Address Book "me" card on Mac. False on Win and Linux.
const char kAutofillAuxiliaryProfilesEnabled[] =
"autofill.auxiliary_profiles_enabled";
+// Boolean that is true when at least one read request for auxiliary Autofill
+// profiles has been issued. Currently applies only to auxiliary profiles on
+// Mac.
+const char kAutofillAuxiliaryProfilesQueried[] =
+ "autofill.auxiliary_profiles_queried";
+
// Boolean that is true if Autofill is enabled and allowed to save profile data.
const char kAutofillEnabled[] = "autofill.enabled";
-// Boolean that is true when Chrome has attempted to access the user's Address
-// Book on Mac. This preference is important since the first time Chrome
-// attempts to access the user's Address Book, Cocoa presents a blocking dialog
-// to the user.
-const char kAutofillMacAddressBookQueried[] =
- "autofill.auxiliary_profiles_queried";
-
// Double that indicates negative (for not matched forms) upload rate.
const char kAutofillNegativeUploadRate[] = "autofill.negative_upload_rate";
// Double that indicates positive (for matched forms) upload rate.
const char kAutofillPositiveUploadRate[] = "autofill.positive_upload_rate";
-// Whether Autofill should try to use the Mac Address Book. If this value is
-// true, then kAutofillMacAddressBookQueried is expected to also be true.
-const char kAutofillUseMacAddressBook[] = "autofill.use_mac_address_book";
-
} // namespace prefs
} // namespace autofill
diff --git a/components/autofill/core/common/autofill_pref_names.h b/components/autofill/core/common/autofill_pref_names.h
index fb580a6..50af375f 100644
--- a/components/autofill/core/common/autofill_pref_names.h
+++ b/components/autofill/core/common/autofill_pref_names.h
@@ -11,11 +11,10 @@ namespace prefs {
// Alphabetical list of preference names specific to the Autofill
// component. Keep alphabetized, and document each in the .cc file.
extern const char kAutofillAuxiliaryProfilesEnabled[];
+extern const char kAutofillAuxiliaryProfilesQueried[];
extern const char kAutofillEnabled[];
-extern const char kAutofillMacAddressBookQueried[];
extern const char kAutofillNegativeUploadRate[];
extern const char kAutofillPositiveUploadRate[];
-extern const char kAutofillUseMacAddressBook[];
} // namespace prefs
} // namespace autofill
diff --git a/components/autofill_strings.grdp b/components/autofill_strings.grdp
index 9e1db3f..f8e5332 100644
--- a/components/autofill_strings.grdp
+++ b/components/autofill_strings.grdp
@@ -110,11 +110,4 @@
This type of card is not supported by Google Wallet for this merchant. Please select a different card.
</message>
- <!-- Autofill on OSX -->
- <if expr="is_macosx">
- <message name="IDS_AUTOFILL_ACCESS_MAC_CONTACTS" desc="When the user selects this Autofill entry, the browser prompts the user for access to the user's OSX contacts.">
- Enable Autofill using Contacts…
- </message>
- </if>
-
</grit-part>
diff --git a/components/resources/autofill_scaled_resources.grdp b/components/resources/autofill_scaled_resources.grdp
index e4df87e..2bbc3f5 100644
--- a/components/resources/autofill_scaled_resources.grdp
+++ b/components/resources/autofill_scaled_resources.grdp
@@ -7,5 +7,4 @@
<structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_JCB" file="common/autofill/jcb.png" />
<structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_MASTERCARD" file="common/autofill/mastercard.png" />
<structure type="chrome_scaled_image" name="IDR_AUTOFILL_CC_VISA" file="common/autofill/visa.png" />
- <structure type="chrome_scaled_image" name="IDR_AUTOFILL_MAC_CONTACTS_ICON" file="common/autofill/mac_contacts_icon.png" />
</grit-part>
diff --git a/components/resources/default_100_percent/common/autofill/mac_contacts_icon.png b/components/resources/default_100_percent/common/autofill/mac_contacts_icon.png
deleted file mode 100644
index 2923c4a..0000000
--- a/components/resources/default_100_percent/common/autofill/mac_contacts_icon.png
+++ /dev/null
Binary files differ
diff --git a/components/resources/default_200_percent/common/autofill/mac_contacts_icon.png b/components/resources/default_200_percent/common/autofill/mac_contacts_icon.png
deleted file mode 100644
index f005952..0000000
--- a/components/resources/default_200_percent/common/autofill/mac_contacts_icon.png
+++ /dev/null
Binary files differ
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 100c34e..4018f9a 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -1610,21 +1610,6 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<summary>Tracks whether Autofill is enabled when Chrome launches.</summary>
</histogram>
-<histogram name="Autofill.MacAddressBook" enum="AutofillMacAddressBook">
- <owner>erikchen@chromium.org</owner>
- <summary>
- When Chrome tries to access the user's Address Book, OSX presents a blocking
- dialog which disrupts the user experience. A new Chrome feature has been
- introduced wherein Chrome only shows this blocking dialog if the user
- explicitly asked Chrome to access the user's Address Book. If a form's field
- looks like it might support Autofill suggestions from the user's Address
- Book and there are no other suggestions, Chrome shows an Autofill entry that
- prompts the user to give Chrome access to the user's Address Book. This
- histogram tracks the frequency that this Autofill entry is presented, and
- the frequency that this Autofill entry is selected.
- </summary>
-</histogram>
-
<histogram name="AutoFill.ProfileCount">
<obsolete>
Deprecated as of 3/2011, replaced by Autofill.StoredProfileCount.
@@ -32990,11 +32975,6 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="17" label="fp05cc03e1"/>
</enum>
-<enum name="AutofillMacAddressBook" type="int">
- <int value="0" label="Showed popup entry"/>
- <int value="1" label="Selected popup entry"/>
-</enum>
-
<enum name="AutofillQuality" type="int">
<int value="0" label="Submitted"/>
<int value="1" label="Autofilled"/>