Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: ash/utility/screenshot_controller.h

Issue 2291913002: Allow the user to cancel the capture region action, and show its active status in the tray. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // delete the returned values. |draw_overlay_immediately| controls if the grey 47 // delete the returned values. |draw_overlay_immediately| controls if the grey
48 // overlay will be drawn immediately. If false, then the overlay will be drawn 48 // overlay will be drawn immediately. If false, then the overlay will be drawn
49 // only after the user has started creating the clipping rect for the 49 // only after the user has started creating the clipping rect for the
50 // screenshot. 50 // screenshot.
51 void StartPartialScreenshotSession(ScreenshotDelegate* screenshot_delegate, 51 void StartPartialScreenshotSession(ScreenshotDelegate* screenshot_delegate,
52 bool draw_overlay_immediately); 52 bool draw_overlay_immediately);
53 53
54 // Starts the UI for taking a window screenshot; 54 // Starts the UI for taking a window screenshot;
55 void StartWindowScreenshotSession(ScreenshotDelegate* screenshot_delegate); 55 void StartWindowScreenshotSession(ScreenshotDelegate* screenshot_delegate);
56 56
57 // Cancels any active screenshot session.
58 void CancelScreenshotSession();
59
57 // If set to true, then only events generated by a pen can be used to select 60 // If set to true, then only events generated by a pen can be used to select
58 // the area to take a screenshot of. This is reset to false after a screenshot 61 // the area to take a screenshot of. This is reset to false after a screenshot
59 // operation is completed. 62 // operation is completed.
60 void set_pen_events_only(bool pen_events_only) { 63 void set_pen_events_only(bool pen_events_only) {
61 pen_events_only_ = pen_events_only; 64 pen_events_only_ = pen_events_only;
62 } 65 }
63 bool pen_events_only() const { return pen_events_only_; } 66 bool pen_events_only() const { return pen_events_only_; }
64 67
65 private: 68 private:
66 enum Mode { 69 enum Mode {
67 NONE, 70 NONE,
68 PARTIAL, 71 PARTIAL,
69 WINDOW, 72 WINDOW,
70 }; 73 };
71 74
72 friend class ScreenshotControllerTest; 75 friend class ScreenshotControllerTest;
73 76
74 class ScopedCursorSetter; 77 class ScopedCursorSetter;
75 class ScreenshotLayer; 78 class ScreenshotLayer;
76 79
77 // Starts, ends, cancels, or updates the region selection. 80 // Starts, ends, cancels, or updates the region selection.
78 void MaybeStart(const ui::LocatedEvent& event); 81 void MaybeStart(const ui::LocatedEvent& event);
79 void CompleteWindowScreenshot(); 82 void CompleteWindowScreenshot();
80 void CompletePartialScreenshot(); 83 void CompletePartialScreenshot();
81 void Cancel();
82 void Update(const ui::LocatedEvent& event); 84 void Update(const ui::LocatedEvent& event);
83 void UpdateSelectedWindow(ui::LocatedEvent* event); 85 void UpdateSelectedWindow(ui::LocatedEvent* event);
84 void SetSelectedWindow(aura::Window* window); 86 void SetSelectedWindow(aura::Window* window);
85 87
86 // Returns true if the event should be processed. 88 // Returns true if the event should be processed.
87 bool ShouldProcessEvent(const ui::PointerDetails& pointer_details) const; 89 bool ShouldProcessEvent(const ui::PointerDetails& pointer_details) const;
88 90
89 // ui::EventHandler: 91 // ui::EventHandler:
90 void OnKeyEvent(ui::KeyEvent* event) override; 92 void OnKeyEvent(ui::KeyEvent* event) override;
91 void OnMouseEvent(ui::MouseEvent* event) override; 93 void OnMouseEvent(ui::MouseEvent* event) override;
(...skipping 29 matching lines...) Expand all
121 123
122 // ScreenshotDelegate to take the actual screenshot. No ownership. 124 // ScreenshotDelegate to take the actual screenshot. No ownership.
123 ScreenshotDelegate* screenshot_delegate_; 125 ScreenshotDelegate* screenshot_delegate_;
124 126
125 DISALLOW_COPY_AND_ASSIGN(ScreenshotController); 127 DISALLOW_COPY_AND_ASSIGN(ScreenshotController);
126 }; 128 };
127 129
128 } // namespace ash 130 } // namespace ash
129 131
130 #endif // ASH_UTILITY_SCREENSHOT_CONTROLLER_H_ 132 #endif // ASH_UTILITY_SCREENSHOT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698