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

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

Issue 2496683003: Http Bad: Add a PopupItemId to identify http warning message (Closed)
Patch Set: minor change 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 13 matching lines...) Expand all
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 // Returns true if the suggestion entry is an Autofill warning message. 33 // Returns true if the suggestion entry is an Autofill warning message.
34 // Warning message should display on top of suggestion list. 34 // Warning message should display on top of suggestion list.
Mathieu 2016/11/12 12:52:05 nit: Warning messages*
lshang 2016/11/14 10:51:01 Done.
35 bool IsAutofillWarningEntry(int frontend_id) { 35 bool IsAutofillWarningEntry(int frontend_id) {
36 return frontend_id == POPUP_ITEM_ID_WARNING_MESSAGE; 36 return frontend_id == POPUP_ITEM_ID_WARNING_MESSAGE ||
37 frontend_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE;
37 } 38 }
38 39
39 } // anonymous namespace 40 } // anonymous namespace
40 41
41 AutofillExternalDelegate::AutofillExternalDelegate(AutofillManager* manager, 42 AutofillExternalDelegate::AutofillExternalDelegate(AutofillManager* manager,
42 AutofillDriver* driver) 43 AutofillDriver* driver)
43 : manager_(manager), 44 : manager_(manager),
44 driver_(driver), 45 driver_(driver),
45 query_id_(0), 46 query_id_(0),
46 has_autofill_suggestions_(false), 47 has_autofill_suggestions_(false),
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 287 }
287 288
288 void AutofillExternalDelegate::OnCreditCardScanned(const CreditCard& card) { 289 void AutofillExternalDelegate::OnCreditCardScanned(const CreditCard& card) {
289 manager_->FillCreditCardForm(query_id_, query_form_, query_field_, card, 290 manager_->FillCreditCardForm(query_id_, query_form_, query_field_, card,
290 base::string16()); 291 base::string16());
291 } 292 }
292 293
293 void AutofillExternalDelegate::FillAutofillFormData(int unique_id, 294 void AutofillExternalDelegate::FillAutofillFormData(int unique_id,
294 bool is_preview) { 295 bool is_preview) {
295 // If the selected element is a warning we don't want to do anything. 296 // If the selected element is a warning we don't want to do anything.
296 if (unique_id == POPUP_ITEM_ID_WARNING_MESSAGE) 297 if (unique_id == POPUP_ITEM_ID_WARNING_MESSAGE ||
Mathieu 2016/11/12 12:52:05 reuse IsAutofillWarningEntry()?
lshang 2016/11/14 10:51:01 Done.
298 unique_id == POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE)
297 return; 299 return;
298 300
299 AutofillDriver::RendererFormDataAction renderer_action = is_preview ? 301 AutofillDriver::RendererFormDataAction renderer_action = is_preview ?
300 AutofillDriver::FORM_DATA_ACTION_PREVIEW : 302 AutofillDriver::FORM_DATA_ACTION_PREVIEW :
301 AutofillDriver::FORM_DATA_ACTION_FILL; 303 AutofillDriver::FORM_DATA_ACTION_FILL;
302 304
303 DCHECK(driver_->RendererIsAvailable()); 305 DCHECK(driver_->RendererIsAvailable());
304 // Fill the values for the whole form. 306 // Fill the values for the whole form.
305 manager_->FillOrPreviewForm(renderer_action, 307 manager_->FillOrPreviewForm(renderer_action,
306 query_id_, 308 query_id_,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 suggestions->insert(suggestions->begin(), data_list_values_.size(), 380 suggestions->insert(suggestions->begin(), data_list_values_.size(),
379 Suggestion()); 381 Suggestion());
380 for (size_t i = 0; i < data_list_values_.size(); i++) { 382 for (size_t i = 0; i < data_list_values_.size(); i++) {
381 (*suggestions)[i].value = data_list_values_[i]; 383 (*suggestions)[i].value = data_list_values_[i];
382 (*suggestions)[i].label = data_list_labels_[i]; 384 (*suggestions)[i].label = data_list_labels_[i];
383 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY; 385 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY;
384 } 386 }
385 } 387 }
386 388
387 } // namespace autofill 389 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698