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

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

Issue 2784043002: cros: Treat set rotation for chrome.system.display API in touchview mode as if user rotation lock (Closed)
Patch Set: feedback 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"
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
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 492
485 // Process 'overscan' parameter. 493 // Process 'overscan' parameter.
486 if (info.overscan) { 494 if (info.overscan) {
487 display_manager->SetOverscanInsets( 495 display_manager->SetOverscanInsets(
488 display_id, gfx::Insets(info.overscan->top, info.overscan->left, 496 display_id, gfx::Insets(info.overscan->top, info.overscan->left,
489 info.overscan->bottom, info.overscan->right)); 497 info.overscan->bottom, info.overscan->right));
490 } 498 }
491 499
492 // Process 'rotation' parameter. 500 // Process 'rotation' parameter.
493 if (info.rotation) { 501 if (info.rotation) {
494 display_configuration_controller->SetDisplayRotation( 502 if (IsMaximizeModeWindowManagerEnabled() &&
495 display_id, DegreesToRotation(*info.rotation), 503 display_id == display::Display::InternalDisplayId()) {
496 display::Display::ROTATION_SOURCE_ACTIVE); 504 ash::Shell::GetInstance()
505 ->screen_orientation_controller()
506 ->SetLockToRotation(DegreesToRotation(*info.rotation));
507 } else {
508 display_configuration_controller->SetDisplayRotation(
509 display_id, DegreesToRotation(*info.rotation),
510 display::Display::ROTATION_SOURCE_ACTIVE);
511 }
497 } 512 }
498 513
499 // Process new display origin parameters. 514 // Process new display origin parameters.
500 gfx::Point new_bounds_origin = target.bounds().origin(); 515 gfx::Point new_bounds_origin = target.bounds().origin();
501 if (info.bounds_origin_x) 516 if (info.bounds_origin_x)
502 new_bounds_origin.set_x(*info.bounds_origin_x); 517 new_bounds_origin.set_x(*info.bounds_origin_x);
503 if (info.bounds_origin_y) 518 if (info.bounds_origin_y)
504 new_bounds_origin.set_y(*info.bounds_origin_y); 519 new_bounds_origin.set_y(*info.bounds_origin_y);
505 520
506 if (new_bounds_origin != target.bounds().origin()) { 521 if (new_bounds_origin != target.bounds().origin()) {
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 touch_calibrator_.reset(new chromeos::TouchCalibratorController); 896 touch_calibrator_.reset(new chromeos::TouchCalibratorController);
882 return touch_calibrator_.get(); 897 return touch_calibrator_.get();
883 } 898 }
884 899
885 // static 900 // static
886 DisplayInfoProvider* DisplayInfoProvider::Create() { 901 DisplayInfoProvider* DisplayInfoProvider::Create() {
887 return new DisplayInfoProviderChromeOS(); 902 return new DisplayInfoProviderChromeOS();
888 } 903 }
889 904
890 } // namespace extensions 905 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698