OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/extensions/display_info_provider_chromeos.h" | 5 #include "chrome/browser/extensions/display_info_provider_chromeos.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "ash/display/display_configuration_controller.h" | 9 #include "ash/display/display_configuration_controller.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 all_displays.push_back(std::move(unit)); | 548 all_displays.push_back(std::move(unit)); |
549 } | 549 } |
550 return all_displays; | 550 return all_displays; |
551 } | 551 } |
552 | 552 |
553 DisplayInfoProvider::DisplayLayoutList | 553 DisplayInfoProvider::DisplayLayoutList |
554 DisplayInfoProviderChromeOS::GetDisplayLayout() { | 554 DisplayInfoProviderChromeOS::GetDisplayLayout() { |
555 ash::DisplayManager* display_manager = | 555 ash::DisplayManager* display_manager = |
556 ash::Shell::GetInstance()->display_manager(); | 556 ash::Shell::GetInstance()->display_manager(); |
557 | 557 |
| 558 if (display_manager->num_connected_displays() < 2) |
| 559 return DisplayInfoProvider::DisplayLayoutList(); |
| 560 |
558 display::Screen* screen = display::Screen::GetScreen(); | 561 display::Screen* screen = display::Screen::GetScreen(); |
559 std::vector<display::Display> displays = screen->GetAllDisplays(); | 562 std::vector<display::Display> displays = screen->GetAllDisplays(); |
560 | 563 |
561 DisplayLayoutList result; | 564 DisplayLayoutList result; |
562 for (const display::Display& display : displays) { | 565 for (const display::Display& display : displays) { |
563 const display::DisplayPlacement placement = | 566 const display::DisplayPlacement placement = |
564 display_manager->GetCurrentDisplayLayout().FindPlacementById( | 567 display_manager->GetCurrentDisplayLayout().FindPlacementById( |
565 display.id()); | 568 display.id()); |
566 if (placement.display_id == display::Display::kInvalidDisplayID) | 569 if (placement.display_id == display::Display::kInvalidDisplayID) |
567 continue; | 570 continue; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 return nullptr; | 633 return nullptr; |
631 return iter->second.get(); | 634 return iter->second.get(); |
632 } | 635 } |
633 | 636 |
634 // static | 637 // static |
635 DisplayInfoProvider* DisplayInfoProvider::Create() { | 638 DisplayInfoProvider* DisplayInfoProvider::Create() { |
636 return new DisplayInfoProviderChromeOS(); | 639 return new DisplayInfoProviderChromeOS(); |
637 } | 640 } |
638 | 641 |
639 } // namespace extensions | 642 } // namespace extensions |
OLD | NEW |