| 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 or cancelled. This is reset after the screenshot session is |
| 63 // done. |
| 64 void set_on_screenshot_session_done(const base::Closure& on_done) { |
| 65 on_screenshot_session_done_ = on_done; |
| 66 } |
| 67 |
| 60 // If set to true, then only events generated by a pen can be used to select | 68 // 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 | 69 // the area to take a screenshot of. This is reset to false after a screenshot |
| 62 // operation is completed. | 70 // operation is completed. |
| 63 void set_pen_events_only(bool pen_events_only) { | 71 void set_pen_events_only(bool pen_events_only) { |
| 64 pen_events_only_ = pen_events_only; | 72 pen_events_only_ = pen_events_only; |
| 65 } | 73 } |
| 66 bool pen_events_only() const { return pen_events_only_; } | 74 bool pen_events_only() const { return pen_events_only_; } |
| 67 | 75 |
| 68 private: | 76 private: |
| 69 enum Mode { | 77 enum Mode { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 109 |
| 102 // aura::WindowObserver: | 110 // aura::WindowObserver: |
| 103 void OnWindowDestroying(aura::Window* window) override; | 111 void OnWindowDestroying(aura::Window* window) override; |
| 104 | 112 |
| 105 Mode mode_; | 113 Mode mode_; |
| 106 | 114 |
| 107 // If true, then only pointer events will be used when selecting the | 115 // If true, then only pointer events will be used when selecting the |
| 108 // screenshot region. | 116 // screenshot region. |
| 109 bool pen_events_only_ = false; | 117 bool pen_events_only_ = false; |
| 110 | 118 |
| 119 base::Closure on_screenshot_session_done_; |
| 120 |
| 111 // The data to build the screenshot region. | 121 // The data to build the screenshot region. |
| 112 gfx::Point start_position_; | 122 gfx::Point start_position_; |
| 113 aura::Window* root_window_; | 123 aura::Window* root_window_; |
| 114 | 124 |
| 115 // Currently selected window in WINDOW mode. | 125 // Currently selected window in WINDOW mode. |
| 116 aura::Window* selected_; | 126 aura::Window* selected_; |
| 117 | 127 |
| 118 // Layers to create the visual effect of region selection or selected window. | 128 // Layers to create the visual effect of region selection or selected window. |
| 119 std::map<aura::Window*, ScreenshotLayer*> layers_; | 129 std::map<aura::Window*, ScreenshotLayer*> layers_; |
| 120 | 130 |
| 121 // The object to specify the crosshair cursor. | 131 // The object to specify the crosshair cursor. |
| 122 std::unique_ptr<ScopedCursorSetter> cursor_setter_; | 132 std::unique_ptr<ScopedCursorSetter> cursor_setter_; |
| 123 | 133 |
| 124 // ScreenshotDelegate to take the actual screenshot. No ownership. | 134 // ScreenshotDelegate to take the actual screenshot. No ownership. |
| 125 ScreenshotDelegate* screenshot_delegate_; | 135 ScreenshotDelegate* screenshot_delegate_; |
| 126 | 136 |
| 127 DISALLOW_COPY_AND_ASSIGN(ScreenshotController); | 137 DISALLOW_COPY_AND_ASSIGN(ScreenshotController); |
| 128 }; | 138 }; |
| 129 | 139 |
| 130 } // namespace ash | 140 } // namespace ash |
| 131 | 141 |
| 132 #endif // ASH_UTILITY_SCREENSHOT_CONTROLLER_H_ | 142 #endif // ASH_UTILITY_SCREENSHOT_CONTROLLER_H_ |
| OLD | NEW |