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

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

Issue 2824843002: MD Settings: Display: Disable orientaiton control in tablet mode (Closed)
Patch Set: Add test and trigger onDisplayChanged 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
« no previous file with comments | « ash/shell.cc ('k') | chrome/browser/extensions/display_info_provider_chromeos_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 ash::Shell::Get()->display_manager()->SetUnifiedDesktopEnabled(enable); 638 ash::Shell::Get()->display_manager()->SetUnifiedDesktopEnabled(enable);
639 } 639 }
640 640
641 DisplayInfoProvider::DisplayUnitInfoList 641 DisplayInfoProvider::DisplayUnitInfoList
642 DisplayInfoProviderChromeOS::GetAllDisplaysInfo(bool single_unified) { 642 DisplayInfoProviderChromeOS::GetAllDisplaysInfo(bool single_unified) {
643 if (ash_util::IsRunningInMash()) { 643 if (ash_util::IsRunningInMash()) {
644 // TODO(crbug.com/682402): Mash support. 644 // TODO(crbug.com/682402): Mash support.
645 NOTIMPLEMENTED(); 645 NOTIMPLEMENTED();
646 return DisplayInfoProvider::DisplayUnitInfoList(); 646 return DisplayInfoProvider::DisplayUnitInfoList();
647 } 647 }
648 DisplayUnitInfoList all_displays;
649
648 display::DisplayManager* display_manager = 650 display::DisplayManager* display_manager =
649 ash::Shell::Get()->display_manager(); 651 ash::Shell::Get()->display_manager();
650 652
651 if (!display_manager->IsInUnifiedMode()) 653 if (!display_manager->IsInUnifiedMode()) {
652 return DisplayInfoProvider::GetAllDisplaysInfo(single_unified); 654 all_displays = DisplayInfoProvider::GetAllDisplaysInfo(single_unified);
655 if (IsMaximizeModeWindowManagerEnabled()) {
656 // Set is_maximize_mode for the primary display.
657 for (auto& display : all_displays) {
658 if (display.is_primary) {
659 display.is_maximize_mode = base::MakeUnique<bool>(true);
660 break;
661 }
662 }
663 }
664 return all_displays;
665 }
653 666
654 // Chrome OS specific: get displays for unified mode. 667 // Chrome OS specific: get displays for unified mode.
655 std::vector<display::Display> displays; 668 std::vector<display::Display> displays;
656 int64_t primary_id; 669 int64_t primary_id;
657 if (single_unified) { 670 if (single_unified) {
658 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) 671 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i)
659 displays.push_back(display_manager->GetDisplayAt(i)); 672 displays.push_back(display_manager->GetDisplayAt(i));
660 primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); 673 primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
661 } else { 674 } else {
662 displays = display_manager->software_mirroring_display_list(); 675 displays = display_manager->software_mirroring_display_list();
663 CHECK_GT(displays.size(), 0u); 676 CHECK_GT(displays.size(), 0u);
664 // Use first display as primary. 677 // Use first display as primary.
665 primary_id = displays[0].id(); 678 primary_id = displays[0].id();
666 } 679 }
667 680
668 DisplayUnitInfoList all_displays;
669 for (const display::Display& display : displays) { 681 for (const display::Display& display : displays) {
670 system_display::DisplayUnitInfo unit_info = 682 system_display::DisplayUnitInfo unit_info =
671 CreateDisplayUnitInfo(display, primary_id); 683 CreateDisplayUnitInfo(display, primary_id);
672 UpdateDisplayUnitInfoForPlatform(display, &unit_info); 684 UpdateDisplayUnitInfoForPlatform(display, &unit_info);
673 unit_info.is_unified = true; 685 unit_info.is_unified = true;
674 all_displays.push_back(std::move(unit_info)); 686 all_displays.push_back(std::move(unit_info));
675 } 687 }
676 return all_displays; 688 return all_displays;
677 } 689 }
678 690
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 touch_calibrator_.reset(new chromeos::TouchCalibratorController); 931 touch_calibrator_.reset(new chromeos::TouchCalibratorController);
920 return touch_calibrator_.get(); 932 return touch_calibrator_.get();
921 } 933 }
922 934
923 // static 935 // static
924 DisplayInfoProvider* DisplayInfoProvider::Create() { 936 DisplayInfoProvider* DisplayInfoProvider::Create() {
925 return new DisplayInfoProviderChromeOS(); 937 return new DisplayInfoProviderChromeOS();
926 } 938 }
927 939
928 } // namespace extensions 940 } // namespace extensions
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | chrome/browser/extensions/display_info_provider_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698