| 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 #ifndef ASH_WM_PARTIAL_SCREENSHOT_VIEW_H_ | 5 #ifndef ASH_WM_PARTIAL_SCREENSHOT_VIEW_H_ |
| 6 #define ASH_WM_PARTIAL_SCREENSHOT_VIEW_H_ | 6 #define ASH_WM_PARTIAL_SCREENSHOT_VIEW_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
| 14 #include "ui/views/widget/widget_delegate.h" | 14 #include "ui/views/widget/widget_delegate.h" |
| 15 | 15 |
| 16 namespace aura { |
| 17 class RootWindow; |
| 18 } |
| 19 |
| 16 namespace ash { | 20 namespace ash { |
| 17 class ScreenshotDelegate; | 21 class ScreenshotDelegate; |
| 18 | 22 |
| 19 // The view of taking partial screenshot, i.e.: drawing region | 23 // The view of taking partial screenshot, i.e.: drawing region |
| 20 // rectangles during drag, and changing the mouse cursor to indicate | 24 // rectangles during drag, and changing the mouse cursor to indicate |
| 21 // the current mode. | 25 // the current mode. |
| 22 class ASH_EXPORT PartialScreenshotView : public views::WidgetDelegateView { | 26 class ASH_EXPORT PartialScreenshotView : public views::WidgetDelegateView { |
| 23 public: | 27 public: |
| 24 // Starts the UI for taking partial screenshot; dragging to select a region. | 28 // Starts the UI for taking partial screenshot; dragging to select a region. |
| 25 // PartialScreenshotViews manage their own lifetime so caller must not delete | 29 // PartialScreenshotViews manage their own lifetime so caller must not delete |
| 26 // the returned PartialScreenshotViews. | 30 // the returned PartialScreenshotViews. |
| 27 static std::vector<PartialScreenshotView*> | 31 static std::vector<PartialScreenshotView*> |
| 28 StartPartialScreenshot(ScreenshotDelegate* screenshot_delegate); | 32 StartPartialScreenshot(ScreenshotDelegate* screenshot_delegate); |
| 29 | 33 |
| 30 private: | 34 private: |
| 31 FRIEND_TEST_ALL_PREFIXES(PartialScreenshotViewTest, BasicMouse); | 35 FRIEND_TEST_ALL_PREFIXES(PartialScreenshotViewTest, BasicMouse); |
| 32 FRIEND_TEST_ALL_PREFIXES(PartialScreenshotViewTest, BasicTouch); | 36 FRIEND_TEST_ALL_PREFIXES(PartialScreenshotViewTest, BasicTouch); |
| 33 | 37 |
| 34 class OverlayDelegate; | 38 class OverlayDelegate; |
| 35 | 39 |
| 36 PartialScreenshotView(OverlayDelegate* overlay_delegate, | 40 PartialScreenshotView(OverlayDelegate* overlay_delegate, |
| 37 ScreenshotDelegate* screenshot_delegate); | 41 ScreenshotDelegate* screenshot_delegate); |
| 38 virtual ~PartialScreenshotView(); | 42 virtual ~PartialScreenshotView(); |
| 39 | 43 |
| 40 // Initializes partial screenshot UI widget for |root_window|. | 44 // Initializes partial screenshot UI widget for |root_window|. |
| 41 void Init(aura::Window* root_window); | 45 void Init(aura::RootWindow* root_window); |
| 42 | 46 |
| 43 // Returns the currently selected region. | 47 // Returns the currently selected region. |
| 44 gfx::Rect GetScreenshotRect() const; | 48 gfx::Rect GetScreenshotRect() const; |
| 45 | 49 |
| 46 void OnSelectionStarted(const gfx::Point& position); | 50 void OnSelectionStarted(const gfx::Point& position); |
| 47 void OnSelectionChanged(const gfx::Point& position); | 51 void OnSelectionChanged(const gfx::Point& position); |
| 48 void OnSelectionFinished(); | 52 void OnSelectionFinished(); |
| 49 | 53 |
| 50 // Overridden from views::View: | 54 // Overridden from views::View: |
| 51 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; | 55 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 66 | 70 |
| 67 // ScreenshotDelegate to take the actual screenshot. No ownership. | 71 // ScreenshotDelegate to take the actual screenshot. No ownership. |
| 68 ScreenshotDelegate* screenshot_delegate_; | 72 ScreenshotDelegate* screenshot_delegate_; |
| 69 | 73 |
| 70 DISALLOW_COPY_AND_ASSIGN(PartialScreenshotView); | 74 DISALLOW_COPY_AND_ASSIGN(PartialScreenshotView); |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 } // namespace ash | 77 } // namespace ash |
| 74 | 78 |
| 75 #endif // #ifndef ASH_WM_PARTIAL_SCREENSHOT_VIEW_H_ | 79 #endif // #ifndef ASH_WM_PARTIAL_SCREENSHOT_VIEW_H_ |
| OLD | NEW |