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

Unified Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 541683003: The Password bubble should fade out when user types in the input fields on the web page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
index 720ba64948116f828f4ae87147d209d637a5fd97..cb00683c87e79883fc0a79c62524e3fd7d24c50c 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/views/passwords/manage_password_item_view.h"
#include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h"
#include "chrome/grit/generated_resources.h"
+#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
@@ -636,37 +637,56 @@ void ManagePasswordsBubbleView::SaveConfirmationView::ButtonPressed(
// ManagePasswordsBubbleView::WebContentMouseHandler --------------------------
// The class listens for WebContentsView events and notifies the bubble if the
-// view was clicked on.
+// view was clicked on or received keystrokes.
class ManagePasswordsBubbleView::WebContentMouseHandler
: public ui::EventHandler {
public:
- explicit WebContentMouseHandler(ManagePasswordsBubbleView* bubble)
- : bubble_(bubble) {
- GetWebContentsWindow()->AddPreTargetHandler(this);
- }
-
- virtual ~WebContentMouseHandler() {
- aura::Window* window = GetWebContentsWindow();
- if (window)
- window->RemovePreTargetHandler(this);
- }
+ explicit WebContentMouseHandler(ManagePasswordsBubbleView* bubble);
+ virtual ~WebContentMouseHandler();
- virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE {
- if (event->type() == ui::ET_MOUSE_PRESSED)
- bubble_->StartFadingOut();
- }
+ virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
+ virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
private:
- aura::Window* GetWebContentsWindow() {
- content::WebContents* web_contents = bubble_->model()->web_contents();
- return web_contents ? web_contents->GetNativeView() : NULL;
- }
+ aura::Window* GetWebContentsWindow();
ManagePasswordsBubbleView* bubble_;
DISALLOW_COPY_AND_ASSIGN(WebContentMouseHandler);
};
+ManagePasswordsBubbleView::WebContentMouseHandler::WebContentMouseHandler(
+ ManagePasswordsBubbleView* bubble)
+ : bubble_(bubble) {
+ GetWebContentsWindow()->AddPreTargetHandler(this);
+}
+
+ManagePasswordsBubbleView::WebContentMouseHandler::~WebContentMouseHandler() {
+ if (aura::Window* window = GetWebContentsWindow())
+ window->RemovePreTargetHandler(this);
+}
+
+void ManagePasswordsBubbleView::WebContentMouseHandler::OnKeyEvent(
+ ui::KeyEvent* event) {
+ content::WebContents* web_contents = bubble_->model()->web_contents();
+ content::RenderViewHost* rvh = web_contents->GetRenderViewHost();
+ if (rvh->IsFocusedElementEditable() &&
+ event->type() == ui::ET_KEY_PRESSED)
+ bubble_->StartFadingOut();
+}
+
+void ManagePasswordsBubbleView::WebContentMouseHandler::OnMouseEvent(
+ ui::MouseEvent* event) {
+ if (event->type() == ui::ET_MOUSE_PRESSED)
+ bubble_->StartFadingOut();
+}
+
+aura::Window*
+ManagePasswordsBubbleView::WebContentMouseHandler::GetWebContentsWindow() {
+ content::WebContents* web_contents = bubble_->model()->web_contents();
+ return web_contents ? web_contents->GetNativeView() : NULL;
+}
+
// ManagePasswordsBubbleView::FadeOutObserver ---------------------------------
// The class notifies the bubble when it faded out completely.
« no previous file with comments | « no previous file | chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698