| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/extensions/api/system_display/display_info_provider.h" | 5 #include "chrome/browser/extensions/api/system_display/display_info_provider.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 new_bounds_origin.y() - target.bounds().y()); | 348 new_bounds_origin.y() - target.bounds().y()); |
| 349 UpdateDisplayLayout(primary.bounds(), primary.id(), | 349 UpdateDisplayLayout(primary.bounds(), primary.id(), |
| 350 target_bounds, target.id()); | 350 target_bounds, target.id()); |
| 351 } | 351 } |
| 352 | 352 |
| 353 return true; | 353 return true; |
| 354 } | 354 } |
| 355 | 355 |
| 356 } // namespace | 356 } // namespace |
| 357 | 357 |
| 358 void DisplayInfoProvider::SetInfo(const std::string& display_id, | 358 bool DisplayInfoProvider::SetInfo(const std::string& display_id, |
| 359 const DisplayProperties& info, | 359 const DisplayProperties& info, |
| 360 const SetInfoCallback& callback) { | 360 std::string* error) { |
| 361 std::string error; | 361 return SetInfoImpl(display_id, info, error); |
| 362 bool success = SetInfoImpl(display_id, info, &error); | |
| 363 base::MessageLoopProxy::current()->PostTask( | |
| 364 FROM_HERE, | |
| 365 base::Bind(callback, success, error)); | |
| 366 } | 362 } |
| 367 | 363 |
| 368 void DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform( | 364 void DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform( |
| 369 const gfx::Display& display, | 365 const gfx::Display& display, |
| 370 extensions::api::system_display::DisplayUnitInfo* unit) { | 366 extensions::api::system_display::DisplayUnitInfo* unit) { |
| 371 | 367 |
| 372 ash::internal::DisplayManager* display_manager | 368 ash::internal::DisplayManager* display_manager |
| 373 = ash::Shell::GetInstance()->display_manager(); | 369 = ash::Shell::GetInstance()->display_manager(); |
| 374 unit->name = display_manager->GetDisplayNameForId(display.id()); | 370 unit->name = display_manager->GetDisplayNameForId(display.id()); |
| 375 if (display_manager->IsMirrored()) { | 371 if (display_manager->IsMirrored()) { |
| 376 unit->mirroring_source_id = | 372 unit->mirroring_source_id = |
| 377 base::Int64ToString(display_manager->mirrored_display().id()); | 373 base::Int64ToString(display_manager->mirrored_display().id()); |
| 378 } | 374 } |
| 379 | 375 |
| 380 const float dpi = display.device_scale_factor() * kDpi96; | 376 const float dpi = display.device_scale_factor() * kDpi96; |
| 381 unit->dpi_x = dpi; | 377 unit->dpi_x = dpi; |
| 382 unit->dpi_y = dpi; | 378 unit->dpi_y = dpi; |
| 383 | 379 |
| 384 const gfx::Insets overscan_insets = | 380 const gfx::Insets overscan_insets = |
| 385 display_manager->GetOverscanInsets(display.id()); | 381 display_manager->GetOverscanInsets(display.id()); |
| 386 unit->overscan.left = overscan_insets.left(); | 382 unit->overscan.left = overscan_insets.left(); |
| 387 unit->overscan.top = overscan_insets.top(); | 383 unit->overscan.top = overscan_insets.top(); |
| 388 unit->overscan.right = overscan_insets.right(); | 384 unit->overscan.right = overscan_insets.right(); |
| 389 unit->overscan.bottom = overscan_insets.bottom(); | 385 unit->overscan.bottom = overscan_insets.bottom(); |
| 390 } | 386 } |
| 391 | 387 |
| 392 } // namespace extensions | 388 } // namespace extensions |
| OLD | NEW |