Chromium Code Reviews| Index: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc |
| diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc |
| index cdf963fd316b1e7ef83a959e569b8d55b85489d2..0e62e3555d60849f773c3540244cc722b972afd0 100644 |
| --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc |
| +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc |
| @@ -17,7 +17,12 @@ |
| #include "components/autofill/core/browser/autofill_popup_delegate.h" |
| #include "components/autofill/core/browser/popup_item_ids.h" |
| #include "components/autofill/core/browser/suggestion.h" |
| +#include "components/security_state/switches.h" |
| +#include "components/strings/grit/components_strings.h" |
| #include "content/public/browser/native_web_keyboard_event.h" |
| +#include "content/public/browser/web_contents.h" |
|
vabr (Chromium)
2016/11/04 08:55:29
Is this still needed?
lshang
2016/11/07 05:34:02
Removed.
|
| +#include "content/public/common/origin_util.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| #include "ui/events/event.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/text_elider.h" |
| @@ -395,6 +400,11 @@ const AutofillPopupLayoutModel& AutofillPopupControllerImpl::layout_model() |
| return layout_model_; |
| } |
| +bool AutofillPopupControllerImpl::IsTopLevelURLSecure() const { |
| + return content::IsOriginSecure( |
|
Mathieu
2016/11/05 03:26:59
BTW in AutofillManager, we check for the secure co
lshang
2016/11/07 05:34:02
Good question.
In my update patch, for password f
|
| + controller_common_->web_contents()->GetVisibleURL()); |
| +} |
| + |
| void AutofillPopupControllerImpl::SetSelectedLine(int selected_line) { |
| if (selected_line_ == selected_line) |
| return; |
| @@ -478,11 +488,24 @@ bool AutofillPopupControllerImpl::HasSuggestions() { |
| void AutofillPopupControllerImpl::SetValues( |
|
Mathieu
2016/11/05 03:26:59
This function doesn't seem like the ideal place to
lshang
2016/11/07 05:34:02
Yeah, I add password entry in password_autofill_ma
|
| const std::vector<autofill::Suggestion>& suggestions) { |
| suggestions_ = suggestions; |
| - elided_values_.resize(suggestions.size()); |
| - elided_labels_.resize(suggestions.size()); |
| - for (size_t i = 0; i < suggestions.size(); i++) { |
| - elided_values_[i] = suggestions[i].value; |
| - elided_labels_[i] = suggestions[i].label; |
| + |
| + std::string choice = |
| + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| + security_state::switches::kMarkHttpAs); |
| + if (!IsTopLevelURLSecure() && |
|
vabr (Chromium)
2016/11/04 08:55:29
Could you please add a test for the new functional
lshang
2016/11/07 05:34:02
Done.
Tests added in autofill_manager_unittest and
|
| + choice == security_state::switches::kMarkHttpWithPasswordsOrCcWithChip) { |
| + autofill::Suggestion autofill_http_warning_suggestion( |
| + l10n_util::GetStringUTF16(IDS_AUTOFILL_HTTP_WARNING_MESSAGE)); |
| + autofill_http_warning_suggestion.frontend_id = |
| + POPUP_ITEM_ID_WARNING_MESSAGE; |
| + suggestions_.insert(suggestions_.begin(), autofill_http_warning_suggestion); |
|
vabr (Chromium)
2016/11/04 08:55:29
optional:
Currently we copy |suggestions| into |s
lshang
2016/11/07 05:34:02
I split the password and credit card logic into tw
|
| + } |
| + |
| + elided_values_.resize(suggestions_.size()); |
| + elided_labels_.resize(suggestions_.size()); |
| + for (size_t i = 0; i < suggestions_.size(); i++) { |
| + elided_values_[i] = suggestions_[i].value; |
| + elided_labels_[i] = suggestions_[i].label; |
| } |
| } |