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

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

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « ash/touch/touchscreen_util.cc ('k') | ash/utility/partial_screenshot_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PARTIAL_SCREENSHOT_CONTROLLER_H_ 5 #ifndef ASH_UTILITY_PARTIAL_SCREENSHOT_CONTROLLER_H_
6 #define ASH_UTILITY_PARTIAL_SCREENSHOT_CONTROLLER_H_ 6 #define ASH_UTILITY_PARTIAL_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/shell_observer.h" 14 #include "ash/shell_observer.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "ui/display/display_observer.h"
16 #include "ui/events/event_handler.h" 17 #include "ui/events/event_handler.h"
17 #include "ui/gfx/display_observer.h"
18 #include "ui/gfx/geometry/point.h" 18 #include "ui/gfx/geometry/point.h"
19 19
20 namespace aura { 20 namespace aura {
21 class Window; 21 class Window;
22 } 22 }
23 23
24 namespace ui { 24 namespace ui {
25 class LocatedEvent; 25 class LocatedEvent;
26 } 26 }
27 27
28 namespace ash { 28 namespace ash {
29 class ScreenshotDelegate; 29 class ScreenshotDelegate;
30 30
31 // This class controls a session of taking partial screenshot, i.e.: drawing 31 // This class controls a session of taking partial screenshot, i.e.: drawing
32 // region rectangles during drag, and changing the mouse cursor to indicate 32 // region rectangles during drag, and changing the mouse cursor to indicate
33 // the current mode. 33 // the current mode.
34 // This class does not use aura::Window / views::Widget intentionally to avoid 34 // This class does not use aura::Window / views::Widget intentionally to avoid
35 // the conflicts of window manager features like mouse captures or window focus. 35 // the conflicts of window manager features like mouse captures or window focus.
36 class ASH_EXPORT PartialScreenshotController : public ui::EventHandler, 36 class ASH_EXPORT PartialScreenshotController : public ui::EventHandler,
37 public gfx::DisplayObserver { 37 public display::DisplayObserver {
38 public: 38 public:
39 PartialScreenshotController(); 39 PartialScreenshotController();
40 ~PartialScreenshotController() override; 40 ~PartialScreenshotController() override;
41 41
42 // Starts the UI for taking partial screenshot; dragging to select a region. 42 // Starts the UI for taking partial screenshot; dragging to select a region.
43 // PartialScreenshotController manage their own lifetime so caller must not 43 // PartialScreenshotController manage their own lifetime so caller must not
44 // delete the returned values. 44 // delete the returned values.
45 void StartPartialScreenshotSession(ScreenshotDelegate* screenshot_delegate); 45 void StartPartialScreenshotSession(ScreenshotDelegate* screenshot_delegate);
46 46
47 private: 47 private:
48 friend class PartialScreenshotControllerTest; 48 friend class PartialScreenshotControllerTest;
49 49
50 class ScopedCursorSetter; 50 class ScopedCursorSetter;
51 class PartialScreenshotLayer; 51 class PartialScreenshotLayer;
52 52
53 // Starts, ends, cancels, or updates the region selection. 53 // Starts, ends, cancels, or updates the region selection.
54 void MaybeStart(const ui::LocatedEvent& event); 54 void MaybeStart(const ui::LocatedEvent& event);
55 void Complete(); 55 void Complete();
56 void Cancel(); 56 void Cancel();
57 void Update(const ui::LocatedEvent& event); 57 void Update(const ui::LocatedEvent& event);
58 58
59 // ui::EventHandler: 59 // ui::EventHandler:
60 void OnKeyEvent(ui::KeyEvent* event) override; 60 void OnKeyEvent(ui::KeyEvent* event) override;
61 void OnMouseEvent(ui::MouseEvent* event) override; 61 void OnMouseEvent(ui::MouseEvent* event) override;
62 void OnTouchEvent(ui::TouchEvent* event) override; 62 void OnTouchEvent(ui::TouchEvent* event) override;
63 63
64 // gfx::DisplayObserver: 64 // display::DisplayObserver:
65 void OnDisplayAdded(const gfx::Display& new_display) override; 65 void OnDisplayAdded(const display::Display& new_display) override;
66 void OnDisplayRemoved(const gfx::Display& old_display) override; 66 void OnDisplayRemoved(const display::Display& old_display) override;
67 void OnDisplayMetricsChanged(const gfx::Display& display, 67 void OnDisplayMetricsChanged(const display::Display& display,
68 uint32_t changed_metrics) override; 68 uint32_t changed_metrics) override;
69 69
70 // The data to build the screenshot region. 70 // The data to build the screenshot region.
71 gfx::Point start_position_; 71 gfx::Point start_position_;
72 aura::Window* root_window_; 72 aura::Window* root_window_;
73 73
74 // Layers to create the visual effect of region selection. 74 // Layers to create the visual effect of region selection.
75 std::map<aura::Window*, PartialScreenshotLayer*> layers_; 75 std::map<aura::Window*, PartialScreenshotLayer*> layers_;
76 76
77 // The object to specify the crosshair cursor. 77 // The object to specify the crosshair cursor.
78 std::unique_ptr<ScopedCursorSetter> cursor_setter_; 78 std::unique_ptr<ScopedCursorSetter> cursor_setter_;
79 79
80 // ScreenshotDelegate to take the actual screenshot. No ownership. 80 // ScreenshotDelegate to take the actual screenshot. No ownership.
81 ScreenshotDelegate* screenshot_delegate_; 81 ScreenshotDelegate* screenshot_delegate_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(PartialScreenshotController); 83 DISALLOW_COPY_AND_ASSIGN(PartialScreenshotController);
84 }; 84 };
85 85
86 } // namespace ash 86 } // namespace ash
87 87
88 #endif // #ifndef ASH_WM_PARTIAL_SCREENSHOT_VIEW_H_ 88 #endif // #ifndef ASH_WM_PARTIAL_SCREENSHOT_VIEW_H_
OLDNEW
« no previous file with comments | « ash/touch/touchscreen_util.cc ('k') | ash/utility/partial_screenshot_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698