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

Side by Side Diff: extensions/browser/api/system_display/display_info_provider.cc

Issue 689223002: Don't assume gfx::Screen::GetNumDisplays() == GetAllDisplays().size(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/browser/api/system_display/display_info_provider.h" 5 #include "extensions/browser/api/system_display/display_info_provider.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "extensions/common/api/system_display.h" 8 #include "extensions/common/api/system_display.h"
9 #include "ui/gfx/display.h" 9 #include "ui/gfx/display.h"
10 #include "ui/gfx/screen.h" 10 #include "ui/gfx/screen.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 DCHECK(display_info_provider); 73 DCHECK(display_info_provider);
74 g_display_info_provider = display_info_provider; 74 g_display_info_provider = display_info_provider;
75 } 75 }
76 76
77 DisplayInfo DisplayInfoProvider::GetAllDisplaysInfo() { 77 DisplayInfo DisplayInfoProvider::GetAllDisplaysInfo() {
78 // TODO(scottmg): Native is wrong http://crbug.com/133312 78 // TODO(scottmg): Native is wrong http://crbug.com/133312
79 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); 79 gfx::Screen* screen = gfx::Screen::GetNativeScreen();
80 int64 primary_id = screen->GetPrimaryDisplay().id(); 80 int64 primary_id = screen->GetPrimaryDisplay().id();
81 std::vector<gfx::Display> displays = screen->GetAllDisplays(); 81 std::vector<gfx::Display> displays = screen->GetAllDisplays();
82 DisplayInfo all_displays; 82 DisplayInfo all_displays;
83 for (int i = 0; i < screen->GetNumDisplays(); ++i) { 83 for (const gfx::Display& display : displays) {
84 linked_ptr<core_api::system_display::DisplayUnitInfo> unit( 84 linked_ptr<core_api::system_display::DisplayUnitInfo> unit(
85 CreateDisplayUnitInfo(displays[i], primary_id)); 85 CreateDisplayUnitInfo(display, primary_id));
86 UpdateDisplayUnitInfoForPlatform(displays[i], unit.get()); 86 UpdateDisplayUnitInfoForPlatform(display, unit.get());
87 all_displays.push_back(unit); 87 all_displays.push_back(unit);
88 } 88 }
89 return all_displays; 89 return all_displays;
90 } 90 }
91 91
92 DisplayInfoProvider::DisplayInfoProvider() { 92 DisplayInfoProvider::DisplayInfoProvider() {
93 } 93 }
94 94
95 } // namespace extensions 95 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698