Chromium Code Reviews| 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 <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.h" | 21 #include "base/metrics/histogram.h" |
| 22 #include "base/run_loop.h" | 22 #include "base/run_loop.h" |
| 23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
| 25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 27 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
| 28 #include "grit/ash_strings.h" | |
| 29 #include "ui/base/l10n/l10n_util.h" | |
| 30 #include "ui/display/display.h" | 28 #include "ui/display/display.h" |
| 31 #include "ui/display/display_observer.h" | 29 #include "ui/display/display_observer.h" |
| 32 #include "ui/display/display_switches.h" | 30 #include "ui/display/display_switches.h" |
| 33 #include "ui/display/manager/display_layout_store.h" | 31 #include "ui/display/manager/display_layout_store.h" |
| 34 #include "ui/display/manager/display_manager_utilities.h" | 32 #include "ui/display/manager/display_manager_utilities.h" |
| 35 #include "ui/display/manager/managed_display_info.h" | 33 #include "ui/display/manager/managed_display_info.h" |
| 36 #include "ui/display/screen.h" | 34 #include "ui/display/screen.h" |
| 37 #include "ui/gfx/font_render_params.h" | 35 #include "ui/gfx/font_render_params.h" |
| 38 #include "ui/gfx/geometry/rect.h" | 36 #include "ui/gfx/geometry/rect.h" |
| 39 #include "ui/gfx/geometry/size_conversions.h" | 37 #include "ui/gfx/geometry/size_conversions.h" |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 else if (display_modes_.find(iter->id()) != display_modes_.end()) | 602 else if (display_modes_.find(iter->id()) != display_modes_.end()) |
| 605 display_modes_[iter->id()] = *display_modes_iter; | 603 display_modes_[iter->id()] = *display_modes_iter; |
| 606 } | 604 } |
| 607 if (display::Display::HasInternalDisplay() && !internal_display_connected) { | 605 if (display::Display::HasInternalDisplay() && !internal_display_connected) { |
| 608 if (display_info_.find(display::Display::InternalDisplayId()) == | 606 if (display_info_.find(display::Display::InternalDisplayId()) == |
| 609 display_info_.end()) { | 607 display_info_.end()) { |
| 610 // Create a dummy internal display if the chrome restarted | 608 // Create a dummy internal display if the chrome restarted |
| 611 // in docked mode. | 609 // in docked mode. |
| 612 display::ManagedDisplayInfo internal_display_info( | 610 display::ManagedDisplayInfo internal_display_info( |
| 613 display::Display::InternalDisplayId(), | 611 display::Display::InternalDisplayId(), |
| 614 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME), | 612 // l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME), |
|
oshima
2016/09/30 23:03:40
remove this
rjkroege
2016/10/05 00:40:27
Done.
| |
| 613 delegate_->GetInternalDisplayNameString(), | |
| 615 false /*Internal display must not have overscan */); | 614 false /*Internal display must not have overscan */); |
| 616 internal_display_info.SetBounds(gfx::Rect(0, 0, 800, 600)); | 615 internal_display_info.SetBounds(gfx::Rect(0, 0, 800, 600)); |
| 617 display_info_[display::Display::InternalDisplayId()] = | 616 display_info_[display::Display::InternalDisplayId()] = |
| 618 internal_display_info; | 617 internal_display_info; |
| 619 } else { | 618 } else { |
| 620 // Internal display is no longer active. Reset its rotation to user | 619 // Internal display is no longer active. Reset its rotation to user |
| 621 // preference, so that it is restored when the internal display becomes | 620 // preference, so that it is restored when the internal display becomes |
| 622 // active again. | 621 // active again. |
| 623 display::Display::Rotation user_rotation = | 622 display::Display::Rotation user_rotation = |
| 624 display_info_[display::Display::InternalDisplayId()].GetRotation( | 623 display_info_[display::Display::InternalDisplayId()].GetRotation( |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 923 software_mirroring_display_list_.end(), | 922 software_mirroring_display_list_.end(), |
| 924 [display_id](const display::Display& display) { | 923 [display_id](const display::Display& display) { |
| 925 return display.id() == display_id; | 924 return display.id() == display_id; |
| 926 }); | 925 }); |
| 927 return iter == software_mirroring_display_list_.end() ? display::Display() | 926 return iter == software_mirroring_display_list_.end() ? display::Display() |
| 928 : *iter; | 927 : *iter; |
| 929 } | 928 } |
| 930 | 929 |
| 931 std::string DisplayManager::GetDisplayNameForId(int64_t id) { | 930 std::string DisplayManager::GetDisplayNameForId(int64_t id) { |
| 932 if (id == display::Display::kInvalidDisplayID) | 931 if (id == display::Display::kInvalidDisplayID) |
| 933 return l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); | 932 return delegate_->GetInternalDisplayNameString(); |
| 934 | 933 |
| 935 std::map<int64_t, display::ManagedDisplayInfo>::const_iterator iter = | 934 std::map<int64_t, display::ManagedDisplayInfo>::const_iterator iter = |
| 936 display_info_.find(id); | 935 display_info_.find(id); |
| 937 if (iter != display_info_.end() && !iter->second.name().empty()) | 936 if (iter != display_info_.end() && !iter->second.name().empty()) |
| 938 return iter->second.name(); | 937 return iter->second.name(); |
| 939 | 938 |
| 940 return base::StringPrintf("Display %d", static_cast<int>(id)); | 939 return base::StringPrintf("Display %d", static_cast<int>(id)); |
| 941 } | 940 } |
| 942 | 941 |
| 943 int64_t DisplayManager::GetDisplayIdForUIScaling() const { | 942 int64_t DisplayManager::GetDisplayIdForUIScaling() const { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1435 | 1434 |
| 1436 const display::Display& DisplayManager::GetSecondaryDisplay() const { | 1435 const display::Display& DisplayManager::GetSecondaryDisplay() const { |
| 1437 CHECK_LE(2U, GetNumDisplays()); | 1436 CHECK_LE(2U, GetNumDisplays()); |
| 1438 return GetDisplayAt(0).id() == | 1437 return GetDisplayAt(0).id() == |
| 1439 display::Screen::GetScreen()->GetPrimaryDisplay().id() | 1438 display::Screen::GetScreen()->GetPrimaryDisplay().id() |
| 1440 ? GetDisplayAt(1) | 1439 ? GetDisplayAt(1) |
| 1441 : GetDisplayAt(0); | 1440 : GetDisplayAt(0); |
| 1442 } | 1441 } |
| 1443 | 1442 |
| 1444 } // namespace ash | 1443 } // namespace ash |
| OLD | NEW |