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

Side by Side Diff: ui/gfx/screen_android.cc

Issue 854713003: More old files deletion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix tryjobs? Created 5 years, 11 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 | « ui/gfx/screen.cc ('k') | ui/gfx/screen_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/gfx/screen.h"
6
7 #include "base/logging.h"
8 #include "ui/gfx/android/device_display_info.h"
9 #include "ui/gfx/display.h"
10 #include "ui/gfx/size_conversions.h"
11
12 namespace gfx {
13
14 class ScreenAndroid : public Screen {
15 public:
16 ScreenAndroid() {}
17
18 virtual bool IsDIPEnabled() override { return true; }
19
20 virtual gfx::Point GetCursorScreenPoint() override { return gfx::Point(); }
21
22 virtual gfx::NativeWindow GetWindowUnderCursor() override {
23 NOTIMPLEMENTED();
24 return NULL;
25 }
26
27 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point)
28 override {
29 NOTIMPLEMENTED();
30 return NULL;
31 }
32
33 virtual gfx::Display GetPrimaryDisplay() const override {
34 gfx::DeviceDisplayInfo device_info;
35 const float device_scale_factor = device_info.GetDIPScale();
36 // Note: GetPhysicalDisplayWidth/Height() does not subtract window
37 // decorations etc. Use it instead of GetDisplayWidth/Height() when
38 // available.
39 const gfx::Rect bounds_in_pixels =
40 gfx::Rect(device_info.GetPhysicalDisplayWidth()
41 ? device_info.GetPhysicalDisplayWidth()
42 : device_info.GetDisplayWidth(),
43 device_info.GetPhysicalDisplayHeight()
44 ? device_info.GetPhysicalDisplayHeight()
45 : device_info.GetDisplayHeight());
46 const gfx::Rect bounds_in_dip =
47 gfx::Rect(gfx::ToCeiledSize(gfx::ScaleSize(
48 bounds_in_pixels.size(), 1.0f / device_scale_factor)));
49 gfx::Display display(0, bounds_in_dip);
50 if (!gfx::Display::HasForceDeviceScaleFactor())
51 display.set_device_scale_factor(device_scale_factor);
52 display.SetRotationAsDegree(device_info.GetRotationDegrees());
53 return display;
54 }
55
56 virtual gfx::Display GetDisplayNearestWindow(
57 gfx::NativeView view) const override {
58 return GetPrimaryDisplay();
59 }
60
61 virtual gfx::Display GetDisplayNearestPoint(
62 const gfx::Point& point) const override {
63 return GetPrimaryDisplay();
64 }
65
66 virtual int GetNumDisplays() const override { return 1; }
67
68 virtual std::vector<gfx::Display> GetAllDisplays() const override {
69 return std::vector<gfx::Display>(1, GetPrimaryDisplay());
70 }
71
72 virtual gfx::Display GetDisplayMatching(
73 const gfx::Rect& match_rect) const override {
74 return GetPrimaryDisplay();
75 }
76
77 virtual void AddObserver(DisplayObserver* observer) override {
78 // no display change on Android.
79 }
80
81 virtual void RemoveObserver(DisplayObserver* observer) override {
82 // no display change on Android.
83 }
84
85 private:
86 DISALLOW_COPY_AND_ASSIGN(ScreenAndroid);
87 };
88
89 Screen* CreateNativeScreen() {
90 return new ScreenAndroid;
91 }
92
93 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/screen.cc ('k') | ui/gfx/screen_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698