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 |
| 419 bool IsUserRotationLocked() { |
| 420 return ash::Shell::GetInstance() |
| 421 ->screen_orientation_controller() |
| 422 ->user_rotation_locked(); |
| 423 } |
| 424 |
411 } // namespace | 425 } // namespace |
412 | 426 |
413 // static | 427 // static |
414 const char DisplayInfoProviderChromeOS:: | 428 const char DisplayInfoProviderChromeOS:: |
415 kCustomTouchCalibrationInProgressError[] = | 429 kCustomTouchCalibrationInProgressError[] = |
416 "Another custom touch calibration already under progress."; | 430 "Another custom touch calibration already under progress."; |
417 | 431 |
418 // static | 432 // static |
419 const char DisplayInfoProviderChromeOS:: | 433 const char DisplayInfoProviderChromeOS:: |
420 kCompleteCalibrationCalledBeforeStartError[] = | 434 kCompleteCalibrationCalledBeforeStartError[] = |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 498 |
485 // Process 'overscan' parameter. | 499 // Process 'overscan' parameter. |
486 if (info.overscan) { | 500 if (info.overscan) { |
487 display_manager->SetOverscanInsets( | 501 display_manager->SetOverscanInsets( |
488 display_id, gfx::Insets(info.overscan->top, info.overscan->left, | 502 display_id, gfx::Insets(info.overscan->top, info.overscan->left, |
489 info.overscan->bottom, info.overscan->right)); | 503 info.overscan->bottom, info.overscan->right)); |
490 } | 504 } |
491 | 505 |
492 // Process 'rotation' parameter. | 506 // Process 'rotation' parameter. |
493 if (info.rotation) { | 507 if (info.rotation) { |
494 display_configuration_controller->SetDisplayRotation( | 508 // Do not process 'rotation' on maximize mode with user rotation locked. |
495 display_id, DegreesToRotation(*info.rotation), | 509 if (!IsMaximizeModeWindowManagerEnabled() || !IsUserRotationLocked()) { |
496 display::Display::ROTATION_SOURCE_ACTIVE); | 510 display_configuration_controller->SetDisplayRotation( |
| 511 display_id, DegreesToRotation(*info.rotation), |
| 512 display::Display::ROTATION_SOURCE_ACTIVE); |
| 513 } |
497 } | 514 } |
498 | 515 |
499 // Process new display origin parameters. | 516 // Process new display origin parameters. |
500 gfx::Point new_bounds_origin = target.bounds().origin(); | 517 gfx::Point new_bounds_origin = target.bounds().origin(); |
501 if (info.bounds_origin_x) | 518 if (info.bounds_origin_x) |
502 new_bounds_origin.set_x(*info.bounds_origin_x); | 519 new_bounds_origin.set_x(*info.bounds_origin_x); |
503 if (info.bounds_origin_y) | 520 if (info.bounds_origin_y) |
504 new_bounds_origin.set_y(*info.bounds_origin_y); | 521 new_bounds_origin.set_y(*info.bounds_origin_y); |
505 | 522 |
506 if (new_bounds_origin != target.bounds().origin()) { | 523 if (new_bounds_origin != target.bounds().origin()) { |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 touch_calibrator_.reset(new chromeos::TouchCalibratorController); | 898 touch_calibrator_.reset(new chromeos::TouchCalibratorController); |
882 return touch_calibrator_.get(); | 899 return touch_calibrator_.get(); |
883 } | 900 } |
884 | 901 |
885 // static | 902 // static |
886 DisplayInfoProvider* DisplayInfoProvider::Create() { | 903 DisplayInfoProvider* DisplayInfoProvider::Create() { |
887 return new DisplayInfoProviderChromeOS(); | 904 return new DisplayInfoProviderChromeOS(); |
888 } | 905 } |
889 | 906 |
890 } // namespace extensions | 907 } // namespace extensions |
OLD | NEW |