| 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" |
| 11 #include "ash/display/screen_orientation_controller_chromeos.h" | 11 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/touch/ash_touch_transform_controller.h" | 13 #include "ash/touch/ash_touch_transform_controller.h" |
| 14 #include "ash/wm/tablet_mode/tablet_mode_controller.h" | 14 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "chrome/browser/chromeos/display/display_preferences.h" | 16 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 17 #include "chrome/browser/chromeos/display/overscan_calibrator.h" | 17 #include "chrome/browser/chromeos/display/overscan_calibrator.h" |
| 18 #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_cont
roller.h" | 18 #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_cont
roller.h" |
| 19 #include "chrome/browser/ui/ash/ash_util.h" | 19 #include "chrome/browser/ui/ash/ash_util.h" |
| 20 #include "extensions/common/api/system_display.h" | 20 #include "extensions/common/api/system_display.h" |
| 21 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
| 22 #include "ui/display/display_layout.h" | 22 #include "ui/display/display_layout.h" |
| 23 #include "ui/display/display_layout_builder.h" | 23 #include "ui/display/display_layout_builder.h" |
| 24 #include "ui/display/manager/display_manager.h" | 24 #include "ui/display/manager/display_manager.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 413 } |
| 414 | 414 |
| 415 if (display.touch_support() != display::Display::TOUCH_SUPPORT_AVAILABLE) { | 415 if (display.touch_support() != display::Display::TOUCH_SUPPORT_AVAILABLE) { |
| 416 *error = "Display Id(" + id + ") does not support touch."; | 416 *error = "Display Id(" + id + ") does not support touch."; |
| 417 return false; | 417 return false; |
| 418 } | 418 } |
| 419 | 419 |
| 420 return true; | 420 return true; |
| 421 } | 421 } |
| 422 | 422 |
| 423 bool IsTabletModeWindowManagerEnabled() { | 423 bool IsMaximizeModeWindowManagerEnabled() { |
| 424 return ash::Shell::Get() | 424 return ash::Shell::Get() |
| 425 ->tablet_mode_controller() | 425 ->maximize_mode_controller() |
| 426 ->IsTabletModeWindowManagerEnabled(); | 426 ->IsMaximizeModeWindowManagerEnabled(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace | 429 } // namespace |
| 430 | 430 |
| 431 // static | 431 // static |
| 432 const char | 432 const char |
| 433 DisplayInfoProviderChromeOS::kCustomTouchCalibrationInProgressError[] = | 433 DisplayInfoProviderChromeOS::kCustomTouchCalibrationInProgressError[] = |
| 434 "Another custom touch calibration already under progress."; | 434 "Another custom touch calibration already under progress."; |
| 435 | 435 |
| 436 // static | 436 // static |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 | 510 |
| 511 // Process 'overscan' parameter. | 511 // Process 'overscan' parameter. |
| 512 if (info.overscan) { | 512 if (info.overscan) { |
| 513 display_manager->SetOverscanInsets( | 513 display_manager->SetOverscanInsets( |
| 514 display_id, gfx::Insets(info.overscan->top, info.overscan->left, | 514 display_id, gfx::Insets(info.overscan->top, info.overscan->left, |
| 515 info.overscan->bottom, info.overscan->right)); | 515 info.overscan->bottom, info.overscan->right)); |
| 516 } | 516 } |
| 517 | 517 |
| 518 // Process 'rotation' parameter. | 518 // Process 'rotation' parameter. |
| 519 if (info.rotation) { | 519 if (info.rotation) { |
| 520 if (IsTabletModeWindowManagerEnabled() && | 520 if (IsMaximizeModeWindowManagerEnabled() && |
| 521 display_id == display::Display::InternalDisplayId()) { | 521 display_id == display::Display::InternalDisplayId()) { |
| 522 ash::Shell::Get()->screen_orientation_controller()->SetLockToRotation( | 522 ash::Shell::Get()->screen_orientation_controller()->SetLockToRotation( |
| 523 DegreesToRotation(*info.rotation)); | 523 DegreesToRotation(*info.rotation)); |
| 524 } else { | 524 } else { |
| 525 display_configuration_controller->SetDisplayRotation( | 525 display_configuration_controller->SetDisplayRotation( |
| 526 display_id, DegreesToRotation(*info.rotation), | 526 display_id, DegreesToRotation(*info.rotation), |
| 527 display::Display::ROTATION_SOURCE_ACTIVE); | 527 display::Display::ROTATION_SOURCE_ACTIVE); |
| 528 } | 528 } |
| 529 } | 529 } |
| 530 | 530 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 touch_calibrator_.reset(new chromeos::TouchCalibratorController); | 919 touch_calibrator_.reset(new chromeos::TouchCalibratorController); |
| 920 return touch_calibrator_.get(); | 920 return touch_calibrator_.get(); |
| 921 } | 921 } |
| 922 | 922 |
| 923 // static | 923 // static |
| 924 DisplayInfoProvider* DisplayInfoProvider::Create() { | 924 DisplayInfoProvider* DisplayInfoProvider::Create() { |
| 925 return new DisplayInfoProviderChromeOS(); | 925 return new DisplayInfoProviderChromeOS(); |
| 926 } | 926 } |
| 927 | 927 |
| 928 } // namespace extensions | 928 } // namespace extensions |
| OLD | NEW |