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

Side by Side Diff: chrome/browser/extensions/display_info_provider_chromeos.cc

Issue 2802603005: MD Settings: Display: Add unified desktop control and modify api (Closed)
Patch Set: Feedback Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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/common/wm/maximize_mode/maximize_mode_controller.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
10 #include "ash/display/display_configuration_controller.h" 10 #include "ash/display/display_configuration_controller.h"
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 GetDisplayMode(display_manager, display_info, display_mode)); 612 GetDisplayMode(display_manager, display_info, display_mode));
613 } 613 }
614 } 614 }
615 615
616 void DisplayInfoProviderChromeOS::EnableUnifiedDesktop(bool enable) { 616 void DisplayInfoProviderChromeOS::EnableUnifiedDesktop(bool enable) {
617 if (ash_util::IsRunningInMash()) { 617 if (ash_util::IsRunningInMash()) {
618 // TODO(crbug.com/682402): Mash support. 618 // TODO(crbug.com/682402): Mash support.
619 NOTIMPLEMENTED(); 619 NOTIMPLEMENTED();
620 return; 620 return;
621 } 621 }
622 ash::Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled( 622 ash::Shell::GetInstance()
623 enable); 623 ->display_manager()
624 ->SetDefaultMultiDisplayModeForCurrentDisplays(
625 enable ? display::DisplayManager::UNIFIED
626 : display::DisplayManager::EXTENDED);
624 } 627 }
625 628
626 DisplayInfoProvider::DisplayUnitInfoList 629 DisplayInfoProvider::DisplayUnitInfoList
627 DisplayInfoProviderChromeOS::GetAllDisplaysInfo() { 630 DisplayInfoProviderChromeOS::GetAllDisplaysInfo() {
628 if (ash_util::IsRunningInMash()) { 631 if (ash_util::IsRunningInMash()) {
629 // TODO(crbug.com/682402): Mash support. 632 // TODO(crbug.com/682402): Mash support.
630 NOTIMPLEMENTED(); 633 NOTIMPLEMENTED();
631 return DisplayInfoProvider::DisplayUnitInfoList(); 634 return DisplayInfoProvider::DisplayUnitInfoList();
632 } 635 }
633 display::DisplayManager* display_manager = 636 display::DisplayManager* display_manager =
634 ash::Shell::GetInstance()->display_manager(); 637 ash::Shell::GetInstance()->display_manager();
638
635 if (!display_manager->IsInUnifiedMode()) 639 if (!display_manager->IsInUnifiedMode())
636 return DisplayInfoProvider::GetAllDisplaysInfo(); 640 return DisplayInfoProvider::GetAllDisplaysInfo();
637 641
638 std::vector<display::Display> displays = 642 // Chrome OS specific: get displays for unified mode.
639 display_manager->software_mirroring_display_list(); 643 std::vector<display::Display> displays;
640 CHECK_GT(displays.size(), 0u); 644 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i)
645 displays.push_back(display_manager->GetDisplayAt(i));
641 646
642 // Use first display as primary. 647 int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
643 int64_t primary_id = displays[0].id();
644 DisplayUnitInfoList all_displays; 648 DisplayUnitInfoList all_displays;
645 for (const display::Display& display : displays) { 649 for (const display::Display& display : displays) {
646 system_display::DisplayUnitInfo unit = 650 system_display::DisplayUnitInfo unit_info =
647 CreateDisplayUnitInfo(display, primary_id); 651 CreateDisplayUnitInfo(display, primary_id);
648 UpdateDisplayUnitInfoForPlatform(display, &unit); 652 UpdateDisplayUnitInfoForPlatform(display, &unit_info);
649 all_displays.push_back(std::move(unit)); 653 unit_info.is_unified = true;
654 all_displays.push_back(std::move(unit_info));
650 } 655 }
651 return all_displays; 656 return all_displays;
652 } 657 }
653 658
654 DisplayInfoProvider::DisplayLayoutList 659 DisplayInfoProvider::DisplayLayoutList
655 DisplayInfoProviderChromeOS::GetDisplayLayout() { 660 DisplayInfoProviderChromeOS::GetDisplayLayout() {
656 if (ash_util::IsRunningInMash()) { 661 if (ash_util::IsRunningInMash()) {
657 // TODO(crbug.com/682402): Mash support. 662 // TODO(crbug.com/682402): Mash support.
658 NOTIMPLEMENTED(); 663 NOTIMPLEMENTED();
659 return DisplayInfoProvider::DisplayLayoutList(); 664 return DisplayInfoProvider::DisplayLayoutList();
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 touch_calibrator_.reset(new chromeos::TouchCalibratorController); 901 touch_calibrator_.reset(new chromeos::TouchCalibratorController);
897 return touch_calibrator_.get(); 902 return touch_calibrator_.get();
898 } 903 }
899 904
900 // static 905 // static
901 DisplayInfoProvider* DisplayInfoProvider::Create() { 906 DisplayInfoProvider* DisplayInfoProvider::Create() {
902 return new DisplayInfoProviderChromeOS(); 907 return new DisplayInfoProviderChromeOS();
903 } 908 }
904 909
905 } // namespace extensions 910 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698