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

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

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

Powered by Google App Engine
This is Rietveld 408576698