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 f16f9ad8e8fb685ae1d456aa851170ba57ef0373..00464a131a0813fba3dd1b24a5ea6953bf17d80e 100644 |
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
@@ -20,7 +20,6 @@ |
#include "content/public/browser/notification_source.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" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/views/controls/button/blue_button.h" |
@@ -32,6 +31,7 @@ |
#include "ui/views/controls/separator.h" |
#include "ui/views/controls/styled_label.h" |
#include "ui/views/controls/styled_label_listener.h" |
+#include "ui/views/event_monitor.h" |
#include "ui/views/layout/fill_layout.h" |
#include "ui/views/layout/grid_layout.h" |
#include "ui/views/layout/layout_constants.h" |
@@ -827,15 +827,13 @@ class ManagePasswordsBubbleView::WebContentMouseHandler |
: public ui::EventHandler { |
public: |
explicit WebContentMouseHandler(ManagePasswordsBubbleView* bubble); |
- ~WebContentMouseHandler() override; |
void OnKeyEvent(ui::KeyEvent* event) override; |
void OnMouseEvent(ui::MouseEvent* event) override; |
private: |
- aura::Window* GetWebContentsWindow(); |
- |
ManagePasswordsBubbleView* bubble_; |
+ scoped_ptr<views::EventMonitor> event_monitor_; |
DISALLOW_COPY_AND_ASSIGN(WebContentMouseHandler); |
}; |
@@ -843,17 +841,15 @@ class ManagePasswordsBubbleView::WebContentMouseHandler |
ManagePasswordsBubbleView::WebContentMouseHandler::WebContentMouseHandler( |
ManagePasswordsBubbleView* bubble) |
: bubble_(bubble) { |
- GetWebContentsWindow()->AddPreTargetHandler(this); |
-} |
- |
-ManagePasswordsBubbleView::WebContentMouseHandler::~WebContentMouseHandler() { |
- if (aura::Window* window = GetWebContentsWindow()) |
- window->RemovePreTargetHandler(this); |
+ content::WebContents* web_contents = bubble_->web_contents(); |
+ DCHECK(web_contents); |
+ event_monitor_ = views::EventMonitor::CreateWindowMonitor( |
+ this, web_contents->GetTopLevelNativeWindow()); |
} |
void ManagePasswordsBubbleView::WebContentMouseHandler::OnKeyEvent( |
ui::KeyEvent* event) { |
- content::WebContents* web_contents = bubble_->model()->web_contents(); |
+ content::WebContents* web_contents = bubble_->web_contents(); |
content::RenderViewHost* rvh = web_contents->GetRenderViewHost(); |
if (rvh->IsFocusedElementEditable() && |
event->type() == ui::ET_KEY_PRESSED) |
@@ -866,12 +862,6 @@ void ManagePasswordsBubbleView::WebContentMouseHandler::OnMouseEvent( |
bubble_->Close(); |
} |
-aura::Window* |
-ManagePasswordsBubbleView::WebContentMouseHandler::GetWebContentsWindow() { |
- content::WebContents* web_contents = bubble_->model()->web_contents(); |
- return web_contents ? web_contents->GetNativeView() : NULL; |
-} |
- |
// ManagePasswordsBubbleView -------------------------------------------------- |
// static |
@@ -898,10 +888,8 @@ void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, |
manage_passwords_bubble_ = new ManagePasswordsBubbleView( |
web_contents, anchor_view, reason); |
- if (is_fullscreen) { |
- manage_passwords_bubble_->set_parent_window( |
- web_contents->GetTopLevelNativeWindow()); |
- } |
+ if (is_fullscreen) |
+ manage_passwords_bubble_->set_parent_window(web_contents->GetNativeView()); |
views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_); |