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

Unified Diff: chrome/browser/autofill/autofill_popup_view.cc

Issue 9235072: Adding Mouse Support for new GTK Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: First Draft Created 8 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/autofill_popup_view.cc
diff --git a/chrome/browser/autofill/autofill_popup_view.cc b/chrome/browser/autofill/autofill_popup_view.cc
index bd285536c4892a7319660ee230d81e875f2358c6..1ce32df32e63b05a3d460ce220bbf47cb1603fb1 100644
--- a/chrome/browser/autofill/autofill_popup_view.cc
+++ b/chrome/browser/autofill/autofill_popup_view.cc
@@ -4,13 +4,19 @@
#include "chrome/browser/autofill/autofill_popup_view.h"
+#include "base/logging.h"
+#include "chrome/browser/autofill/autofill_external_delegate.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
-AutofillPopupView::AutofillPopupView(content::WebContents* web_contents) {
+AutofillPopupView::AutofillPopupView(
+ content::WebContents* web_contents,
+ AutofillExternalDelegate* external_delegate)
+ : external_delegate_(external_delegate),
+ selected_line_(-1) {
registrar_.Add(this,
content::NOTIFICATION_WEB_CONTENTS_HIDDEN,
content::Source<content::WebContents>(web_contents));
@@ -23,6 +29,12 @@ AutofillPopupView::AutofillPopupView(content::WebContents* web_contents) {
AutofillPopupView::~AutofillPopupView() {}
+void AutofillPopupView::Hide() {
+ HideInternal();
+
+ external_delegate_->ClearAutofillSelection();
+}
+
void AutofillPopupView::Show(const std::vector<string16>& autofill_values,
const std::vector<string16>& autofill_labels,
const std::vector<string16>& autofill_icons,
@@ -38,6 +50,24 @@ void AutofillPopupView::Show(const std::vector<string16>& autofill_values,
ShowInternal();
}
+void AutofillPopupView::SetSelectedLine(int selected_line) {
+ if (selected_line_ == selected_line)
+ return;
+
+ if (selected_line_ != -1)
+ InvalidateRow(selected_line_);
+
+ if (selected_line != -1)
+ InvalidateRow(selected_line);
+
+ selected_line_ = selected_line;
+
+ if (selected_line_ != -1)
+ external_delegate_->SelectAutofillSuggestionAtIndex(
+ autofill_unique_ids_[selected_line_],
+ selected_line);
+}
+
void AutofillPopupView::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {

Powered by Google App Engine
This is Rietveld 408576698