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

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: 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();
635 if (!display_manager->IsInUnifiedMode()) 638 if (!display_manager->IsInUnifiedMode())
636 return DisplayInfoProvider::GetAllDisplaysInfo(); 639 return DisplayInfoProvider::GetAllDisplaysInfo();
637 640
638 std::vector<display::Display> displays = 641 // Chrome OS specific: get displays for unified mode.
639 display_manager->software_mirroring_display_list(); 642 std::vector<display::Display> displays;
640 CHECK_GT(displays.size(), 0u); 643 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i)
644 displays.push_back(display_manager->GetDisplayAt(i));
641 645
642 // Use first display as primary. 646 int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
643 int64_t primary_id = displays[0].id();
644 DisplayUnitInfoList all_displays; 647 DisplayUnitInfoList all_displays;
645 for (const display::Display& display : displays) { 648 for (const display::Display& display : displays) {
646 system_display::DisplayUnitInfo unit = 649 system_display::DisplayUnitInfo unit_info =
647 CreateDisplayUnitInfo(display, primary_id); 650 CreateDisplayUnitInfo(display, primary_id);
648 UpdateDisplayUnitInfoForPlatform(display, &unit); 651 UpdateDisplayUnitInfoForPlatform(display, &unit_info);
649 all_displays.push_back(std::move(unit)); 652 unit_info.is_unified = true;
xiyuan 2017/04/05 21:41:45 Can you document why we are doing this? I was puzz
stevenjb 2017/04/06 01:56:08 That was the intent of the comment at line 641 :)
653 all_displays.push_back(std::move(unit_info));
650 } 654 }
651 return all_displays; 655 return all_displays;
652 } 656 }
653 657
654 DisplayInfoProvider::DisplayLayoutList 658 DisplayInfoProvider::DisplayLayoutList
655 DisplayInfoProviderChromeOS::GetDisplayLayout() { 659 DisplayInfoProviderChromeOS::GetDisplayLayout() {
656 if (ash_util::IsRunningInMash()) { 660 if (ash_util::IsRunningInMash()) {
657 // TODO(crbug.com/682402): Mash support. 661 // TODO(crbug.com/682402): Mash support.
658 NOTIMPLEMENTED(); 662 NOTIMPLEMENTED();
659 return DisplayInfoProvider::DisplayLayoutList(); 663 return DisplayInfoProvider::DisplayLayoutList();
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 touch_calibrator_.reset(new chromeos::TouchCalibratorController); 900 touch_calibrator_.reset(new chromeos::TouchCalibratorController);
897 return touch_calibrator_.get(); 901 return touch_calibrator_.get();
898 } 902 }
899 903
900 // static 904 // static
901 DisplayInfoProvider* DisplayInfoProvider::Create() { 905 DisplayInfoProvider* DisplayInfoProvider::Create() {
902 return new DisplayInfoProviderChromeOS(); 906 return new DisplayInfoProviderChromeOS();
903 } 907 }
904 908
905 } // namespace extensions 909 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698