OLD | NEW |
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_controller.h" | 9 #include "ash/display/display_controller.h" |
| 10 #include "ash/display/display_manager.h" |
10 #include "ash/display/output_configurator_animation.h" | 11 #include "ash/display/output_configurator_animation.h" |
11 #include "ash/screen_ash.h" | 12 #include "ash/screen_ash.h" |
12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
13 #include "base/bind.h" | 14 #include "base/bind.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
16 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
17 #include "base/values.h" | 18 #include "base/values.h" |
18 #include "chrome/browser/chromeos/display/display_preferences.h" | 19 #include "chrome/browser/chromeos/display/display_preferences.h" |
19 #include "chrome/browser/chromeos/display/overscan_calibrator.h" | 20 #include "chrome/browser/chromeos/display/overscan_calibrator.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
22 #include "chromeos/display/output_configurator.h" | 23 #include "chromeos/display/output_configurator.h" |
23 #include "content/public/browser/web_ui.h" | 24 #include "content/public/browser/web_ui.h" |
24 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
25 #include "ui/aura/env.h" | |
26 #include "ui/aura/display_manager.h" | |
27 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/gfx/display.h" | 27 #include "ui/gfx/display.h" |
29 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
30 #include "ui/gfx/screen.h" | 29 #include "ui/gfx/screen.h" |
31 | 30 |
32 namespace chromeos { | 31 namespace chromeos { |
33 namespace options { | 32 namespace options { |
34 | 33 |
35 DisplayOptionsHandler::DisplayOptionsHandler() { | 34 DisplayOptionsHandler::DisplayOptionsHandler() { |
36 aura::Env::GetInstance()->display_manager()->AddObserver(this); | 35 ash::Shell::GetScreen()->AddObserver(this); |
37 } | 36 } |
38 | 37 |
39 DisplayOptionsHandler::~DisplayOptionsHandler() { | 38 DisplayOptionsHandler::~DisplayOptionsHandler() { |
40 aura::Env::GetInstance()->display_manager()->RemoveObserver(this); | 39 ash::Shell::GetScreen()->RemoveObserver(this); |
41 } | 40 } |
42 | 41 |
43 void DisplayOptionsHandler::GetLocalizedValues( | 42 void DisplayOptionsHandler::GetLocalizedValues( |
44 DictionaryValue* localized_strings) { | 43 DictionaryValue* localized_strings) { |
45 DCHECK(localized_strings); | 44 DCHECK(localized_strings); |
46 RegisterTitle(localized_strings, "displayOptionsPage", | 45 RegisterTitle(localized_strings, "displayOptionsPage", |
47 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_TAB_TITLE); | 46 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_TAB_TITLE); |
48 localized_strings->SetString("startMirroring", l10n_util::GetStringUTF16( | 47 localized_strings->SetString("startMirroring", l10n_util::GetStringUTF16( |
49 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_START_MIRRORING)); | 48 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_START_MIRRORING)); |
50 localized_strings->SetString("stopMirroring", l10n_util::GetStringUTF16( | 49 localized_strings->SetString("stopMirroring", l10n_util::GetStringUTF16( |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 ash::Shell::GetInstance()->output_configurator()->output_state(); | 125 ash::Shell::GetInstance()->output_configurator()->output_state(); |
127 base::FundamentalValue show_options( | 126 base::FundamentalValue show_options( |
128 output_state != chromeos::STATE_INVALID && | 127 output_state != chromeos::STATE_INVALID && |
129 output_state != chromeos::STATE_HEADLESS && | 128 output_state != chromeos::STATE_HEADLESS && |
130 output_state != chromeos::STATE_SINGLE); | 129 output_state != chromeos::STATE_SINGLE); |
131 web_ui()->CallJavascriptFunction( | 130 web_ui()->CallJavascriptFunction( |
132 "options.BrowserOptions.showDisplayOptions", show_options); | 131 "options.BrowserOptions.showDisplayOptions", show_options); |
133 } | 132 } |
134 | 133 |
135 void DisplayOptionsHandler::SendDisplayInfo() { | 134 void DisplayOptionsHandler::SendDisplayInfo() { |
136 aura::DisplayManager* display_manager = | 135 ash::internal::DisplayManager* display_manager = |
137 aura::Env::GetInstance()->display_manager(); | 136 ash::Shell::GetInstance()->display_manager(); |
138 ash::DisplayController* display_controller = | 137 ash::DisplayController* display_controller = |
139 ash::Shell::GetInstance()->display_controller(); | 138 ash::Shell::GetInstance()->display_controller(); |
140 chromeos::OutputConfigurator* output_configurator = | 139 chromeos::OutputConfigurator* output_configurator = |
141 ash::Shell::GetInstance()->output_configurator(); | 140 ash::Shell::GetInstance()->output_configurator(); |
142 base::FundamentalValue mirroring( | 141 base::FundamentalValue mirroring( |
143 output_configurator->output_state() == chromeos::STATE_DUAL_MIRROR); | 142 output_configurator->output_state() == chromeos::STATE_DUAL_MIRROR); |
144 | 143 |
145 int64 primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); | 144 int64 primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); |
146 base::ListValue displays; | 145 base::ListValue displays; |
147 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 146 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 !args->GetDouble(2, &bottom) || !args->GetDouble(3, &right)) { | 305 !args->GetDouble(2, &bottom) || !args->GetDouble(3, &right)) { |
307 LOG(ERROR) << "Can't find overscan insets data."; | 306 LOG(ERROR) << "Can't find overscan insets data."; |
308 return; | 307 return; |
309 } | 308 } |
310 | 309 |
311 overscan_calibrator_->UpdateInsets(gfx::Insets(top, left, bottom, right)); | 310 overscan_calibrator_->UpdateInsets(gfx::Insets(top, left, bottom, right)); |
312 } | 311 } |
313 | 312 |
314 } // namespace options | 313 } // namespace options |
315 } // namespace chromeos | 314 } // namespace chromeos |
OLD | NEW |