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

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

Issue 2505533002: Http Bad: Add "Learn more" sublabel to warning message and make it clickable (Closed)
Patch Set: Created 4 years, 1 month 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 12 matching lines...) Expand all
23 #include "components/autofill/core/browser/autofill_metrics.h" 23 #include "components/autofill/core/browser/autofill_metrics.h"
24 #include "components/autofill/core/browser/popup_item_ids.h" 24 #include "components/autofill/core/browser/popup_item_ids.h"
25 #include "components/autofill/core/common/autofill_util.h" 25 #include "components/autofill/core/common/autofill_util.h"
26 #include "grit/components_strings.h" 26 #include "grit/components_strings.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 28
29 namespace autofill { 29 namespace autofill {
30 30
31 namespace { 31 namespace {
32 32
33 const char kSecurityIndicatorHelpCenterURL[] =
34 "https://support.google.com/chrome/answer/95617?hl=en";
35
33 // Returns true if the suggestion entry is an Autofill warning message. 36 // Returns true if the suggestion entry is an Autofill warning message.
34 // Warning messages should display on top of suggestion list. 37 // Warning messages should display on top of suggestion list.
35 bool IsAutofillWarningEntry(int frontend_id) { 38 bool IsAutofillWarningEntry(int frontend_id) {
36 return frontend_id == 39 return frontend_id ==
37 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE || 40 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE ||
38 frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE; 41 frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE;
39 } 42 }
40 43
41 } // anonymous namespace 44 } // anonymous namespace
42 45
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 driver_->RendererShouldAcceptDataListSuggestion(value); 221 driver_->RendererShouldAcceptDataListSuggestion(value);
219 } else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) { 222 } else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) {
220 // User selected an Autocomplete, so we fill directly. 223 // User selected an Autocomplete, so we fill directly.
221 driver_->RendererShouldFillFieldWithValue(value); 224 driver_->RendererShouldFillFieldWithValue(value);
222 AutofillMetrics::LogAutocompleteSuggestionAcceptedIndex(position); 225 AutofillMetrics::LogAutocompleteSuggestionAcceptedIndex(position);
223 } else if (identifier == POPUP_ITEM_ID_SCAN_CREDIT_CARD) { 226 } else if (identifier == POPUP_ITEM_ID_SCAN_CREDIT_CARD) {
224 manager_->client()->ScanCreditCard(base::Bind( 227 manager_->client()->ScanCreditCard(base::Bind(
225 &AutofillExternalDelegate::OnCreditCardScanned, GetWeakPtr())); 228 &AutofillExternalDelegate::OnCreditCardScanned, GetWeakPtr()));
226 } else if (identifier == POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO) { 229 } else if (identifier == POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO) {
227 manager_->client()->StartSigninFlow(); 230 manager_->client()->StartSigninFlow();
231 } else if (identifier == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE) {
232 manager_->OpenUrl(GURL(kSecurityIndicatorHelpCenterURL));
Mathieu 2016/11/16 20:03:46 use manager_->client()->OpenUrl directly?
lshang 2016/11/17 07:17:23 Done.
228 } else { 233 } else {
229 if (identifier > 0) // Denotes an Autofill suggestion. 234 if (identifier > 0) // Denotes an Autofill suggestion.
230 AutofillMetrics::LogAutofillSuggestionAcceptedIndex(position); 235 AutofillMetrics::LogAutofillSuggestionAcceptedIndex(position);
231 236
232 FillAutofillFormData(identifier, false); 237 FillAutofillFormData(identifier, false);
233 } 238 }
234 239
235 if (should_show_scan_credit_card_) { 240 if (should_show_scan_credit_card_) {
236 AutofillMetrics::LogScanCreditCardPromptMetric( 241 AutofillMetrics::LogScanCreditCardPromptMetric(
237 identifier == POPUP_ITEM_ID_SCAN_CREDIT_CARD 242 identifier == POPUP_ITEM_ID_SCAN_CREDIT_CARD
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 suggestions->insert(suggestions->begin(), data_list_values_.size(), 385 suggestions->insert(suggestions->begin(), data_list_values_.size(),
381 Suggestion()); 386 Suggestion());
382 for (size_t i = 0; i < data_list_values_.size(); i++) { 387 for (size_t i = 0; i < data_list_values_.size(); i++) {
383 (*suggestions)[i].value = data_list_values_[i]; 388 (*suggestions)[i].value = data_list_values_[i];
384 (*suggestions)[i].label = data_list_labels_[i]; 389 (*suggestions)[i].label = data_list_labels_[i];
385 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY; 390 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY;
386 } 391 }
387 } 392 }
388 393
389 } // namespace autofill 394 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_client.h ('k') | components/autofill/core/browser/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698