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

Side by Side Diff: headless/lib/browser/headless_screen.h

Issue 2669693002: Minimize headless code that refers to aura. (Closed)
Patch Set: Add aura dependencies in BUIL.gn only when use_aura == true" Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 HEADLESS_LIB_BROWSER_HEADLESS_SCREEN_H_ 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_SCREEN_H_
6 #define HEADLESS_LIB_BROWSER_HEADLESS_SCREEN_H_ 6 #define HEADLESS_LIB_BROWSER_HEADLESS_SCREEN_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "headless/lib/browser/headless_window_tree_host.h"
10 #include "ui/aura/window_observer.h" 11 #include "ui/aura/window_observer.h"
11 #include "ui/display/display.h" 12 #include "ui/display/display.h"
12 #include "ui/display/screen_base.h" 13 #include "ui/display/screen_base.h"
13 14
14 namespace gfx { 15 namespace gfx {
15 class Insets;
16 class Rect; 16 class Rect;
17 class Transform;
18 }
19
20 namespace aura {
21 class Window;
22 class WindowTreeHost;
23 } 17 }
24 18
25 namespace headless { 19 namespace headless {
26 20
27 class HeadlessScreen : public display::ScreenBase, public aura::WindowObserver { 21 class HeadlessScreen : public display::ScreenBase {
28 public: 22 public:
29 // Creates a display::Screen of the specified size (physical pixels). 23 // Creates a display::Screen of the specified size (physical pixels).
30 static HeadlessScreen* Create(const gfx::Size& size); 24 static HeadlessScreen* Create(const gfx::Size& size);
31 ~HeadlessScreen() override; 25 ~HeadlessScreen() override;
32 26
33 aura::WindowTreeHost* CreateHostForPrimaryDisplay();
34
35 void SetDeviceScaleFactor(float device_scale_fator);
36 void SetDisplayRotation(display::Display::Rotation rotation);
37 void SetUIScale(float ui_scale);
38 void SetWorkAreaInsets(const gfx::Insets& insets);
39
40 protected: 27 protected:
41 gfx::Transform GetRotationTransform() const;
42 gfx::Transform GetUIScaleTransform() const;
43
44 // WindowObserver overrides:
45 void OnWindowBoundsChanged(aura::Window* window,
46 const gfx::Rect& old_bounds,
47 const gfx::Rect& new_bounds) override;
48 void OnWindowDestroying(aura::Window* window) override;
49
50 // display::Screen overrides: 28 // display::Screen overrides:
51 gfx::Point GetCursorScreenPoint() override; 29 gfx::Point GetCursorScreenPoint() override;
52 bool IsWindowUnderCursor(gfx::NativeWindow window) override; 30 bool IsWindowUnderCursor(gfx::NativeWindow window) override;
53 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; 31 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
54 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override; 32 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override;
55 33
56 private: 34 private:
57 explicit HeadlessScreen(const gfx::Rect& screen_bounds); 35 explicit HeadlessScreen(const gfx::Rect& screen_bounds);
58 36
59 aura::WindowTreeHost* host_;
60 float ui_scale_;
61
62 DISALLOW_COPY_AND_ASSIGN(HeadlessScreen); 37 DISALLOW_COPY_AND_ASSIGN(HeadlessScreen);
63 }; 38 };
64 39
65 } // namespace headless 40 } // namespace headless
66 41
67 #endif // HEADLESS_LIB_BROWSER_HEADLESS_SCREEN_H_ 42 #endif // HEADLESS_LIB_BROWSER_HEADLESS_SCREEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698