| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); | 73 Shell::GetInstance()->overlay_filter()->Deactivate(this); |
| 74 } | 74 } |
| 75 | 75 |
| 76 std::vector<views::Widget*> widgets_; | 76 std::vector<views::Widget*> widgets_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(OverlayDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(OverlayDelegate); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // static | 81 // static |
| 82 std::vector<PartialScreenshotView*> | 82 std::vector<PartialScreenshotView*> |
| 83 PartialScreenshotView::StartPartialScreenshot( | 83 PartialScreenshotView::StartPartialScreenshot( |
| 84 ScreenshotDelegate* screenshot_delegate) { | 84 ScreenshotDelegate* screenshot_delegate) { |
| 85 std::vector<PartialScreenshotView*> views; | 85 std::vector<PartialScreenshotView*> views; |
| 86 |
| 87 if (Shell::GetInstance()->overlay_filter()->IsActive()) |
| 88 return views; |
| 89 |
| 86 OverlayDelegate* overlay_delegate = new OverlayDelegate(); | 90 OverlayDelegate* overlay_delegate = new OverlayDelegate(); |
| 87 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 91 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 88 for (aura::Window::Windows::iterator it = root_windows.begin(); | 92 for (aura::Window::Windows::iterator it = root_windows.begin(); |
| 89 it != root_windows.end(); ++it) { | 93 it != root_windows.end(); ++it) { |
| 90 PartialScreenshotView* new_view = new PartialScreenshotView( | 94 PartialScreenshotView* new_view = new PartialScreenshotView( |
| 91 overlay_delegate, screenshot_delegate); | 95 overlay_delegate, screenshot_delegate); |
| 92 new_view->Init(*it); | 96 new_view->Init(*it); |
| 93 views.push_back(new_view); | 97 views.push_back(new_view); |
| 94 } | 98 } |
| 95 return views; | 99 return views; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 OnSelectionFinished(); | 236 OnSelectionFinished(); |
| 233 break; | 237 break; |
| 234 default: | 238 default: |
| 235 break; | 239 break; |
| 236 } | 240 } |
| 237 | 241 |
| 238 event->SetHandled(); | 242 event->SetHandled(); |
| 239 } | 243 } |
| 240 | 244 |
| 241 } // namespace ash | 245 } // namespace ash |
| OLD | NEW |