Chromium Code Reviews| Index: ash/wm/partial_screenshot_view.cc |
| diff --git a/ash/wm/partial_screenshot_view.cc b/ash/wm/partial_screenshot_view.cc |
| index 23bdda448a46e4a2bd75dcafa3ecb78bc68b7bdc..141544176f2ae2167ca19d67d11595b457dbac6b 100644 |
| --- a/ash/wm/partial_screenshot_view.cc |
| +++ b/ash/wm/partial_screenshot_view.cc |
| @@ -10,6 +10,7 @@ |
| #include "ash/wm/partial_screenshot_event_filter.h" |
| #include "ui/aura/root_window.h" |
| #include "ui/aura/window.h" |
| +#include "ui/base/events.h" |
|
Daniel Erat
2012/04/16 16:48:49
nit: this should come after ui/base/cursor/cursor.
|
| #include "ui/base/cursor/cursor.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/rect.h" |
| @@ -56,6 +57,9 @@ void PartialScreenshotView::StartPartialScreenshot( |
| widget->GetNativeView()->SetName("PartialScreenshotView"); |
| widget->StackAtTop(); |
| widget->Show(); |
| + // Captures mouse events in case that context menu already captures the |
| + // events. This will close the context menu. |
| + widget->GetNativeView()->SetCapture(ui::CW_LOCK_MOUSE | ui::CW_LOCK_TOUCH); |
| view->set_window(widget->GetNativeWindow()); |
| Shell::GetInstance()->partial_screenshot_filter()->Activate(view); |
| @@ -85,6 +89,10 @@ void PartialScreenshotView::OnPaint(gfx::Canvas* canvas) { |
| } |
| } |
| +void PartialScreenshotView::OnMouseCaptureLost() { |
| + Cancel(); |
| +} |
| + |
| bool PartialScreenshotView::OnMousePressed(const views::MouseEvent& event) { |
| start_position_ = event.location(); |
| return true; |