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

Unified Diff: ash/display/screen_ash.cc

Issue 2361283002: Add GetDisplayWithDisplayId to display::Screen. (Closed)
Patch Set: test 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/screen_ash.cc
diff --git a/ash/display/screen_ash.cc b/ash/display/screen_ash.cc
index e91811af93d00301a090a705eca6a3b074d26378..8bcf74c968d9e5a3b6441e691f819b70c3ab264f 100644
--- a/ash/display/screen_ash.cc
+++ b/ash/display/screen_ash.cc
@@ -48,6 +48,16 @@ class ScreenForShutdown : public display::Screen {
std::vector<display::Display> GetAllDisplays() const override {
return display_list_;
}
+ bool GetDisplayWithDisplayId(int64_t display_id,
+ display::Display* display) const override {
+ for (display::Display display_in_list : display_list_) {
sadrul 2016/09/23 19:51:12 const&
riajiang 2016/10/05 14:54:11 Done.
+ if (display_in_list.id() == display_id) {
+ *display = display_in_list;
+ return true;
+ }
+ }
+ return false;
+ }
display::Display GetDisplayNearestWindow(
gfx::NativeView view) const override {
return primary_display_;
@@ -114,6 +124,17 @@ std::vector<display::Display> ScreenAsh::GetAllDisplays() const {
return GetDisplayManager()->active_display_list();
}
+bool ScreenAsh::GetDisplayWithDisplayId(int64_t display_id,
+ display::Display* display) const {
+ for (display::Display display_in_list : GetAllDisplays()) {
sadrul 2016/09/23 19:51:12 GetAllDisplays() makes a copy of the list. It'd be
riajiang 2016/10/05 14:54:11 I see. Done.
+ if (display_in_list.id() == display_id) {
+ *display = display_in_list;
+ return true;
+ }
+ }
+ return false;
+}
+
display::Display ScreenAsh::GetDisplayNearestWindow(
gfx::NativeView window) const {
if (!window)

Powered by Google App Engine
This is Rietveld 408576698