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

Side by Side Diff: components/autofill/core/browser/autofill_external_delegate.cc

Issue 301343002: mac: Clean up autofill integration with Address Book. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill_cleanup2_base
Patch Set: test Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/autofill_external_delegate.h" 5 #include "components/autofill/core/browser/autofill_external_delegate.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/metrics/user_metrics.h"
8 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
9 #include "components/autofill/core/browser/autocomplete_history_manager.h" 10 #include "components/autofill/core/browser/autocomplete_history_manager.h"
10 #include "components/autofill/core/browser/autofill_driver.h" 11 #include "components/autofill/core/browser/autofill_driver.h"
11 #include "components/autofill/core/browser/autofill_manager.h" 12 #include "components/autofill/core/browser/autofill_manager.h"
12 #include "components/autofill/core/browser/popup_item_ids.h" 13 #include "components/autofill/core/browser/popup_item_ids.h"
13 #include "grit/components_strings.h" 14 #include "grit/components_strings.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 16
16 namespace autofill { 17 namespace autofill {
17 18
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // updated to match. 92 // updated to match.
92 InsertDataListValues(&values, &labels, &icons, &ids); 93 InsertDataListValues(&values, &labels, &icons, &ids);
93 94
94 #if defined(OS_MACOSX) 95 #if defined(OS_MACOSX)
95 if (values.empty() && 96 if (values.empty() &&
96 manager_->ShouldShowAccessAddressBookSuggestion(query_form_, 97 manager_->ShouldShowAccessAddressBookSuggestion(query_form_,
97 query_field_)) { 98 query_field_)) {
98 values.push_back( 99 values.push_back(
99 l10n_util::GetStringUTF16(IDS_AUTOFILL_ACCESS_MAC_CONTACTS)); 100 l10n_util::GetStringUTF16(IDS_AUTOFILL_ACCESS_MAC_CONTACTS));
100 labels.push_back(base::string16()); 101 labels.push_back(base::string16());
101 icons.push_back(base::string16()); 102 icons.push_back(base::ASCIIToUTF16("macContactsIcon"));
102 ids.push_back(POPUP_ITEM_ID_MAC_ACCESS_CONTACTS); 103 ids.push_back(POPUP_ITEM_ID_MAC_ACCESS_CONTACTS);
104
105 base::RecordAction(base::UserMetricsAction(
106 "Autofill_Showed_Access_Mac_Address_Book_Entry"));
Ilya Sherman 2014/05/30 23:39:48 Please use an enumerated histogram rather than a u
erikchen 2014/06/02 21:21:17 Done.
103 } 107 }
104 #endif 108 #endif
105 109
106 if (values.empty()) { 110 if (values.empty()) {
107 // No suggestions, any popup currently showing is obsolete. 111 // No suggestions, any popup currently showing is obsolete.
108 manager_->delegate()->HideAutofillPopup(); 112 manager_->delegate()->HideAutofillPopup();
109 return; 113 return;
110 } 114 }
111 115
112 // Send to display. 116 // Send to display.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 driver_->RendererShouldClearFilledForm(); 168 driver_->RendererShouldClearFilledForm();
165 } else if (identifier == POPUP_ITEM_ID_PASSWORD_ENTRY) { 169 } else if (identifier == POPUP_ITEM_ID_PASSWORD_ENTRY) {
166 NOTREACHED(); // Should be handled elsewhere. 170 NOTREACHED(); // Should be handled elsewhere.
167 } else if (identifier == POPUP_ITEM_ID_DATALIST_ENTRY) { 171 } else if (identifier == POPUP_ITEM_ID_DATALIST_ENTRY) {
168 driver_->RendererShouldAcceptDataListSuggestion(value); 172 driver_->RendererShouldAcceptDataListSuggestion(value);
169 } else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) { 173 } else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) {
170 // User selected an Autocomplete, so we fill directly. 174 // User selected an Autocomplete, so we fill directly.
171 driver_->RendererShouldFillFieldWithValue(value); 175 driver_->RendererShouldFillFieldWithValue(value);
172 } else if (identifier == POPUP_ITEM_ID_MAC_ACCESS_CONTACTS) { 176 } else if (identifier == POPUP_ITEM_ID_MAC_ACCESS_CONTACTS) {
173 #if defined(OS_MACOSX) 177 #if defined(OS_MACOSX)
178 base::RecordAction(base::UserMetricsAction(
179 "Autofill_Selected_Access_Mac_Address_Book_Entry"));
180
174 // User wants to give Chrome access to user's address book. 181 // User wants to give Chrome access to user's address book.
175 manager_->AccessAddressBook(); 182 manager_->AccessAddressBook();
176 183
177 // There is no deterministic method for deciding whether a blocking dialog 184 // There is no deterministic method for deciding whether a blocking dialog
178 // was presented. The following comments and code assume that a blocking 185 // was presented. The following comments and code assume that a blocking
179 // dialog was presented, but still behave correctly if no dialog was 186 // dialog was presented, but still behave correctly if no dialog was
180 // presented. 187 // presented.
181 188
182 // A blocking dialog was presented, and the user has already responded to 189 // A blocking dialog was presented, and the user has already responded to
183 // the dialog. The presentation of the dialog added an NSEvent to the 190 // the dialog. The presentation of the dialog added an NSEvent to the
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 POPUP_ITEM_ID_DATALIST_ENTRY); 368 POPUP_ITEM_ID_DATALIST_ENTRY);
362 } 369 }
363 370
364 #if defined(OS_MACOSX) 371 #if defined(OS_MACOSX)
365 void AutofillExternalDelegate::PingRenderer() { 372 void AutofillExternalDelegate::PingRenderer() {
366 driver_->PingRenderer(); 373 driver_->PingRenderer();
367 } 374 }
368 #endif 375 #endif
369 376
370 } // namespace autofill 377 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698