| 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/resolution_notification_controller.h" | 10 #include "ash/display/resolution_notification_controller.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 } | 508 } |
| 509 | 509 |
| 510 return true; | 510 return true; |
| 511 } | 511 } |
| 512 | 512 |
| 513 bool DisplayInfoProviderChromeOS::SetDisplayLayout( | 513 bool DisplayInfoProviderChromeOS::SetDisplayLayout( |
| 514 const DisplayLayoutList& layouts) { | 514 const DisplayLayoutList& layouts) { |
| 515 display::DisplayManager* display_manager = | 515 display::DisplayManager* display_manager = |
| 516 ash::Shell::GetInstance()->display_manager(); | 516 ash::Shell::GetInstance()->display_manager(); |
| 517 display::DisplayLayoutBuilder builder( | 517 display::DisplayLayoutBuilder builder( |
| 518 display_manager->GetCurrentDisplayLayout()); | 518 display_manager->GetCurrentResolvedDisplayLayout()); |
| 519 | 519 |
| 520 bool have_root = false; | 520 bool have_root = false; |
| 521 builder.ClearPlacements(); | 521 builder.ClearPlacements(); |
| 522 for (const system_display::DisplayLayout& layout : layouts) { | 522 for (const system_display::DisplayLayout& layout : layouts) { |
| 523 display::Display display = GetDisplay(layout.id); | 523 display::Display display = GetDisplay(layout.id); |
| 524 if (display.id() == display::kInvalidDisplayId) { | 524 if (display.id() == display::kInvalidDisplayId) { |
| 525 LOG(ERROR) << "Invalid layout: display id not found: " << layout.id; | 525 LOG(ERROR) << "Invalid layout: display id not found: " << layout.id; |
| 526 return false; | 526 return false; |
| 527 } | 527 } |
| 528 display::Display parent = GetDisplay(layout.parent_id); | 528 display::Display parent = GetDisplay(layout.parent_id); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 619 |
| 620 if (display_manager->num_connected_displays() < 2) | 620 if (display_manager->num_connected_displays() < 2) |
| 621 return DisplayInfoProvider::DisplayLayoutList(); | 621 return DisplayInfoProvider::DisplayLayoutList(); |
| 622 | 622 |
| 623 display::Screen* screen = display::Screen::GetScreen(); | 623 display::Screen* screen = display::Screen::GetScreen(); |
| 624 std::vector<display::Display> displays = screen->GetAllDisplays(); | 624 std::vector<display::Display> displays = screen->GetAllDisplays(); |
| 625 | 625 |
| 626 DisplayLayoutList result; | 626 DisplayLayoutList result; |
| 627 for (const display::Display& display : displays) { | 627 for (const display::Display& display : displays) { |
| 628 const display::DisplayPlacement placement = | 628 const display::DisplayPlacement placement = |
| 629 display_manager->GetCurrentDisplayLayout().FindPlacementById( | 629 display_manager->GetCurrentResolvedDisplayLayout().FindPlacementById( |
| 630 display.id()); | 630 display.id()); |
| 631 if (placement.display_id == display::kInvalidDisplayId) | 631 if (placement.display_id == display::kInvalidDisplayId) |
| 632 continue; | 632 continue; |
| 633 system_display::DisplayLayout display_layout; | 633 system_display::DisplayLayout display_layout; |
| 634 display_layout.id = base::Int64ToString(placement.display_id); | 634 display_layout.id = base::Int64ToString(placement.display_id); |
| 635 display_layout.parent_id = base::Int64ToString(placement.parent_display_id); | 635 display_layout.parent_id = base::Int64ToString(placement.parent_display_id); |
| 636 display_layout.position = GetLayoutPosition(placement.position); | 636 display_layout.position = GetLayoutPosition(placement.position); |
| 637 display_layout.offset = placement.offset; | 637 display_layout.offset = placement.offset; |
| 638 result.push_back(std::move(display_layout)); | 638 result.push_back(std::move(display_layout)); |
| 639 } | 639 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 touch_calibrator_.reset(new chromeos::TouchCalibratorController); | 826 touch_calibrator_.reset(new chromeos::TouchCalibratorController); |
| 827 return touch_calibrator_.get(); | 827 return touch_calibrator_.get(); |
| 828 } | 828 } |
| 829 | 829 |
| 830 // static | 830 // static |
| 831 DisplayInfoProvider* DisplayInfoProvider::Create() { | 831 DisplayInfoProvider* DisplayInfoProvider::Create() { |
| 832 return new DisplayInfoProviderChromeOS(); | 832 return new DisplayInfoProviderChromeOS(); |
| 833 } | 833 } |
| 834 | 834 |
| 835 } // namespace extensions | 835 } // namespace extensions |
| OLD | NEW |