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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc

Issue 289583002: Lock rotation when screen is manually rotated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Define sources for rotation Created 6 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/options/chromeos/display_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/display_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/display/display_configurator_animation.h" 9 #include "ash/display/display_configurator_animation.h"
10 #include "ash/display/display_controller.h" 10 #include "ash/display/display_controller.h"
11 #include "ash/display/display_manager.h" 11 #include "ash/display/display_manager.h"
12 #include "ash/display/resolution_notification_controller.h" 12 #include "ash/display/resolution_notification_controller.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/chromeos/display/display_preferences.h" 19 #include "chrome/browser/chromeos/display/display_preferences.h"
20 #include "content/public/browser/user_metrics.h" 20 #include "content/public/browser/user_metrics.h"
21 #include "content/public/browser/web_ui.h" 21 #include "content/public/browser/web_ui.h"
22 #include "grit/ash_strings.h" 22 #include "grit/ash_strings.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/display/types/display_constants.h"
25 #include "ui/gfx/display.h" 26 #include "ui/gfx/display.h"
26 #include "ui/gfx/rect.h" 27 #include "ui/gfx/rect.h"
27 #include "ui/gfx/screen.h" 28 #include "ui/gfx/screen.h"
28 #include "ui/gfx/size_conversions.h" 29 #include "ui/gfx/size_conversions.h"
29 30
30 using ash::DisplayManager; 31 using ash::DisplayManager;
31 32
32 namespace chromeos { 33 namespace chromeos {
33 namespace options { 34 namespace options {
34 namespace { 35 namespace {
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 new_rotation = gfx::Display::ROTATE_90; 494 new_rotation = gfx::Display::ROTATE_90;
494 else if (rotation_value == "180") 495 else if (rotation_value == "180")
495 new_rotation = gfx::Display::ROTATE_180; 496 new_rotation = gfx::Display::ROTATE_180;
496 else if (rotation_value == "270") 497 else if (rotation_value == "270")
497 new_rotation = gfx::Display::ROTATE_270; 498 new_rotation = gfx::Display::ROTATE_270;
498 else if (rotation_value != "0") 499 else if (rotation_value != "0")
499 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0"; 500 LOG(ERROR) << "Invalid rotation: " << rotation_value << " Falls back to 0";
500 501
501 content::RecordAction( 502 content::RecordAction(
502 base::UserMetricsAction("Options_DisplaySetOrientation")); 503 base::UserMetricsAction("Options_DisplaySetOrientation"));
503 GetDisplayManager()->SetDisplayRotation(display_id, new_rotation); 504 GetDisplayManager()->SetDisplayRotation(display_id, new_rotation,
505 ui::USER);
504 } 506 }
505 507
506 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) { 508 void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) {
507 DCHECK(!args->empty()); 509 DCHECK(!args->empty());
508 int64 display_id = GetDisplayId(args); 510 int64 display_id = GetDisplayId(args);
509 if (display_id == gfx::Display::kInvalidDisplayID) 511 if (display_id == gfx::Display::kInvalidDisplayID)
510 return; 512 return;
511 513
512 std::string profile_value; 514 std::string profile_value;
513 if (!args->GetString(1, &profile_value)) { 515 if (!args->GetString(1, &profile_value)) {
(...skipping 13 matching lines...) Expand all
527 return; 529 return;
528 } 530 }
529 531
530 GetDisplayManager()->SetColorCalibrationProfile( 532 GetDisplayManager()->SetColorCalibrationProfile(
531 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); 533 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id));
532 SendAllDisplayInfo(); 534 SendAllDisplayInfo();
533 } 535 }
534 536
535 } // namespace options 537 } // namespace options
536 } // namespace chromeos 538 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698