| 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 "ash/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ash/shell.h" | 22 #include "ash/shell.h" |
| 23 #include "base/auto_reset.h" | 23 #include "base/auto_reset.h" |
| 24 #include "base/command_line.h" | 24 #include "base/command_line.h" |
| 25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #include "base/metrics/histogram.h" | 26 #include "base/metrics/histogram.h" |
| 27 #include "base/run_loop.h" | 27 #include "base/run_loop.h" |
| 28 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
| 29 #include "base/strings/string_split.h" | 29 #include "base/strings/string_split.h" |
| 30 #include "base/strings/stringprintf.h" | 30 #include "base/strings/stringprintf.h" |
| 31 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
| 32 #include "base/thread_task_runner_handle.h" |
| 32 #include "grit/ash_strings.h" | 33 #include "grit/ash_strings.h" |
| 33 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 34 #include "ui/gfx/display.h" | 35 #include "ui/gfx/display.h" |
| 35 #include "ui/gfx/display_observer.h" | 36 #include "ui/gfx/display_observer.h" |
| 36 #include "ui/gfx/font_render_params.h" | 37 #include "ui/gfx/font_render_params.h" |
| 37 #include "ui/gfx/geometry/rect.h" | 38 #include "ui/gfx/geometry/rect.h" |
| 38 #include "ui/gfx/geometry/size_conversions.h" | 39 #include "ui/gfx/geometry/size_conversions.h" |
| 39 #include "ui/gfx/screen.h" | 40 #include "ui/gfx/screen.h" |
| 40 | 41 |
| 41 #if defined(USE_X11) | 42 #if defined(USE_X11) |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 } | 1044 } |
| 1044 return false; | 1045 return false; |
| 1045 } | 1046 } |
| 1046 | 1047 |
| 1047 void DisplayManager::CreateMirrorWindowAsyncIfAny() { | 1048 void DisplayManager::CreateMirrorWindowAsyncIfAny() { |
| 1048 // Do not post a task if the software mirroring doesn't exist, or | 1049 // Do not post a task if the software mirroring doesn't exist, or |
| 1049 // during initialization when compositor's init task isn't posted yet. | 1050 // during initialization when compositor's init task isn't posted yet. |
| 1050 // ash::Shell::Init() will call this after the compositor is initialized. | 1051 // ash::Shell::Init() will call this after the compositor is initialized. |
| 1051 if (software_mirroring_display_list_.empty() || !delegate_) | 1052 if (software_mirroring_display_list_.empty() || !delegate_) |
| 1052 return; | 1053 return; |
| 1053 base::MessageLoopForUI::current()->PostTask( | 1054 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1054 FROM_HERE, | 1055 FROM_HERE, base::Bind(&DisplayManager::CreateMirrorWindowIfAny, |
| 1055 base::Bind(&DisplayManager::CreateMirrorWindowIfAny, | 1056 weak_ptr_factory_.GetWeakPtr())); |
| 1056 weak_ptr_factory_.GetWeakPtr())); | |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 scoped_ptr<MouseWarpController> DisplayManager::CreateMouseWarpController( | 1059 scoped_ptr<MouseWarpController> DisplayManager::CreateMouseWarpController( |
| 1060 aura::Window* drag_source) const { | 1060 aura::Window* drag_source) const { |
| 1061 if (IsInUnifiedMode() && num_connected_displays() >= 2) | 1061 if (IsInUnifiedMode() && num_connected_displays() >= 2) |
| 1062 return make_scoped_ptr(new UnifiedMouseWarpController()); | 1062 return make_scoped_ptr(new UnifiedMouseWarpController()); |
| 1063 // Extra check for |num_connected_displays()| is for SystemDisplayApiTest | 1063 // Extra check for |num_connected_displays()| is for SystemDisplayApiTest |
| 1064 // that injects MockScreen. | 1064 // that injects MockScreen. |
| 1065 if (GetNumDisplays() < 2 || num_connected_displays() < 2) | 1065 if (GetNumDisplays() < 2 || num_connected_displays() < 2) |
| 1066 return make_scoped_ptr(new NullMouseWarpController()); | 1066 return make_scoped_ptr(new NullMouseWarpController()); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1400 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 1400 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
| 1401 secondary_display->UpdateWorkAreaFromInsets(insets); | 1401 secondary_display->UpdateWorkAreaFromInsets(insets); |
| 1402 } | 1402 } |
| 1403 | 1403 |
| 1404 void DisplayManager::RunPendingTasksForTest() { | 1404 void DisplayManager::RunPendingTasksForTest() { |
| 1405 if (!software_mirroring_display_list_.empty()) | 1405 if (!software_mirroring_display_list_.empty()) |
| 1406 base::RunLoop().RunUntilIdle(); | 1406 base::RunLoop().RunUntilIdle(); |
| 1407 } | 1407 } |
| 1408 | 1408 |
| 1409 } // namespace ash | 1409 } // namespace ash |
| OLD | NEW |