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

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

Issue 2498503002: Http Bad: Add icons to the http warning message (Closed)
Patch Set: change color after confirm 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 177
178 bool IsCreditCardExpirationType(ServerFieldType type) { 178 bool IsCreditCardExpirationType(ServerFieldType type) {
179 return type == CREDIT_CARD_EXP_MONTH || 179 return type == CREDIT_CARD_EXP_MONTH ||
180 type == CREDIT_CARD_EXP_2_DIGIT_YEAR || 180 type == CREDIT_CARD_EXP_2_DIGIT_YEAR ||
181 type == CREDIT_CARD_EXP_4_DIGIT_YEAR || 181 type == CREDIT_CARD_EXP_4_DIGIT_YEAR ||
182 type == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR || 182 type == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR ||
183 type == CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR; 183 type == CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR;
184 } 184 }
185 185
186 Suggestion CreateHttpWarningMessageSuggestionItem(const GURL& source_url) {
Mathieu 2016/11/22 14:20:32 Add a function comment detailing the conditions un
lshang 2016/11/23 09:58:26 Done.
187 std::string icon_str;
188
189 // Show http info icon for http sites.
190 if (source_url.is_valid() && source_url.SchemeIs("http")) {
191 icon_str = "http";
192 } else {
193 // Show https_invalid icon for broken https sites.
194 icon_str = "httpsInvalid";
195 }
196
197 return Suggestion(
198 l10n_util::GetStringUTF8(IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE),
199 std::string(), icon_str, POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE);
200 }
201
186 } // namespace 202 } // namespace
187 203
188 AutofillManager::AutofillManager( 204 AutofillManager::AutofillManager(
189 AutofillDriver* driver, 205 AutofillDriver* driver,
190 AutofillClient* client, 206 AutofillClient* client,
191 const std::string& app_locale, 207 const std::string& app_locale,
192 AutofillDownloadManagerState enable_download_manager) 208 AutofillDownloadManagerState enable_download_manager)
193 : driver_(driver), 209 : driver_(driver),
194 client_(client), 210 client_(client),
195 payments_client_( 211 payments_client_(
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // Autofill is disabled for a website. 585 // Autofill is disabled for a website.
570 Suggestion warning_suggestion(l10n_util::GetStringUTF16( 586 Suggestion warning_suggestion(l10n_util::GetStringUTF16(
571 IDS_AUTOFILL_WARNING_INSECURE_CONNECTION)); 587 IDS_AUTOFILL_WARNING_INSECURE_CONNECTION));
572 warning_suggestion.frontend_id = 588 warning_suggestion.frontend_id =
573 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE; 589 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE;
574 suggestions.assign(1, warning_suggestion); 590 suggestions.assign(1, warning_suggestion);
575 591
576 // On top of the explanation message, first show a "Payment not secure" 592 // On top of the explanation message, first show a "Payment not secure"
577 // message. 593 // message.
578 if (IsCreditCardAutofillHttpWarningEnabled()) { 594 if (IsCreditCardAutofillHttpWarningEnabled()) {
579 Suggestion cc_field_http_warning_suggestion(l10n_util::GetStringUTF16(
580 IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE));
581 cc_field_http_warning_suggestion.frontend_id =
582 POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE;
583 suggestions.insert(suggestions.begin(), 595 suggestions.insert(suggestions.begin(),
584 cc_field_http_warning_suggestion); 596 CreateHttpWarningMessageSuggestionItem(
597 form_structure->source_url()));
585 } 598 }
586 } else { 599 } else {
587 bool section_is_autofilled = 600 bool section_is_autofilled =
588 SectionIsAutofilled(*form_structure, form, 601 SectionIsAutofilled(*form_structure, form,
589 autofill_field->section()); 602 autofill_field->section());
590 if (section_is_autofilled) { 603 if (section_is_autofilled) {
591 // If the relevant section is auto-filled and the renderer is querying 604 // If the relevant section is auto-filled and the renderer is querying
592 // for suggestions, then the user is editing the value of a field. 605 // for suggestions, then the user is editing the value of a field.
593 // In this case, mimic autocomplete: don't display labels or icons, 606 // In this case, mimic autocomplete: don't display labels or icons,
594 // as that information is redundant. Moreover, filter out duplicate 607 // as that information is redundant. Moreover, filter out duplicate
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 if (i > 0) 2117 if (i > 0)
2105 fputs("Next oldest form:\n", file); 2118 fputs("Next oldest form:\n", file);
2106 } 2119 }
2107 fputs("\n", file); 2120 fputs("\n", file);
2108 2121
2109 fclose(file); 2122 fclose(file);
2110 } 2123 }
2111 #endif // ENABLE_FORM_DEBUG_DUMP 2124 #endif // ENABLE_FORM_DEBUG_DUMP
2112 2125
2113 } // namespace autofill 2126 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698