| 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/common/wm/maximize_mode/maximize_mode_controller.h" |
| 9 #include "ash/display/display_configuration_controller.h" | 10 #include "ash/display/display_configuration_controller.h" |
| 10 #include "ash/display/resolution_notification_controller.h" | 11 #include "ash/display/resolution_notification_controller.h" |
| 12 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 11 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 12 #include "ash/touch/ash_touch_transform_controller.h" | 14 #include "ash/touch/ash_touch_transform_controller.h" |
| 13 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 14 #include "chrome/browser/chromeos/display/display_preferences.h" | 16 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 15 #include "chrome/browser/chromeos/display/overscan_calibrator.h" | 17 #include "chrome/browser/chromeos/display/overscan_calibrator.h" |
| 16 #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" |
| 17 #include "chrome/browser/ui/ash/ash_util.h" | 19 #include "chrome/browser/ui/ash/ash_util.h" |
| 18 #include "extensions/common/api/system_display.h" | 20 #include "extensions/common/api/system_display.h" |
| 19 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
| 20 #include "ui/display/display_layout.h" | 22 #include "ui/display/display_layout.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } | 403 } |
| 402 | 404 |
| 403 if (display.touch_support() != display::Display::TOUCH_SUPPORT_AVAILABLE) { | 405 if (display.touch_support() != display::Display::TOUCH_SUPPORT_AVAILABLE) { |
| 404 *error = "Display Id(" + id + ") does not support touch."; | 406 *error = "Display Id(" + id + ") does not support touch."; |
| 405 return false; | 407 return false; |
| 406 } | 408 } |
| 407 | 409 |
| 408 return true; | 410 return true; |
| 409 } | 411 } |
| 410 | 412 |
| 413 bool IsMaximizeModeWindowManagerEnabled() { |
| 414 return ash::Shell::GetInstance() |
| 415 ->maximize_mode_controller() |
| 416 ->IsMaximizeModeWindowManagerEnabled(); |
| 417 } |
| 418 |
| 411 } // namespace | 419 } // namespace |
| 412 | 420 |
| 413 // static | 421 // static |
| 414 const char DisplayInfoProviderChromeOS:: | 422 const char DisplayInfoProviderChromeOS:: |
| 415 kCustomTouchCalibrationInProgressError[] = | 423 kCustomTouchCalibrationInProgressError[] = |
| 416 "Another custom touch calibration already under progress."; | 424 "Another custom touch calibration already under progress."; |
| 417 | 425 |
| 418 // static | 426 // static |
| 419 const char DisplayInfoProviderChromeOS:: | 427 const char DisplayInfoProviderChromeOS:: |
| 420 kCompleteCalibrationCalledBeforeStartError[] = | 428 kCompleteCalibrationCalledBeforeStartError[] = |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 495 |
| 488 // Process 'overscan' parameter. | 496 // Process 'overscan' parameter. |
| 489 if (info.overscan) { | 497 if (info.overscan) { |
| 490 display_manager->SetOverscanInsets( | 498 display_manager->SetOverscanInsets( |
| 491 display_id, gfx::Insets(info.overscan->top, info.overscan->left, | 499 display_id, gfx::Insets(info.overscan->top, info.overscan->left, |
| 492 info.overscan->bottom, info.overscan->right)); | 500 info.overscan->bottom, info.overscan->right)); |
| 493 } | 501 } |
| 494 | 502 |
| 495 // Process 'rotation' parameter. | 503 // Process 'rotation' parameter. |
| 496 if (info.rotation) { | 504 if (info.rotation) { |
| 497 display_configuration_controller->SetDisplayRotation( | 505 if (IsMaximizeModeWindowManagerEnabled() && |
| 498 display_id, DegreesToRotation(*info.rotation), | 506 display_id == display::Display::InternalDisplayId()) { |
| 499 display::Display::ROTATION_SOURCE_ACTIVE); | 507 ash::Shell::GetInstance() |
| 508 ->screen_orientation_controller() |
| 509 ->SetLockToRotation(DegreesToRotation(*info.rotation)); |
| 510 } else { |
| 511 display_configuration_controller->SetDisplayRotation( |
| 512 display_id, DegreesToRotation(*info.rotation), |
| 513 display::Display::ROTATION_SOURCE_ACTIVE); |
| 514 } |
| 500 } | 515 } |
| 501 | 516 |
| 502 // Process new display origin parameters. | 517 // Process new display origin parameters. |
| 503 gfx::Point new_bounds_origin = target.bounds().origin(); | 518 gfx::Point new_bounds_origin = target.bounds().origin(); |
| 504 if (info.bounds_origin_x) | 519 if (info.bounds_origin_x) |
| 505 new_bounds_origin.set_x(*info.bounds_origin_x); | 520 new_bounds_origin.set_x(*info.bounds_origin_x); |
| 506 if (info.bounds_origin_y) | 521 if (info.bounds_origin_y) |
| 507 new_bounds_origin.set_y(*info.bounds_origin_y); | 522 new_bounds_origin.set_y(*info.bounds_origin_y); |
| 508 | 523 |
| 509 if (new_bounds_origin != target.bounds().origin()) { | 524 if (new_bounds_origin != target.bounds().origin()) { |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 touch_calibrator_.reset(new chromeos::TouchCalibratorController); | 899 touch_calibrator_.reset(new chromeos::TouchCalibratorController); |
| 885 return touch_calibrator_.get(); | 900 return touch_calibrator_.get(); |
| 886 } | 901 } |
| 887 | 902 |
| 888 // static | 903 // static |
| 889 DisplayInfoProvider* DisplayInfoProvider::Create() { | 904 DisplayInfoProvider* DisplayInfoProvider::Create() { |
| 890 return new DisplayInfoProviderChromeOS(); | 905 return new DisplayInfoProviderChromeOS(); |
| 891 } | 906 } |
| 892 | 907 |
| 893 } // namespace extensions | 908 } // namespace extensions |
| OLD | NEW |