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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 result->SetInteger("top", bounds.y()); | 188 result->SetInteger("top", bounds.y()); |
189 result->SetInteger("width", bounds.width()); | 189 result->SetInteger("width", bounds.width()); |
190 result->SetInteger("height", bounds.height()); | 190 result->SetInteger("height", bounds.height()); |
191 return result; | 191 return result; |
192 } | 192 } |
193 | 193 |
194 } // namespace | 194 } // namespace |
195 | 195 |
196 DisplayOptionsHandler::DisplayOptionsHandler() { | 196 DisplayOptionsHandler::DisplayOptionsHandler() { |
197 // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429 | 197 // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429 |
198 if (!ash_util::IsRunningInMash()) | 198 if (!IsRunningInMash()) |
199 ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); | 199 ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); |
200 } | 200 } |
201 | 201 |
202 DisplayOptionsHandler::~DisplayOptionsHandler() { | 202 DisplayOptionsHandler::~DisplayOptionsHandler() { |
203 // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429 | 203 // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429 |
204 if (!ash_util::IsRunningInMash()) | 204 if (!IsRunningInMash()) |
205 ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); | 205 ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); |
206 } | 206 } |
207 | 207 |
208 void DisplayOptionsHandler::GetLocalizedValues( | 208 void DisplayOptionsHandler::GetLocalizedValues( |
209 base::DictionaryValue* localized_strings) { | 209 base::DictionaryValue* localized_strings) { |
210 DCHECK(localized_strings); | 210 DCHECK(localized_strings); |
211 RegisterTitle(localized_strings, "displayOptionsPage", | 211 RegisterTitle(localized_strings, "displayOptionsPage", |
212 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_TAB_TITLE); | 212 IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_TAB_TITLE); |
213 | 213 |
214 localized_strings->SetString( | 214 localized_strings->SetString( |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 js_displays->Append(std::move(js_display)); | 374 js_displays->Append(std::move(js_display)); |
375 } | 375 } |
376 | 376 |
377 web_ui()->CallJavascriptFunctionUnsafe( | 377 web_ui()->CallJavascriptFunctionUnsafe( |
378 "options.DisplayOptions.setDisplayInfo", mode, *js_displays); | 378 "options.DisplayOptions.setDisplayInfo", mode, *js_displays); |
379 } | 379 } |
380 | 380 |
381 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { | 381 void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { |
382 // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429 | 382 // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429 |
383 if (ash_util::IsRunningInMash()) | 383 if (IsRunningInMash()) |
384 return; | 384 return; |
385 | 385 |
386 display::DisplayManager* display_manager = GetDisplayManager(); | 386 display::DisplayManager* display_manager = GetDisplayManager(); |
387 bool disable_multi_display_layout = | 387 bool disable_multi_display_layout = |
388 base::CommandLine::ForCurrentProcess()->HasSwitch( | 388 base::CommandLine::ForCurrentProcess()->HasSwitch( |
389 chromeos::switches::kDisableMultiDisplayLayout); | 389 chromeos::switches::kDisableMultiDisplayLayout); |
390 bool ui_enabled = display_manager->num_connected_displays() <= 2 || | 390 bool ui_enabled = display_manager->num_connected_displays() <= 2 || |
391 !disable_multi_display_layout; | 391 !disable_multi_display_layout; |
392 bool unified_enabled = display_manager->unified_desktop_enabled(); | 392 bool unified_enabled = display_manager->unified_desktop_enabled(); |
393 bool mirrored_enabled = display_manager->num_connected_displays() == 2; | 393 bool mirrored_enabled = display_manager->num_connected_displays() == 2; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 if (!args->GetBoolean(0, &enable)) | 581 if (!args->GetBoolean(0, &enable)) |
582 NOTREACHED(); | 582 NOTREACHED(); |
583 | 583 |
584 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( | 584 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( |
585 enable ? display::DisplayManager::UNIFIED | 585 enable ? display::DisplayManager::UNIFIED |
586 : display::DisplayManager::EXTENDED); | 586 : display::DisplayManager::EXTENDED); |
587 } | 587 } |
588 | 588 |
589 } // namespace options | 589 } // namespace options |
590 } // namespace chromeos | 590 } // namespace chromeos |
OLD | NEW |