OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UTILITY_SCREENSHOT_CONTROLLER_H_ | 5 #ifndef ASH_UTILITY_SCREENSHOT_CONTROLLER_H_ |
6 #define ASH_UTILITY_SCREENSHOT_CONTROLLER_H_ | 6 #define ASH_UTILITY_SCREENSHOT_CONTROLLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "ash/ash_export.h" | 13 #include "ash/ash_export.h" |
14 #include "ash/common/shell_observer.h" | 14 #include "ash/common/shell_observer.h" |
15 #include "base/callback.h" | |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
17 #include "ui/display/display_observer.h" | 18 #include "ui/display/display_observer.h" |
18 #include "ui/events/event_handler.h" | 19 #include "ui/events/event_handler.h" |
19 #include "ui/gfx/geometry/point.h" | 20 #include "ui/gfx/geometry/point.h" |
20 | 21 |
21 namespace aura { | 22 namespace aura { |
22 class Window; | 23 class Window; |
23 } | 24 } |
24 | 25 |
(...skipping 25 matching lines...) Expand all Loading... | |
50 // screenshot. | 51 // screenshot. |
51 void StartPartialScreenshotSession(ScreenshotDelegate* screenshot_delegate, | 52 void StartPartialScreenshotSession(ScreenshotDelegate* screenshot_delegate, |
52 bool draw_overlay_immediately); | 53 bool draw_overlay_immediately); |
53 | 54 |
54 // Starts the UI for taking a window screenshot; | 55 // Starts the UI for taking a window screenshot; |
55 void StartWindowScreenshotSession(ScreenshotDelegate* screenshot_delegate); | 56 void StartWindowScreenshotSession(ScreenshotDelegate* screenshot_delegate); |
56 | 57 |
57 // Cancels any active screenshot session. | 58 // Cancels any active screenshot session. |
58 void CancelScreenshotSession(); | 59 void CancelScreenshotSession(); |
59 | 60 |
61 // Set a function that will be called when the current screenshot session has | |
62 // been completed. This is reset after the screenshot session is done. | |
oshima
2016/09/16 20:42:25
Can you update the comment and mention that this i
jdufault
2016/09/16 22:58:05
Done.
| |
63 void set_on_screenshot_session_done(const base::Closure& on_done) { | |
64 on_screenshot_session_done_ = on_done; | |
65 } | |
66 | |
60 // If set to true, then only events generated by a pen can be used to select | 67 // If set to true, then only events generated by a pen can be used to select |
61 // the area to take a screenshot of. This is reset to false after a screenshot | 68 // the area to take a screenshot of. This is reset to false after a screenshot |
62 // operation is completed. | 69 // operation is completed. |
63 void set_pen_events_only(bool pen_events_only) { | 70 void set_pen_events_only(bool pen_events_only) { |
64 pen_events_only_ = pen_events_only; | 71 pen_events_only_ = pen_events_only; |
65 } | 72 } |
66 bool pen_events_only() const { return pen_events_only_; } | 73 bool pen_events_only() const { return pen_events_only_; } |
67 | 74 |
68 private: | 75 private: |
69 enum Mode { | 76 enum Mode { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 108 |
102 // aura::WindowObserver: | 109 // aura::WindowObserver: |
103 void OnWindowDestroying(aura::Window* window) override; | 110 void OnWindowDestroying(aura::Window* window) override; |
104 | 111 |
105 Mode mode_; | 112 Mode mode_; |
106 | 113 |
107 // If true, then only pointer events will be used when selecting the | 114 // If true, then only pointer events will be used when selecting the |
108 // screenshot region. | 115 // screenshot region. |
109 bool pen_events_only_ = false; | 116 bool pen_events_only_ = false; |
110 | 117 |
118 base::Closure on_screenshot_session_done_; | |
119 | |
111 // The data to build the screenshot region. | 120 // The data to build the screenshot region. |
112 gfx::Point start_position_; | 121 gfx::Point start_position_; |
113 aura::Window* root_window_; | 122 aura::Window* root_window_; |
114 | 123 |
115 // Currently selected window in WINDOW mode. | 124 // Currently selected window in WINDOW mode. |
116 aura::Window* selected_; | 125 aura::Window* selected_; |
117 | 126 |
118 // Layers to create the visual effect of region selection or selected window. | 127 // Layers to create the visual effect of region selection or selected window. |
119 std::map<aura::Window*, ScreenshotLayer*> layers_; | 128 std::map<aura::Window*, ScreenshotLayer*> layers_; |
120 | 129 |
121 // The object to specify the crosshair cursor. | 130 // The object to specify the crosshair cursor. |
122 std::unique_ptr<ScopedCursorSetter> cursor_setter_; | 131 std::unique_ptr<ScopedCursorSetter> cursor_setter_; |
123 | 132 |
124 // ScreenshotDelegate to take the actual screenshot. No ownership. | 133 // ScreenshotDelegate to take the actual screenshot. No ownership. |
125 ScreenshotDelegate* screenshot_delegate_; | 134 ScreenshotDelegate* screenshot_delegate_; |
126 | 135 |
127 DISALLOW_COPY_AND_ASSIGN(ScreenshotController); | 136 DISALLOW_COPY_AND_ASSIGN(ScreenshotController); |
128 }; | 137 }; |
129 | 138 |
130 } // namespace ash | 139 } // namespace ash |
131 | 140 |
132 #endif // ASH_UTILITY_SCREENSHOT_CONTROLLER_H_ | 141 #endif // ASH_UTILITY_SCREENSHOT_CONTROLLER_H_ |
OLD | NEW |