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

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

Issue 2478043002: HTTP Bad: Add warning message to autofill dropdown for http sites (Closed)
Patch Set: add test to AutofillManagerTest 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_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "components/autofill/core/common/autofill_data_validation.h" 54 #include "components/autofill/core/common/autofill_data_validation.h"
55 #include "components/autofill/core/common/autofill_pref_names.h" 55 #include "components/autofill/core/common/autofill_pref_names.h"
56 #include "components/autofill/core/common/autofill_util.h" 56 #include "components/autofill/core/common/autofill_util.h"
57 #include "components/autofill/core/common/form_data.h" 57 #include "components/autofill/core/common/form_data.h"
58 #include "components/autofill/core/common/form_data_predictions.h" 58 #include "components/autofill/core/common/form_data_predictions.h"
59 #include "components/autofill/core/common/form_field_data.h" 59 #include "components/autofill/core/common/form_field_data.h"
60 #include "components/autofill/core/common/password_form_fill_data.h" 60 #include "components/autofill/core/common/password_form_fill_data.h"
61 #include "components/pref_registry/pref_registry_syncable.h" 61 #include "components/pref_registry/pref_registry_syncable.h"
62 #include "components/prefs/pref_service.h" 62 #include "components/prefs/pref_service.h"
63 #include "components/rappor/rappor_utils.h" 63 #include "components/rappor/rappor_utils.h"
64 #include "components/security_state/switches.h"
64 #include "google_apis/gaia/identity_provider.h" 65 #include "google_apis/gaia/identity_provider.h"
65 #include "grit/components_strings.h" 66 #include "grit/components_strings.h"
66 #include "ui/base/l10n/l10n_util.h" 67 #include "ui/base/l10n/l10n_util.h"
67 #include "ui/gfx/geometry/rect.h" 68 #include "ui/gfx/geometry/rect.h"
68 #include "url/gurl.h" 69 #include "url/gurl.h"
69 70
70 #if defined(OS_IOS) 71 #if defined(OS_IOS)
71 #include "components/autofill/core/browser/keyboard_accessory_metrics_logger.h" 72 #include "components/autofill/core/browser/keyboard_accessory_metrics_logger.h"
72 #endif 73 #endif
73 74
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 AutofillMetrics::LogIsQueriedCreditCardFormSecure(is_context_secure); 563 AutofillMetrics::LogIsQueriedCreditCardFormSecure(is_context_secure);
563 564
564 // Don't provide credit card suggestions for non-secure pages, but do 565 // Don't provide credit card suggestions for non-secure pages, but do
565 // provide them for secure pages with passive mixed content (see impl. of 566 // provide them for secure pages with passive mixed content (see impl. of
566 // IsContextSecure). 567 // IsContextSecure).
567 if (is_filling_credit_card && !is_context_secure) { 568 if (is_filling_credit_card && !is_context_secure) {
568 Suggestion warning_suggestion(l10n_util::GetStringUTF16( 569 Suggestion warning_suggestion(l10n_util::GetStringUTF16(
569 IDS_AUTOFILL_WARNING_INSECURE_CONNECTION)); 570 IDS_AUTOFILL_WARNING_INSECURE_CONNECTION));
570 warning_suggestion.frontend_id = POPUP_ITEM_ID_WARNING_MESSAGE; 571 warning_suggestion.frontend_id = POPUP_ITEM_ID_WARNING_MESSAGE;
571 suggestions.assign(1, warning_suggestion); 572 suggestions.assign(1, warning_suggestion);
573
574 std::string choice =
575 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
576 security_state::switches::kMarkHttpAs);
577 if (choice ==
578 security_state::switches::kMarkHttpWithPasswordsOrCcWithChip) {
estark 2016/11/07 06:06:57 Drive-by: this should be the new switch, right? (k
lshang 2016/11/07 06:12:12 Done. Yeah I've rebased and changed to use the new
579 autofill::Suggestion cc_field_http_warning_suggestion(
580 l10n_util::GetStringUTF16(
581 IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE));
582 cc_field_http_warning_suggestion.frontend_id =
583 autofill::POPUP_ITEM_ID_WARNING_MESSAGE;
584 suggestions.insert(suggestions.begin(),
585 cc_field_http_warning_suggestion);
586 }
572 } else { 587 } else {
573 bool section_is_autofilled = 588 bool section_is_autofilled =
574 SectionIsAutofilled(*form_structure, form, 589 SectionIsAutofilled(*form_structure, form,
575 autofill_field->section()); 590 autofill_field->section());
576 if (section_is_autofilled) { 591 if (section_is_autofilled) {
577 // If the relevant section is auto-filled and the renderer is querying 592 // If the relevant section is auto-filled and the renderer is querying
578 // for suggestions, then the user is editing the value of a field. 593 // for suggestions, then the user is editing the value of a field.
579 // In this case, mimic autocomplete: don't display labels or icons, 594 // In this case, mimic autocomplete: don't display labels or icons,
580 // as that information is redundant. Moreover, filter out duplicate 595 // as that information is redundant. Moreover, filter out duplicate
581 // suggestions. 596 // suggestions.
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 if (i > 0) 2105 if (i > 0)
2091 fputs("Next oldest form:\n", file); 2106 fputs("Next oldest form:\n", file);
2092 } 2107 }
2093 fputs("\n", file); 2108 fputs("\n", file);
2094 2109
2095 fclose(file); 2110 fclose(file);
2096 } 2111 }
2097 #endif // ENABLE_FORM_DEBUG_DUMP 2112 #endif // ENABLE_FORM_DEBUG_DUMP
2098 2113
2099 } // namespace autofill 2114 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698