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