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

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

Issue 1920263003: Rename gfx::Display/Screen to display::Display/Screen in chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_overscan_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/display_overscan_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/display/window_tree_host_manager.h" 10 #include "ash/display/window_tree_host_manager.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/chromeos/display/overscan_calibrator.h" 16 #include "chrome/browser/chromeos/display/overscan_calibrator.h"
17 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
18 #include "content/public/browser/web_ui.h" 18 #include "content/public/browser/web_ui.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/gfx/display.h" 20 #include "ui/display/display.h"
21 #include "ui/gfx/screen.h" 21 #include "ui/display/screen.h"
22 22
23 namespace chromeos { 23 namespace chromeos {
24 namespace options { 24 namespace options {
25 namespace { 25 namespace {
26 26
27 // The value for the orientation of overscan operations. 27 // The value for the orientation of overscan operations.
28 const char kOrientationHorizontal[] = "horizontal"; 28 const char kOrientationHorizontal[] = "horizontal";
29 const char kOrientationVertical[] = "vertical"; 29 const char kOrientationVertical[] = "vertical";
30 30
31 } 31 }
32 32
33 DisplayOverscanHandler::DisplayOverscanHandler() { 33 DisplayOverscanHandler::DisplayOverscanHandler() {
34 gfx::Screen::GetScreen()->AddObserver(this); 34 display::Screen::GetScreen()->AddObserver(this);
35 } 35 }
36 36
37 DisplayOverscanHandler::~DisplayOverscanHandler() { 37 DisplayOverscanHandler::~DisplayOverscanHandler() {
38 gfx::Screen::GetScreen()->RemoveObserver(this); 38 display::Screen::GetScreen()->RemoveObserver(this);
39 } 39 }
40 40
41 void DisplayOverscanHandler::GetLocalizedValues( 41 void DisplayOverscanHandler::GetLocalizedValues(
42 base::DictionaryValue* localized_strings) { 42 base::DictionaryValue* localized_strings) {
43 RegisterTitle(localized_strings, "displayOverscanPage", 43 RegisterTitle(localized_strings, "displayOverscanPage",
44 IDS_OPTIONS_SETTINGS_DISPLAY_OVERSCAN_TAB_TITLE); 44 IDS_OPTIONS_SETTINGS_DISPLAY_OVERSCAN_TAB_TITLE);
45 localized_strings->SetString("shrinkAndExpand", l10n_util::GetStringUTF16( 45 localized_strings->SetString("shrinkAndExpand", l10n_util::GetStringUTF16(
46 IDS_OPTIONS_SETTINGS_DISPLAY_OVERSCAN_SHRINK_EXPAND)); 46 IDS_OPTIONS_SETTINGS_DISPLAY_OVERSCAN_SHRINK_EXPAND));
47 localized_strings->SetString("move", l10n_util::GetStringUTF16( 47 localized_strings->SetString("move", l10n_util::GetStringUTF16(
48 IDS_OPTIONS_SETTINGS_DISPLAY_OVERSCAN_MOVE)); 48 IDS_OPTIONS_SETTINGS_DISPLAY_OVERSCAN_MOVE));
(...skipping 25 matching lines...) Expand all
74 web_ui()->RegisterMessageCallback( 74 web_ui()->RegisterMessageCallback(
75 "move", 75 "move",
76 base::Bind(&DisplayOverscanHandler::HandleMove, 76 base::Bind(&DisplayOverscanHandler::HandleMove,
77 base::Unretained(this))); 77 base::Unretained(this)));
78 web_ui()->RegisterMessageCallback( 78 web_ui()->RegisterMessageCallback(
79 "resize", 79 "resize",
80 base::Bind(&DisplayOverscanHandler::HandleResize, 80 base::Bind(&DisplayOverscanHandler::HandleResize,
81 base::Unretained(this))); 81 base::Unretained(this)));
82 } 82 }
83 83
84 void DisplayOverscanHandler::OnDisplayAdded(const gfx::Display& new_display) { 84 void DisplayOverscanHandler::OnDisplayAdded(
85 const display::Display& new_display) {
85 if (!overscan_calibrator_) 86 if (!overscan_calibrator_)
86 return; 87 return;
87 88
88 web_ui()->CallJavascriptFunction( 89 web_ui()->CallJavascriptFunction(
89 "options.DisplayOverscan.onOverscanCanceled"); 90 "options.DisplayOverscan.onOverscanCanceled");
90 } 91 }
91 92
92 void DisplayOverscanHandler::OnDisplayRemoved(const gfx::Display& old_display) { 93 void DisplayOverscanHandler::OnDisplayRemoved(
94 const display::Display& old_display) {
93 if (!overscan_calibrator_) 95 if (!overscan_calibrator_)
94 return; 96 return;
95 97
96 web_ui()->CallJavascriptFunction( 98 web_ui()->CallJavascriptFunction(
97 "options.DisplayOverscan.onOverscanCanceled"); 99 "options.DisplayOverscan.onOverscanCanceled");
98 } 100 }
99 101
100 void DisplayOverscanHandler::OnDisplayMetricsChanged(const gfx::Display&, 102 void DisplayOverscanHandler::OnDisplayMetricsChanged(const display::Display&,
101 uint32_t) { 103 uint32_t) {}
102 }
103 104
104 void DisplayOverscanHandler::HandleStart(const base::ListValue* args) { 105 void DisplayOverscanHandler::HandleStart(const base::ListValue* args) {
105 int64_t display_id = gfx::Display::kInvalidDisplayID; 106 int64_t display_id = display::Display::kInvalidDisplayID;
106 std::string id_value; 107 std::string id_value;
107 if (!args->GetString(0, &id_value)) { 108 if (!args->GetString(0, &id_value)) {
108 LOG(ERROR) << "Can't find ID"; 109 LOG(ERROR) << "Can't find ID";
109 return; 110 return;
110 } 111 }
111 112
112 if (!base::StringToInt64(id_value, &display_id) || 113 if (!base::StringToInt64(id_value, &display_id) ||
113 display_id == gfx::Display::kInvalidDisplayID) { 114 display_id == display::Display::kInvalidDisplayID) {
114 LOG(ERROR) << "Invalid parameter: " << id_value; 115 LOG(ERROR) << "Invalid parameter: " << id_value;
115 return; 116 return;
116 } 117 }
117 118
118 const gfx::Display& display = 119 const display::Display& display =
119 ash::Shell::GetInstance()->display_manager()->GetDisplayForId(display_id); 120 ash::Shell::GetInstance()->display_manager()->GetDisplayForId(display_id);
120 DCHECK(display.is_valid()); 121 DCHECK(display.is_valid());
121 if (!display.is_valid()) 122 if (!display.is_valid())
122 return; 123 return;
123 124
124 ash::WindowTreeHostManager* window_tree_host_manager = 125 ash::WindowTreeHostManager* window_tree_host_manager =
125 ash::Shell::GetInstance()->window_tree_host_manager(); 126 ash::Shell::GetInstance()->window_tree_host_manager();
126 overscan_calibrator_.reset(new OverscanCalibrator( 127 overscan_calibrator_.reset(new OverscanCalibrator(
127 display, window_tree_host_manager->GetOverscanInsets(display_id))); 128 display, window_tree_host_manager->GetOverscanInsets(display_id)));
128 } 129 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 LOG(ERROR) << "The orientation must be '" << kOrientationHorizontal 201 LOG(ERROR) << "The orientation must be '" << kOrientationHorizontal
201 << "' or '" << kOrientationVertical << "': " 202 << "' or '" << kOrientationVertical << "': "
202 << orientation; 203 << orientation;
203 return; 204 return;
204 } 205 }
205 overscan_calibrator_->UpdateInsets(insets); 206 overscan_calibrator_->UpdateInsets(insets);
206 } 207 }
207 208
208 } // namespace options 209 } // namespace options
209 } // namespace chromeos 210 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/display_overscan_handler.h ('k') | chrome/browser/ui/window_sizer/window_sizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698