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 3238816c32e1196fcbf7d89b5592fdac6f639767..85592c863fbb5525e3e8e6590a43fcd47ef6a2c5 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" |
@@ -31,6 +30,7 @@ |
#include "ui/views/controls/link_listener.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" |
@@ -714,15 +714,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); |
}; |
@@ -730,17 +728,16 @@ 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(); |
+ if (web_contents) { |
+ gfx::NativeWindow target_window = web_contents->GetTopLevelNativeWindow(); |
+ event_monitor_.reset(views::EventMonitor::Create(this, target_window)); |
tapted
2014/11/21 00:57:34
can you make the views::EventMonitor::Create* retu
Andre
2014/12/10 00:18:13
Done.
|
+ } |
} |
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) |
@@ -753,12 +750,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 |
@@ -786,8 +777,7 @@ void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, |
web_contents, anchor_view, reason); |
if (is_fullscreen) { |
tapted
2014/11/20 22:39:02
nit: no curlies
Andre
2014/12/10 00:18:13
Done.
|
- manage_passwords_bubble_->set_parent_window( |
- web_contents->GetTopLevelNativeWindow()); |
+ manage_passwords_bubble_->set_parent_window(web_contents->GetNativeView()); |
} |
views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_); |