| 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.
|
|
|