OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/display/screen.h" | 5 #include "ui/display/screen.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/display/display.h" | 9 #include "ui/display/display.h" |
10 #include "ui/gfx/android/device_display_info.h" | 10 #include "ui/gfx/android/device_display_info.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 Display GetDisplayNearestPoint(const gfx::Point& point) const override { | 60 Display GetDisplayNearestPoint(const gfx::Point& point) const override { |
61 return GetPrimaryDisplay(); | 61 return GetPrimaryDisplay(); |
62 } | 62 } |
63 | 63 |
64 int GetNumDisplays() const override { return 1; } | 64 int GetNumDisplays() const override { return 1; } |
65 | 65 |
66 std::vector<Display> GetAllDisplays() const override { | 66 std::vector<Display> GetAllDisplays() const override { |
67 return std::vector<Display>(1, GetPrimaryDisplay()); | 67 return std::vector<Display>(1, GetPrimaryDisplay()); |
68 } | 68 } |
69 | 69 |
70 bool GetDisplayWithDisplayId(int64_t display_id, | |
71 Display* display) const override { | |
72 Display primary_display = GetPrimaryDisplay(); | |
73 if (primary_display.id() == display_id) { | |
74 *display = primary_display; | |
75 return true; | |
76 } | |
sadrul
2016/09/30 03:17:14
You can probably just do:
if (display_id == 0) {
riajiang
2016/10/05 14:54:11
Done.
| |
77 return false; | |
78 } | |
79 | |
70 Display GetDisplayMatching(const gfx::Rect& match_rect) const override { | 80 Display GetDisplayMatching(const gfx::Rect& match_rect) const override { |
71 return GetPrimaryDisplay(); | 81 return GetPrimaryDisplay(); |
72 } | 82 } |
73 | 83 |
74 void AddObserver(DisplayObserver* observer) override { | 84 void AddObserver(DisplayObserver* observer) override { |
75 // no display change on Android. | 85 // no display change on Android. |
76 } | 86 } |
77 | 87 |
78 void RemoveObserver(DisplayObserver* observer) override { | 88 void RemoveObserver(DisplayObserver* observer) override { |
79 // no display change on Android. | 89 // no display change on Android. |
80 } | 90 } |
81 | 91 |
82 private: | 92 private: |
83 DISALLOW_COPY_AND_ASSIGN(ScreenAndroid); | 93 DISALLOW_COPY_AND_ASSIGN(ScreenAndroid); |
84 }; | 94 }; |
85 | 95 |
86 Screen* CreateNativeScreen() { | 96 Screen* CreateNativeScreen() { |
87 return new ScreenAndroid; | 97 return new ScreenAndroid; |
88 } | 98 } |
89 | 99 |
90 } // namespace display | 100 } // namespace display |
OLD | NEW |