OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/partial_screenshot_view.h" | 5 #include "ash/wm/partial_screenshot_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/display/mouse_cursor_event_filter.h" | 9 #include "ash/display/mouse_cursor_event_filter.h" |
10 #include "ash/screenshot_delegate.h" | 10 #include "ash/screenshot_delegate.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 OverlayDelegate() { | 32 OverlayDelegate() { |
33 Shell::GetInstance()->overlay_filter()->Activate(this); | 33 Shell::GetInstance()->overlay_filter()->Activate(this); |
34 } | 34 } |
35 | 35 |
36 void RegisterWidget(views::Widget* widget) { | 36 void RegisterWidget(views::Widget* widget) { |
37 widgets_.push_back(widget); | 37 widgets_.push_back(widget); |
38 widget->AddObserver(this); | 38 widget->AddObserver(this); |
39 } | 39 } |
40 | 40 |
41 // Overridden from OverlayEventFilter::Delegate: | 41 // Overridden from OverlayEventFilter::Delegate: |
42 virtual void Cancel() OVERRIDE { | 42 virtual void Cancel() override { |
43 // Make sure the mouse_warp_mode allows warping. It can be stopped by a | 43 // Make sure the mouse_warp_mode allows warping. It can be stopped by a |
44 // partial screenshot view. | 44 // partial screenshot view. |
45 MouseCursorEventFilter* mouse_cursor_filter = | 45 MouseCursorEventFilter* mouse_cursor_filter = |
46 Shell::GetInstance()->mouse_cursor_filter(); | 46 Shell::GetInstance()->mouse_cursor_filter(); |
47 mouse_cursor_filter->set_mouse_warp_mode( | 47 mouse_cursor_filter->set_mouse_warp_mode( |
48 MouseCursorEventFilter::WARP_ALWAYS); | 48 MouseCursorEventFilter::WARP_ALWAYS); |
49 for (size_t i = 0; i < widgets_.size(); ++i) | 49 for (size_t i = 0; i < widgets_.size(); ++i) |
50 widgets_[i]->Close(); | 50 widgets_[i]->Close(); |
51 } | 51 } |
52 | 52 |
53 virtual bool IsCancelingKeyEvent(ui::KeyEvent* event) OVERRIDE { | 53 virtual bool IsCancelingKeyEvent(ui::KeyEvent* event) override { |
54 return event->key_code() == ui::VKEY_ESCAPE; | 54 return event->key_code() == ui::VKEY_ESCAPE; |
55 } | 55 } |
56 | 56 |
57 virtual aura::Window* GetWindow() OVERRIDE { | 57 virtual aura::Window* GetWindow() override { |
58 // Just returns NULL because this class does not handle key events in | 58 // Just returns NULL because this class does not handle key events in |
59 // OverlayEventFilter, except for cancel keys. | 59 // OverlayEventFilter, except for cancel keys. |
60 return NULL; | 60 return NULL; |
61 } | 61 } |
62 | 62 |
63 // Overridden from views::WidgetObserver: | 63 // Overridden from views::WidgetObserver: |
64 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE { | 64 virtual void OnWidgetDestroying(views::Widget* widget) override { |
65 widget->RemoveObserver(this); | 65 widget->RemoveObserver(this); |
66 widgets_.erase(std::remove(widgets_.begin(), widgets_.end(), widget)); | 66 widgets_.erase(std::remove(widgets_.begin(), widgets_.end(), widget)); |
67 if (widgets_.empty()) | 67 if (widgets_.empty()) |
68 delete this; | 68 delete this; |
69 } | 69 } |
70 | 70 |
71 private: | 71 private: |
72 virtual ~OverlayDelegate() { | 72 virtual ~OverlayDelegate() { |
73 Shell::GetInstance()->overlay_filter()->Deactivate(this); | 73 Shell::GetInstance()->overlay_filter()->Deactivate(this); |
74 } | 74 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 OnSelectionFinished(); | 236 OnSelectionFinished(); |
237 break; | 237 break; |
238 default: | 238 default: |
239 break; | 239 break; |
240 } | 240 } |
241 | 241 |
242 event->SetHandled(); | 242 event->SetHandled(); |
243 } | 243 } |
244 | 244 |
245 } // namespace ash | 245 } // namespace ash |
OLD | NEW |