| 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 "ui/display/manager/display_manager.h" | 5 #include "ui/display/manager/display_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/auto_reset.h" | 16 #include "base/auto_reset.h" |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 21 #include "base/metrics/histogram_macros.h" | 21 #include "base/metrics/histogram_macros.h" |
| 22 #include "base/run_loop.h" | 22 #include "base/run_loop.h" |
| 23 #include "base/stl_util.h" |
| 23 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/string_split.h" | 25 #include "base/strings/string_split.h" |
| 25 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
| 26 #include "base/strings/utf_string_conversions.h" | 27 #include "base/strings/utf_string_conversions.h" |
| 27 #include "base/threading/thread_task_runner_handle.h" | 28 #include "base/threading/thread_task_runner_handle.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/display/display.h" | 30 #include "ui/display/display.h" |
| 30 #include "ui/display/display_finder.h" | 31 #include "ui/display/display_finder.h" |
| 31 #include "ui/display/display_observer.h" | 32 #include "ui/display/display_observer.h" |
| 32 #include "ui/display/display_switches.h" | 33 #include "ui/display/display_switches.h" |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 // (mirror -> docked, docked -> single internal). | 792 // (mirror -> docked, docked -> single internal). |
| 792 bool clear_focus = | 793 bool clear_focus = |
| 793 !removed_displays.empty() && | 794 !removed_displays.empty() && |
| 794 !(removed_displays.size() == 1 && added_display_indices.size() == 1); | 795 !(removed_displays.size() == 1 && added_display_indices.size() == 1); |
| 795 if (delegate_) | 796 if (delegate_) |
| 796 delegate_->PreDisplayConfigurationChange(clear_focus); | 797 delegate_->PreDisplayConfigurationChange(clear_focus); |
| 797 | 798 |
| 798 std::vector<size_t> updated_indices; | 799 std::vector<size_t> updated_indices; |
| 799 UpdateNonPrimaryDisplayBoundsForLayout(&new_displays, &updated_indices); | 800 UpdateNonPrimaryDisplayBoundsForLayout(&new_displays, &updated_indices); |
| 800 for (size_t updated_index : updated_indices) { | 801 for (size_t updated_index : updated_indices) { |
| 801 if (std::find(added_display_indices.begin(), added_display_indices.end(), | 802 if (!base::ContainsValue(added_display_indices, updated_index)) { |
| 802 updated_index) == added_display_indices.end()) { | |
| 803 uint32_t metrics = DisplayObserver::DISPLAY_METRIC_BOUNDS | | 803 uint32_t metrics = DisplayObserver::DISPLAY_METRIC_BOUNDS | |
| 804 DisplayObserver::DISPLAY_METRIC_WORK_AREA; | 804 DisplayObserver::DISPLAY_METRIC_WORK_AREA; |
| 805 if (display_changes.find(updated_index) != display_changes.end()) | 805 if (display_changes.find(updated_index) != display_changes.end()) |
| 806 metrics |= display_changes[updated_index]; | 806 metrics |= display_changes[updated_index]; |
| 807 | 807 |
| 808 display_changes[updated_index] = metrics; | 808 display_changes[updated_index] = metrics; |
| 809 } | 809 } |
| 810 } | 810 } |
| 811 | 811 |
| 812 active_display_list_ = new_displays; | 812 active_display_list_ = new_displays; |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 } | 1499 } |
| 1500 | 1500 |
| 1501 const Display& DisplayManager::GetSecondaryDisplay() const { | 1501 const Display& DisplayManager::GetSecondaryDisplay() const { |
| 1502 CHECK_LE(2U, GetNumDisplays()); | 1502 CHECK_LE(2U, GetNumDisplays()); |
| 1503 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id() | 1503 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id() |
| 1504 ? GetDisplayAt(1) | 1504 ? GetDisplayAt(1) |
| 1505 : GetDisplayAt(0); | 1505 : GetDisplayAt(0); |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 } // namespace display | 1508 } // namespace display |
| OLD | NEW |