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

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

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

Powered by Google App Engine
This is Rietveld 408576698