| Index: ui/display/manager/display_manager.cc
|
| diff --git a/ui/display/manager/display_manager.cc b/ui/display/manager/display_manager.cc
|
| index affda8b86b7baa346fd2d53b2246154675157921..5279bc938fefede662530de2835961ad30bddc79 100644
|
| --- a/ui/display/manager/display_manager.cc
|
| +++ b/ui/display/manager/display_manager.cc
|
| @@ -53,55 +53,53 @@ namespace {
|
| const int kMinimumOverlapForInvalidOffset = 100;
|
|
|
| struct DisplaySortFunctor {
|
| - bool operator()(const display::Display& a, const display::Display& b) {
|
| - return display::CompareDisplayIds(a.id(), b.id());
|
| + bool operator()(const Display& a, const Display& b) {
|
| + return CompareDisplayIds(a.id(), b.id());
|
| }
|
| };
|
|
|
| struct DisplayInfoSortFunctor {
|
| - bool operator()(const display::ManagedDisplayInfo& a,
|
| - const display::ManagedDisplayInfo& b) {
|
| - return display::CompareDisplayIds(a.id(), b.id());
|
| + bool operator()(const ManagedDisplayInfo& a, const ManagedDisplayInfo& b) {
|
| + return CompareDisplayIds(a.id(), b.id());
|
| }
|
| };
|
|
|
| -display::Display& GetInvalidDisplay() {
|
| - static display::Display* invalid_display = new display::Display();
|
| +Display& GetInvalidDisplay() {
|
| + static Display* invalid_display = new Display();
|
| return *invalid_display;
|
| }
|
|
|
| -display::ManagedDisplayInfo::ManagedDisplayModeList::const_iterator
|
| -FindDisplayMode(const display::ManagedDisplayInfo& info,
|
| - const scoped_refptr<display::ManagedDisplayMode>& target_mode) {
|
| - const display::ManagedDisplayInfo::ManagedDisplayModeList& modes =
|
| +ManagedDisplayInfo::ManagedDisplayModeList::const_iterator FindDisplayMode(
|
| + const ManagedDisplayInfo& info,
|
| + const scoped_refptr<ManagedDisplayMode>& target_mode) {
|
| + const ManagedDisplayInfo::ManagedDisplayModeList& modes =
|
| info.display_modes();
|
| return std::find_if(
|
| modes.begin(), modes.end(),
|
| - [target_mode](const scoped_refptr<display::ManagedDisplayMode>& mode) {
|
| + [target_mode](const scoped_refptr<ManagedDisplayMode>& mode) {
|
| return target_mode->IsEquivalent(mode);
|
| });
|
| }
|
|
|
| -void SetInternalManagedDisplayModeList(display::ManagedDisplayInfo* info) {
|
| - scoped_refptr<display::ManagedDisplayMode> native_mode =
|
| - new display::ManagedDisplayMode(
|
| - info->bounds_in_native().size(), 0.0 /* refresh_rate */,
|
| - false /* interlaced */, false /* native_mode */, 1.0 /* ui_scale */,
|
| - info->device_scale_factor());
|
| +void SetInternalManagedDisplayModeList(ManagedDisplayInfo* info) {
|
| + scoped_refptr<ManagedDisplayMode> native_mode = new ManagedDisplayMode(
|
| + info->bounds_in_native().size(), 0.0 /* refresh_rate */,
|
| + false /* interlaced */, false /* native_mode */, 1.0 /* ui_scale */,
|
| + info->device_scale_factor());
|
| info->SetManagedDisplayModes(
|
| - display::CreateInternalManagedDisplayModeList(native_mode));
|
| + CreateInternalManagedDisplayModeList(native_mode));
|
| }
|
|
|
| -void MaybeInitInternalDisplay(display::ManagedDisplayInfo* info) {
|
| +void MaybeInitInternalDisplay(ManagedDisplayInfo* info) {
|
| int64_t id = info->id();
|
| base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
| if (command_line->HasSwitch(::switches::kUseFirstDisplayAsInternal)) {
|
| - display::Display::SetInternalDisplayId(id);
|
| + Display::SetInternalDisplayId(id);
|
| SetInternalManagedDisplayModeList(info);
|
| }
|
| }
|
|
|
| -gfx::Size GetMaxNativeSize(const display::ManagedDisplayInfo& info) {
|
| +gfx::Size GetMaxNativeSize(const ManagedDisplayInfo& info) {
|
| gfx::Size size;
|
| for (auto& mode : info.display_modes()) {
|
| if (mode->size().GetArea() > size.GetArea())
|
| @@ -110,17 +108,16 @@ gfx::Size GetMaxNativeSize(const display::ManagedDisplayInfo& info) {
|
| return size;
|
| }
|
|
|
| -scoped_refptr<display::ManagedDisplayMode> GetDefaultDisplayMode(
|
| - const display::ManagedDisplayInfo& info) {
|
| +scoped_refptr<ManagedDisplayMode> GetDefaultDisplayMode(
|
| + const ManagedDisplayInfo& info) {
|
| const auto& modes = info.display_modes();
|
| - auto iter =
|
| - std::find_if(modes.begin(), modes.end(),
|
| - [](const scoped_refptr<display::ManagedDisplayMode>& mode) {
|
| - return mode->is_default();
|
| - });
|
| + auto iter = std::find_if(modes.begin(), modes.end(),
|
| + [](const scoped_refptr<ManagedDisplayMode>& mode) {
|
| + return mode->is_default();
|
| + });
|
|
|
| if (iter == modes.end())
|
| - return scoped_refptr<display::ManagedDisplayMode>();
|
| + return scoped_refptr<ManagedDisplayMode>();
|
| return *iter;
|
| }
|
|
|
| @@ -132,9 +129,9 @@ using std::vector;
|
| // static
|
| int64_t DisplayManager::kUnifiedDisplayId = -10;
|
|
|
| -DisplayManager::DisplayManager(std::unique_ptr<display::Screen> screen)
|
| +DisplayManager::DisplayManager(std::unique_ptr<Screen> screen)
|
| : screen_(std::move(screen)),
|
| - layout_store_(new display::DisplayLayoutStore),
|
| + layout_store_(new DisplayLayoutStore),
|
| weak_ptr_factory_(this) {
|
| #if defined(OS_CHROMEOS)
|
| change_display_upon_host_resize_ = !base::SysInfo::IsRunningOnChromeOS();
|
| @@ -159,7 +156,7 @@ bool DisplayManager::InitFromCommandLine() {
|
| command_line->GetSwitchValueASCII(::switches::kHostWindowBounds);
|
| for (const std::string& part : base::SplitString(
|
| size_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
|
| - info_list.push_back(display::ManagedDisplayInfo::CreateFromSpec(part));
|
| + info_list.push_back(ManagedDisplayInfo::CreateFromSpec(part));
|
| info_list.back().set_native(true);
|
| }
|
| MaybeInitInternalDisplay(&info_list[0]);
|
| @@ -173,8 +170,7 @@ bool DisplayManager::InitFromCommandLine() {
|
|
|
| void DisplayManager::InitDefaultDisplay() {
|
| DisplayInfoList info_list;
|
| - info_list.push_back(
|
| - display::ManagedDisplayInfo::CreateFromSpec(std::string()));
|
| + info_list.push_back(ManagedDisplayInfo::CreateFromSpec(std::string()));
|
| info_list.back().set_native(true);
|
| MaybeInitInternalDisplay(&info_list[0]);
|
| OnNativeDisplaysChanged(info_list);
|
| @@ -186,8 +182,8 @@ void DisplayManager::RefreshFontParams() {
|
| // internal display may have bigger scale factor in case the external display
|
| // is an 4K display.
|
| float largest_device_scale_factor = 1.0f;
|
| - for (const display::Display& display : active_display_list_) {
|
| - const display::ManagedDisplayInfo& info = display_info_[display.id()];
|
| + for (const Display& display : active_display_list_) {
|
| + const ManagedDisplayInfo& info = display_info_[display.id()];
|
| largest_device_scale_factor = std::max(
|
| largest_device_scale_factor, info.GetEffectiveDeviceScaleFactor());
|
| }
|
| @@ -195,22 +191,22 @@ void DisplayManager::RefreshFontParams() {
|
| #endif // OS_CHROMEOS
|
| }
|
|
|
| -const display::DisplayLayout& DisplayManager::GetCurrentDisplayLayout() const {
|
| +const DisplayLayout& DisplayManager::GetCurrentDisplayLayout() const {
|
| DCHECK_LE(2U, num_connected_displays());
|
| if (num_connected_displays() > 1) {
|
| - display::DisplayIdList list = GetCurrentDisplayIdList();
|
| + DisplayIdList list = GetCurrentDisplayIdList();
|
| return layout_store_->GetRegisteredDisplayLayout(list);
|
| }
|
| LOG(ERROR) << "DisplayLayout is requested for single display";
|
| // On release build, just fallback to default instead of blowing up.
|
| - static display::DisplayLayout layout;
|
| + static DisplayLayout layout;
|
| layout.primary_id = active_display_list_[0].id();
|
| return layout;
|
| }
|
|
|
| -display::DisplayIdList DisplayManager::GetCurrentDisplayIdList() const {
|
| +DisplayIdList DisplayManager::GetCurrentDisplayIdList() const {
|
| if (IsInUnifiedMode()) {
|
| - return display::CreateDisplayIdList(software_mirroring_display_list_);
|
| + return CreateDisplayIdList(software_mirroring_display_list_);
|
| } else if (IsInMirrorMode()) {
|
| if (software_mirroring_enabled()) {
|
| CHECK_EQ(2u, num_connected_displays());
|
| @@ -219,22 +215,22 @@ display::DisplayIdList DisplayManager::GetCurrentDisplayIdList() const {
|
| CHECK_EQ(1u, active_display_list_.size());
|
| }
|
| int64_t ids[] = {active_display_list_[0].id(), mirroring_display_id_};
|
| - return display::GenerateDisplayIdList(std::begin(ids), std::end(ids));
|
| + return GenerateDisplayIdList(std::begin(ids), std::end(ids));
|
| } else {
|
| CHECK_LE(2u, active_display_list_.size());
|
| - return display::CreateDisplayIdList(active_display_list_);
|
| + return CreateDisplayIdList(active_display_list_);
|
| }
|
| }
|
|
|
| void DisplayManager::SetLayoutForCurrentDisplays(
|
| - std::unique_ptr<display::DisplayLayout> layout) {
|
| + std::unique_ptr<DisplayLayout> layout) {
|
| if (GetNumDisplays() == 1)
|
| return;
|
| - const display::DisplayIdList list = GetCurrentDisplayIdList();
|
| + const DisplayIdList list = GetCurrentDisplayIdList();
|
|
|
| - DCHECK(display::DisplayLayout::Validate(list, *layout));
|
| + DCHECK(DisplayLayout::Validate(list, *layout));
|
|
|
| - const display::DisplayLayout& current_layout =
|
| + const DisplayLayout& current_layout =
|
| layout_store_->GetRegisteredDisplayLayout(list);
|
|
|
| if (layout->HasSamePlacementList(current_layout))
|
| @@ -249,39 +245,36 @@ void DisplayManager::SetLayoutForCurrentDisplays(
|
| ApplyDisplayLayout(GetCurrentDisplayLayout(), &active_display_list_,
|
| &updated_ids);
|
| for (int64_t id : updated_ids) {
|
| - NotifyMetricsChanged(
|
| - GetDisplayForId(id),
|
| - display::DisplayObserver::DISPLAY_METRIC_BOUNDS |
|
| - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
|
| + NotifyMetricsChanged(GetDisplayForId(id),
|
| + DisplayObserver::DISPLAY_METRIC_BOUNDS |
|
| + DisplayObserver::DISPLAY_METRIC_WORK_AREA);
|
| }
|
|
|
| if (delegate_)
|
| delegate_->PostDisplayConfigurationChange(false);
|
| }
|
|
|
| -const display::Display& DisplayManager::GetDisplayForId(int64_t id) const {
|
| - display::Display* display =
|
| - const_cast<DisplayManager*>(this)->FindDisplayForId(id);
|
| +const Display& DisplayManager::GetDisplayForId(int64_t id) const {
|
| + Display* display = const_cast<DisplayManager*>(this)->FindDisplayForId(id);
|
| return display ? *display : GetInvalidDisplay();
|
| }
|
|
|
| -const display::Display& DisplayManager::FindDisplayContainingPoint(
|
| +const Display& DisplayManager::FindDisplayContainingPoint(
|
| const gfx::Point& point_in_screen) const {
|
| - int index = display::FindDisplayIndexContainingPoint(active_display_list_,
|
| - point_in_screen);
|
| + int index =
|
| + FindDisplayIndexContainingPoint(active_display_list_, point_in_screen);
|
| return index < 0 ? GetInvalidDisplay() : active_display_list_[index];
|
| }
|
|
|
| bool DisplayManager::UpdateWorkAreaOfDisplay(int64_t display_id,
|
| const gfx::Insets& insets) {
|
| - display::Display* display = FindDisplayForId(display_id);
|
| + Display* display = FindDisplayForId(display_id);
|
| DCHECK(display);
|
| gfx::Rect old_work_area = display->work_area();
|
| display->UpdateWorkAreaFromInsets(insets);
|
| bool workarea_changed = old_work_area != display->work_area();
|
| if (workarea_changed) {
|
| - NotifyMetricsChanged(*display,
|
| - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
|
| + NotifyMetricsChanged(*display, DisplayObserver::DISPLAY_METRIC_WORK_AREA);
|
| }
|
| return workarea_changed;
|
| }
|
| @@ -291,7 +284,7 @@ void DisplayManager::SetOverscanInsets(int64_t display_id,
|
| bool update = false;
|
| DisplayInfoList display_info_list;
|
| for (const auto& display : active_display_list_) {
|
| - display::ManagedDisplayInfo info = GetDisplayInfo(display.id());
|
| + ManagedDisplayInfo info = GetDisplayInfo(display.id());
|
| if (info.id() == display_id) {
|
| if (insets_in_dip.IsEmpty()) {
|
| info.set_clear_overscan_insets(true);
|
| @@ -311,17 +304,16 @@ void DisplayManager::SetOverscanInsets(int64_t display_id,
|
| }
|
| }
|
|
|
| -void DisplayManager::SetDisplayRotation(
|
| - int64_t display_id,
|
| - display::Display::Rotation rotation,
|
| - display::Display::RotationSource source) {
|
| +void DisplayManager::SetDisplayRotation(int64_t display_id,
|
| + Display::Rotation rotation,
|
| + Display::RotationSource source) {
|
| if (IsInUnifiedMode())
|
| return;
|
|
|
| DisplayInfoList display_info_list;
|
| bool is_active = false;
|
| for (const auto& display : active_display_list_) {
|
| - display::ManagedDisplayInfo info = GetDisplayInfo(display.id());
|
| + ManagedDisplayInfo info = GetDisplayInfo(display.id());
|
| if (info.id() == display_id) {
|
| if (info.GetRotation(source) == rotation &&
|
| info.GetActiveRotation() == rotation) {
|
| @@ -343,14 +335,14 @@ void DisplayManager::SetDisplayRotation(
|
|
|
| bool DisplayManager::SetDisplayMode(
|
| int64_t display_id,
|
| - const scoped_refptr<display::ManagedDisplayMode>& display_mode) {
|
| + const scoped_refptr<ManagedDisplayMode>& display_mode) {
|
| bool change_ui_scale = GetDisplayIdForUIScaling() == display_id;
|
|
|
| DisplayInfoList display_info_list;
|
| bool display_property_changed = false;
|
| bool resolution_changed = false;
|
| for (const auto& display : active_display_list_) {
|
| - display::ManagedDisplayInfo info = GetDisplayInfo(display.id());
|
| + ManagedDisplayInfo info = GetDisplayInfo(display.id());
|
| if (info.id() == display_id) {
|
| auto iter = FindDisplayMode(info, display_mode);
|
| if (iter == info.display_modes().end()) {
|
| @@ -395,7 +387,7 @@ bool DisplayManager::SetDisplayMode(
|
|
|
| void DisplayManager::RegisterDisplayProperty(
|
| int64_t display_id,
|
| - display::Display::Rotation rotation,
|
| + Display::Rotation rotation,
|
| float ui_scale,
|
| const gfx::Insets* overscan_insets,
|
| const gfx::Size& resolution_in_pixels,
|
| @@ -403,16 +395,16 @@ void DisplayManager::RegisterDisplayProperty(
|
| ui::ColorCalibrationProfile color_profile) {
|
| if (display_info_.find(display_id) == display_info_.end())
|
| display_info_[display_id] =
|
| - display::ManagedDisplayInfo(display_id, std::string(), false);
|
| + ManagedDisplayInfo(display_id, std::string(), false);
|
|
|
| // Do not allow rotation in unified desktop mode.
|
| if (display_id == kUnifiedDisplayId)
|
| - rotation = display::Display::ROTATE_0;
|
| + rotation = Display::ROTATE_0;
|
|
|
| display_info_[display_id].SetRotation(rotation,
|
| - display::Display::ROTATION_SOURCE_USER);
|
| - display_info_[display_id].SetRotation(
|
| - rotation, display::Display::ROTATION_SOURCE_ACTIVE);
|
| + Display::ROTATION_SOURCE_USER);
|
| + display_info_[display_id].SetRotation(rotation,
|
| + Display::ROTATION_SOURCE_ACTIVE);
|
| display_info_[display_id].SetColorProfile(color_profile);
|
| // Just in case the preference file was corrupted.
|
| // TODO(mukai): register |display_modes_| here as well, so the lookup for the
|
| @@ -422,19 +414,18 @@ void DisplayManager::RegisterDisplayProperty(
|
| if (overscan_insets)
|
| display_info_[display_id].SetOverscanInsets(*overscan_insets);
|
| if (!resolution_in_pixels.IsEmpty()) {
|
| - DCHECK(!display::Display::IsInternalDisplayId(display_id));
|
| + DCHECK(!Display::IsInternalDisplayId(display_id));
|
| // Default refresh rate, until OnNativeDisplaysChanged() updates us with the
|
| // actual display info, is 60 Hz.
|
| - scoped_refptr<display::ManagedDisplayMode> mode =
|
| - new display::ManagedDisplayMode(resolution_in_pixels, 60.0f, false,
|
| - false, 1.0, device_scale_factor);
|
| + scoped_refptr<ManagedDisplayMode> mode = new ManagedDisplayMode(
|
| + resolution_in_pixels, 60.0f, false, false, 1.0, device_scale_factor);
|
| display_modes_[display_id] = mode;
|
| }
|
| }
|
|
|
| -scoped_refptr<display::ManagedDisplayMode>
|
| -DisplayManager::GetActiveModeForDisplayId(int64_t display_id) const {
|
| - scoped_refptr<display::ManagedDisplayMode> selected_mode(
|
| +scoped_refptr<ManagedDisplayMode> DisplayManager::GetActiveModeForDisplayId(
|
| + int64_t display_id) const {
|
| + scoped_refptr<ManagedDisplayMode> selected_mode(
|
| GetSelectedModeForDisplayId(display_id));
|
| if (selected_mode)
|
| return selected_mode;
|
| @@ -444,7 +435,7 @@ DisplayManager::GetActiveModeForDisplayId(int64_t display_id) const {
|
| // for the internal display because restoring UI-scale doesn't register the
|
| // restored mode to |display_mode_|, so it needs to look up the mode whose
|
| // UI-scale value matches. See the TODO in RegisterDisplayProperty().
|
| - const display::ManagedDisplayInfo& info = GetDisplayInfo(display_id);
|
| + const ManagedDisplayInfo& info = GetDisplayInfo(display_id);
|
|
|
| for (auto& mode : info.display_modes()) {
|
| if (GetDisplayIdForUIScaling() == display_id) {
|
| @@ -459,7 +450,7 @@ DisplayManager::GetActiveModeForDisplayId(int64_t display_id) const {
|
|
|
| void DisplayManager::RegisterDisplayRotationProperties(
|
| bool rotation_lock,
|
| - display::Display::Rotation rotation) {
|
| + Display::Rotation rotation) {
|
| if (delegate_)
|
| delegate_->PreDisplayConfigurationChange(false);
|
| registered_internal_display_rotation_lock_ = rotation_lock;
|
| @@ -468,12 +459,12 @@ void DisplayManager::RegisterDisplayRotationProperties(
|
| delegate_->PostDisplayConfigurationChange(false);
|
| }
|
|
|
| -scoped_refptr<display::ManagedDisplayMode>
|
| -DisplayManager::GetSelectedModeForDisplayId(int64_t id) const {
|
| - std::map<int64_t, scoped_refptr<display::ManagedDisplayMode>>::const_iterator
|
| - iter = display_modes_.find(id);
|
| +scoped_refptr<ManagedDisplayMode> DisplayManager::GetSelectedModeForDisplayId(
|
| + int64_t id) const {
|
| + std::map<int64_t, scoped_refptr<ManagedDisplayMode>>::const_iterator iter =
|
| + display_modes_.find(id);
|
| if (iter == display_modes_.end())
|
| - return scoped_refptr<display::ManagedDisplayMode>();
|
| + return scoped_refptr<ManagedDisplayMode>();
|
| return iter->second;
|
| }
|
|
|
| @@ -482,7 +473,7 @@ bool DisplayManager::IsDisplayUIScalingEnabled() const {
|
| }
|
|
|
| gfx::Insets DisplayManager::GetOverscanInsets(int64_t display_id) const {
|
| - std::map<int64_t, display::ManagedDisplayInfo>::const_iterator it =
|
| + std::map<int64_t, ManagedDisplayInfo>::const_iterator it =
|
| display_info_.find(display_id);
|
| return (it != display_info_.end()) ? it->second.overscan_insets_in_dip()
|
| : gfx::Insets();
|
| @@ -521,7 +512,7 @@ void DisplayManager::OnNativeDisplaysChanged(
|
| if (active_display_list_.empty()) {
|
| DisplayInfoList init_displays;
|
| init_displays.push_back(
|
| - display::ManagedDisplayInfo::CreateFromSpec(std::string()));
|
| + ManagedDisplayInfo::CreateFromSpec(std::string()));
|
| MaybeInitInternalDisplay(&init_displays[0]);
|
| OnNativeDisplaysChanged(init_displays);
|
| } else {
|
| @@ -557,8 +548,7 @@ void DisplayManager::OnNativeDisplaysChanged(
|
| for (DisplayInfoList::const_iterator iter = updated_displays.begin();
|
| iter != updated_displays.end(); ++iter) {
|
| if (!internal_display_connected)
|
| - internal_display_connected =
|
| - display::Display::IsInternalDisplayId(iter->id());
|
| + internal_display_connected = Display::IsInternalDisplayId(iter->id());
|
| // Mirrored monitors have the same origins.
|
| gfx::Point origin = iter->bounds_in_native().origin();
|
| if (origins.find(origin) != origins.end()) {
|
| @@ -569,12 +559,11 @@ void DisplayManager::OnNativeDisplaysChanged(
|
| new_display_info_list.push_back(*iter);
|
| }
|
|
|
| - scoped_refptr<display::ManagedDisplayMode> new_mode(
|
| - new display::ManagedDisplayMode(
|
| - iter->bounds_in_native().size(), 0.0 /* refresh rate */,
|
| - false /* interlaced */, false /* native */,
|
| - iter->configured_ui_scale(), iter->device_scale_factor()));
|
| - const display::ManagedDisplayInfo::ManagedDisplayModeList& display_modes =
|
| + scoped_refptr<ManagedDisplayMode> new_mode(new ManagedDisplayMode(
|
| + iter->bounds_in_native().size(), 0.0 /* refresh rate */,
|
| + false /* interlaced */, false /* native */, iter->configured_ui_scale(),
|
| + iter->device_scale_factor()));
|
| + const ManagedDisplayInfo::ManagedDisplayModeList& display_modes =
|
| iter->display_modes();
|
| // This is empty the displays are initialized from InitFromCommandLine.
|
| if (display_modes.empty())
|
| @@ -586,38 +575,37 @@ void DisplayManager::OnNativeDisplaysChanged(
|
| else if (display_modes_.find(iter->id()) != display_modes_.end())
|
| display_modes_[iter->id()] = *display_modes_iter;
|
| }
|
| - if (display::Display::HasInternalDisplay() && !internal_display_connected) {
|
| - if (display_info_.find(display::Display::InternalDisplayId()) ==
|
| + if (Display::HasInternalDisplay() && !internal_display_connected) {
|
| + if (display_info_.find(Display::InternalDisplayId()) ==
|
| display_info_.end()) {
|
| // Create a dummy internal display if the chrome restarted
|
| // in docked mode.
|
| - display::ManagedDisplayInfo internal_display_info(
|
| - display::Display::InternalDisplayId(),
|
| + ManagedDisplayInfo internal_display_info(
|
| + Display::InternalDisplayId(),
|
| delegate_->GetInternalDisplayNameString(),
|
| false /*Internal display must not have overscan */);
|
| internal_display_info.SetBounds(gfx::Rect(0, 0, 800, 600));
|
| - display_info_[display::Display::InternalDisplayId()] =
|
| - internal_display_info;
|
| + display_info_[Display::InternalDisplayId()] = internal_display_info;
|
| } else {
|
| // Internal display is no longer active. Reset its rotation to user
|
| // preference, so that it is restored when the internal display becomes
|
| // active again.
|
| - display::Display::Rotation user_rotation =
|
| - display_info_[display::Display::InternalDisplayId()].GetRotation(
|
| - display::Display::ROTATION_SOURCE_USER);
|
| - display_info_[display::Display::InternalDisplayId()].SetRotation(
|
| - user_rotation, display::Display::ROTATION_SOURCE_USER);
|
| + Display::Rotation user_rotation =
|
| + display_info_[Display::InternalDisplayId()].GetRotation(
|
| + Display::ROTATION_SOURCE_USER);
|
| + display_info_[Display::InternalDisplayId()].SetRotation(
|
| + user_rotation, Display::ROTATION_SOURCE_USER);
|
| }
|
| }
|
|
|
| #if defined(OS_CHROMEOS)
|
| if (!base::SysInfo::IsRunningOnChromeOS() &&
|
| new_display_info_list.size() > 1) {
|
| - display::DisplayIdList list = GenerateDisplayIdList(
|
| + DisplayIdList list = GenerateDisplayIdList(
|
| new_display_info_list.begin(), new_display_info_list.end(),
|
| - [](const display::ManagedDisplayInfo& info) { return info.id(); });
|
| + [](const ManagedDisplayInfo& info) { return info.id(); });
|
|
|
| - const display::DisplayLayout& layout =
|
| + const DisplayLayout& layout =
|
| layout_store_->GetRegisteredDisplayLayout(list);
|
| // Mirror mode is set by DisplayConfigurator on the device.
|
| // Emulate it when running on linux desktop.
|
| @@ -652,10 +640,10 @@ void DisplayManager::UpdateDisplaysWith(
|
| DisplayInfoSortFunctor());
|
|
|
| if (new_display_info_list.size() > 1) {
|
| - display::DisplayIdList list = GenerateDisplayIdList(
|
| + DisplayIdList list = GenerateDisplayIdList(
|
| new_display_info_list.begin(), new_display_info_list.end(),
|
| - [](const display::ManagedDisplayInfo& info) { return info.id(); });
|
| - const display::DisplayLayout& layout =
|
| + [](const ManagedDisplayInfo& info) { return info.id(); });
|
| + const DisplayLayout& layout =
|
| layout_store_->GetRegisteredDisplayLayout(list);
|
| current_default_multi_display_mode_ =
|
| (layout.default_unified && unified_desktop_enabled_) ? UNIFIED
|
| @@ -672,12 +660,12 @@ void DisplayManager::UpdateDisplaysWith(
|
| if (delegate_)
|
| delegate_->CloseMirroringDisplayIfNotNecessary();
|
|
|
| - display::Displays new_displays;
|
| - display::Displays removed_displays;
|
| + Displays new_displays;
|
| + Displays removed_displays;
|
| std::map<size_t, uint32_t> display_changes;
|
| std::vector<size_t> added_display_indices;
|
|
|
| - display::Displays::iterator curr_iter = active_display_list_.begin();
|
| + Displays::iterator curr_iter = active_display_list_.begin();
|
| DisplayInfoList::const_iterator new_info_iter = new_display_info_list.begin();
|
|
|
| while (curr_iter != active_display_list_.end() ||
|
| @@ -694,18 +682,18 @@ void DisplayManager::UpdateDisplaysWith(
|
| removed_displays.push_back(*curr_iter);
|
| ++curr_iter;
|
| } else if (curr_iter->id() == new_info_iter->id()) {
|
| - const display::Display& current_display = *curr_iter;
|
| + const Display& current_display = *curr_iter;
|
| // Copy the info because |InsertAndUpdateDisplayInfo| updates the
|
| // instance.
|
| - const display::ManagedDisplayInfo current_display_info =
|
| + const ManagedDisplayInfo current_display_info =
|
| GetDisplayInfo(current_display.id());
|
| InsertAndUpdateDisplayInfo(*new_info_iter);
|
| - display::Display new_display =
|
| + Display new_display =
|
| CreateDisplayFromDisplayInfoById(new_info_iter->id());
|
| - const display::ManagedDisplayInfo& new_display_info =
|
| + const ManagedDisplayInfo& new_display_info =
|
| GetDisplayInfo(new_display.id());
|
|
|
| - uint32_t metrics = display::DisplayObserver::DISPLAY_METRIC_NONE;
|
| + uint32_t metrics = DisplayObserver::DISPLAY_METRIC_NONE;
|
|
|
| // At that point the new Display objects we have are not entirely updated,
|
| // they are missing the translation related to the Display disposition in
|
| @@ -717,19 +705,19 @@ void DisplayManager::UpdateDisplaysWith(
|
| (current_display_info.GetOverscanInsetsInPixel() !=
|
| new_display_info.GetOverscanInsetsInPixel()) ||
|
| current_display.size() != new_display.size()) {
|
| - metrics |= display::DisplayObserver::DISPLAY_METRIC_BOUNDS |
|
| - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA;
|
| + metrics |= DisplayObserver::DISPLAY_METRIC_BOUNDS |
|
| + DisplayObserver::DISPLAY_METRIC_WORK_AREA;
|
| }
|
|
|
| if (current_display.device_scale_factor() !=
|
| new_display.device_scale_factor()) {
|
| - metrics |= display::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR;
|
| + metrics |= DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR;
|
| }
|
|
|
| if (current_display.rotation() != new_display.rotation())
|
| - metrics |= display::DisplayObserver::DISPLAY_METRIC_ROTATION;
|
| + metrics |= DisplayObserver::DISPLAY_METRIC_ROTATION;
|
|
|
| - if (metrics != display::DisplayObserver::DISPLAY_METRIC_NONE) {
|
| + if (metrics != DisplayObserver::DISPLAY_METRIC_NONE) {
|
| display_changes.insert(
|
| std::pair<size_t, uint32_t>(new_displays.size(), metrics));
|
| }
|
| @@ -751,7 +739,7 @@ void DisplayManager::UpdateDisplaysWith(
|
| ++new_info_iter;
|
| }
|
| }
|
| - display::Display old_primary;
|
| + Display old_primary;
|
| if (delegate_)
|
| old_primary = screen_->GetPrimaryDisplay();
|
|
|
| @@ -769,8 +757,8 @@ void DisplayManager::UpdateDisplaysWith(
|
| for (size_t updated_index : updated_indices) {
|
| if (std::find(added_display_indices.begin(), added_display_indices.end(),
|
| updated_index) == added_display_indices.end()) {
|
| - uint32_t metrics = display::DisplayObserver::DISPLAY_METRIC_BOUNDS |
|
| - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA;
|
| + uint32_t metrics = DisplayObserver::DISPLAY_METRIC_BOUNDS |
|
| + DisplayObserver::DISPLAY_METRIC_WORK_AREA;
|
| if (display_changes.find(updated_index) != display_changes.end())
|
| metrics |= display_changes[updated_index];
|
|
|
| @@ -806,11 +794,11 @@ void DisplayManager::UpdateDisplaysWith(
|
| for (std::map<size_t, uint32_t>::iterator iter = display_changes.begin();
|
| iter != display_changes.end(); ++iter) {
|
| uint32_t metrics = iter->second;
|
| - const display::Display& updated_display = active_display_list_[iter->first];
|
| + const Display& updated_display = active_display_list_[iter->first];
|
|
|
| if (notify_primary_change &&
|
| updated_display.id() == screen_->GetPrimaryDisplay().id()) {
|
| - metrics |= display::DisplayObserver::DISPLAY_METRIC_PRIMARY;
|
| + metrics |= DisplayObserver::DISPLAY_METRIC_PRIMARY;
|
| notify_primary_change = false;
|
| }
|
| NotifyMetricsChanged(updated_display, metrics);
|
| @@ -819,15 +807,15 @@ void DisplayManager::UpdateDisplaysWith(
|
| if (notify_primary_change) {
|
| // This happens when a primary display has moved to anther display without
|
| // bounds change.
|
| - const display::Display& primary = screen_->GetPrimaryDisplay();
|
| + const Display& primary = screen_->GetPrimaryDisplay();
|
| if (primary.id() != old_primary.id()) {
|
| - uint32_t metrics = display::DisplayObserver::DISPLAY_METRIC_PRIMARY;
|
| + uint32_t metrics = DisplayObserver::DISPLAY_METRIC_PRIMARY;
|
| if (primary.size() != old_primary.size()) {
|
| - metrics |= (display::DisplayObserver::DISPLAY_METRIC_BOUNDS |
|
| - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
|
| + metrics |= (DisplayObserver::DISPLAY_METRIC_BOUNDS |
|
| + DisplayObserver::DISPLAY_METRIC_WORK_AREA);
|
| }
|
| if (primary.device_scale_factor() != old_primary.device_scale_factor())
|
| - metrics |= display::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR;
|
| + metrics |= DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR;
|
|
|
| NotifyMetricsChanged(primary, metrics);
|
| }
|
| @@ -848,15 +836,15 @@ void DisplayManager::UpdateDisplaysWith(
|
| CreateMirrorWindowAsyncIfAny();
|
| }
|
|
|
| -const display::Display& DisplayManager::GetDisplayAt(size_t index) const {
|
| +const Display& DisplayManager::GetDisplayAt(size_t index) const {
|
| DCHECK_LT(index, active_display_list_.size());
|
| return active_display_list_[index];
|
| }
|
|
|
| -const display::Display& DisplayManager::GetPrimaryDisplayCandidate() const {
|
| +const Display& DisplayManager::GetPrimaryDisplayCandidate() const {
|
| if (GetNumDisplays() != 2)
|
| return active_display_list_[0];
|
| - const display::DisplayLayout& layout =
|
| + const DisplayLayout& layout =
|
| layout_store_->GetRegisteredDisplayLayout(GetCurrentDisplayIdList());
|
| return GetDisplayForId(layout.primary_id);
|
| }
|
| @@ -867,7 +855,7 @@ size_t DisplayManager::GetNumDisplays() const {
|
|
|
| bool DisplayManager::IsActiveDisplayId(int64_t display_id) const {
|
| return std::find_if(active_display_list_.begin(), active_display_list_.end(),
|
| - [display_id](const display::Display& display) {
|
| + [display_id](const Display& display) {
|
| return display.id() == display_id;
|
| }) != active_display_list_.end();
|
| }
|
| @@ -890,32 +878,31 @@ bool DisplayManager::IsInUnifiedMode() const {
|
| !software_mirroring_display_list_.empty();
|
| }
|
|
|
| -const display::ManagedDisplayInfo& DisplayManager::GetDisplayInfo(
|
| +const ManagedDisplayInfo& DisplayManager::GetDisplayInfo(
|
| int64_t display_id) const {
|
| DCHECK_NE(kInvalidDisplayId, display_id);
|
|
|
| - std::map<int64_t, display::ManagedDisplayInfo>::const_iterator iter =
|
| + std::map<int64_t, ManagedDisplayInfo>::const_iterator iter =
|
| display_info_.find(display_id);
|
| CHECK(iter != display_info_.end()) << display_id;
|
| return iter->second;
|
| }
|
|
|
| -const display::Display DisplayManager::GetMirroringDisplayById(
|
| +const Display DisplayManager::GetMirroringDisplayById(
|
| int64_t display_id) const {
|
| auto iter = std::find_if(software_mirroring_display_list_.begin(),
|
| software_mirroring_display_list_.end(),
|
| - [display_id](const display::Display& display) {
|
| + [display_id](const Display& display) {
|
| return display.id() == display_id;
|
| });
|
| - return iter == software_mirroring_display_list_.end() ? display::Display()
|
| - : *iter;
|
| + return iter == software_mirroring_display_list_.end() ? Display() : *iter;
|
| }
|
|
|
| std::string DisplayManager::GetDisplayNameForId(int64_t id) {
|
| if (id == kInvalidDisplayId)
|
| return delegate_->GetInternalDisplayNameString();
|
|
|
| - std::map<int64_t, display::ManagedDisplayInfo>::const_iterator iter =
|
| + std::map<int64_t, ManagedDisplayInfo>::const_iterator iter =
|
| display_info_.find(id);
|
| if (iter != display_info_.end() && !iter->second.name().empty())
|
| return iter->second.name();
|
| @@ -925,9 +912,8 @@ std::string DisplayManager::GetDisplayNameForId(int64_t id) {
|
|
|
| int64_t DisplayManager::GetDisplayIdForUIScaling() const {
|
| // UI Scaling is effective on internal display.
|
| - return display::Display::HasInternalDisplay()
|
| - ? display::Display::InternalDisplayId()
|
| - : kInvalidDisplayId;
|
| + return Display::HasInternalDisplay() ? Display::InternalDisplayId()
|
| + : kInvalidDisplayId;
|
| }
|
|
|
| void DisplayManager::SetMirrorMode(bool mirror) {
|
| @@ -952,7 +938,7 @@ void DisplayManager::SetMirrorMode(bool mirror) {
|
| void DisplayManager::AddRemoveDisplay() {
|
| DCHECK(!active_display_list_.empty());
|
| DisplayInfoList new_display_info_list;
|
| - const display::ManagedDisplayInfo& first_display =
|
| + const ManagedDisplayInfo& first_display =
|
| IsInUnifiedMode()
|
| ? GetDisplayInfo(software_mirroring_display_list_[0].id())
|
| : GetDisplayInfo(active_display_list_[0].id());
|
| @@ -963,7 +949,7 @@ void DisplayManager::AddRemoveDisplay() {
|
| // Layout the 2nd display below the primary as with the real device.
|
| gfx::Rect host_bounds = first_display.bounds_in_native();
|
| new_display_info_list.push_back(
|
| - display::ManagedDisplayInfo::CreateFromSpec(base::StringPrintf(
|
| + ManagedDisplayInfo::CreateFromSpec(base::StringPrintf(
|
| "%d+%d-600x%d", host_bounds.x(),
|
| host_bounds.bottom() + kVerticalOffsetPx, host_bounds.height())));
|
| }
|
| @@ -976,9 +962,9 @@ void DisplayManager::AddRemoveDisplay() {
|
| void DisplayManager::ToggleDisplayScaleFactor() {
|
| DCHECK(!active_display_list_.empty());
|
| DisplayInfoList new_display_info_list;
|
| - for (display::Displays::const_iterator iter = active_display_list_.begin();
|
| + for (Displays::const_iterator iter = active_display_list_.begin();
|
| iter != active_display_list_.end(); ++iter) {
|
| - display::ManagedDisplayInfo display_info = GetDisplayInfo(iter->id());
|
| + ManagedDisplayInfo display_info = GetDisplayInfo(iter->id());
|
| display_info.set_device_scale_factor(
|
| display_info.device_scale_factor() == 1.0f ? 2.0f : 1.0f);
|
| new_display_info_list.push_back(display_info);
|
| @@ -1001,7 +987,7 @@ bool DisplayManager::SoftwareMirroringEnabled() const {
|
| void DisplayManager::SetDefaultMultiDisplayModeForCurrentDisplays(
|
| MultiDisplayMode mode) {
|
| DCHECK_NE(MIRRORING, mode);
|
| - display::DisplayIdList list = GetCurrentDisplayIdList();
|
| + DisplayIdList list = GetCurrentDisplayIdList();
|
| layout_store_->UpdateMultiDisplayState(list, IsInMirrorMode(),
|
| mode == UNIFIED);
|
| ReconfigureDisplays();
|
| @@ -1015,12 +1001,12 @@ void DisplayManager::SetMultiDisplayMode(MultiDisplayMode mode) {
|
|
|
| void DisplayManager::ReconfigureDisplays() {
|
| DisplayInfoList display_info_list;
|
| - for (const display::Display& display : active_display_list_) {
|
| + for (const Display& display : active_display_list_) {
|
| if (display.id() == kUnifiedDisplayId)
|
| continue;
|
| display_info_list.push_back(GetDisplayInfo(display.id()));
|
| }
|
| - for (const display::Display& display : software_mirroring_display_list_)
|
| + for (const Display& display : software_mirroring_display_list_)
|
| display_info_list.push_back(GetDisplayInfo(display.id()));
|
| mirroring_display_id_ = kInvalidDisplayId;
|
| software_mirroring_display_list_.clear();
|
| @@ -1034,10 +1020,9 @@ bool DisplayManager::UpdateDisplayBounds(int64_t display_id,
|
| // Don't notify observers if the mirrored window has changed.
|
| if (software_mirroring_enabled() && mirroring_display_id_ == display_id)
|
| return false;
|
| - display::Display* display = FindDisplayForId(display_id);
|
| + Display* display = FindDisplayForId(display_id);
|
| display->SetSize(display_info_[display_id].size_in_pixel());
|
| - NotifyMetricsChanged(*display,
|
| - display::DisplayObserver::DISPLAY_METRIC_BOUNDS);
|
| + NotifyMetricsChanged(*display, DisplayObserver::DISPLAY_METRIC_BOUNDS);
|
| return true;
|
| }
|
| return false;
|
| @@ -1055,25 +1040,24 @@ void DisplayManager::CreateMirrorWindowAsyncIfAny() {
|
| }
|
|
|
| void DisplayManager::UpdateInternalManagedDisplayModeListForTest() {
|
| - if (!display::Display::HasInternalDisplay() ||
|
| - display_info_.count(display::Display::InternalDisplayId()) == 0)
|
| + if (!Display::HasInternalDisplay() ||
|
| + display_info_.count(Display::InternalDisplayId()) == 0)
|
| return;
|
| - display::ManagedDisplayInfo* info =
|
| - &display_info_[display::Display::InternalDisplayId()];
|
| + ManagedDisplayInfo* info = &display_info_[Display::InternalDisplayId()];
|
| SetInternalManagedDisplayModeList(info);
|
| }
|
|
|
| bool DisplayManager::ZoomInternalDisplay(bool up) {
|
| int64_t display_id =
|
| IsInUnifiedMode() ? kUnifiedDisplayId : GetDisplayIdForUIScaling();
|
| - const display::ManagedDisplayInfo& display_info = GetDisplayInfo(display_id);
|
| + const ManagedDisplayInfo& display_info = GetDisplayInfo(display_id);
|
|
|
| - scoped_refptr<display::ManagedDisplayMode> mode;
|
| + scoped_refptr<ManagedDisplayMode> mode;
|
| if (IsInUnifiedMode()) {
|
| mode = GetDisplayModeForNextResolution(display_info, up);
|
| } else {
|
| if (!IsActiveDisplayId(display_info.id()) ||
|
| - !display::Display::IsInternalDisplayId(display_info.id())) {
|
| + !Display::IsInternalDisplayId(display_info.id())) {
|
| return false;
|
| }
|
| mode = GetDisplayModeForNextUIScale(display_info, up);
|
| @@ -1083,26 +1067,25 @@ bool DisplayManager::ZoomInternalDisplay(bool up) {
|
| }
|
|
|
| bool DisplayManager::ResetDisplayToDefaultMode(int64_t id) {
|
| - if (!IsActiveDisplayId(id) || !display::Display::IsInternalDisplayId(id))
|
| + if (!IsActiveDisplayId(id) || !Display::IsInternalDisplayId(id))
|
| return false;
|
|
|
| - const display::ManagedDisplayInfo& info = GetDisplayInfo(id);
|
| - scoped_refptr<display::ManagedDisplayMode> mode = GetDefaultDisplayMode(info);
|
| + const ManagedDisplayInfo& info = GetDisplayInfo(id);
|
| + scoped_refptr<ManagedDisplayMode> mode = GetDefaultDisplayMode(info);
|
|
|
| return mode ? SetDisplayMode(id, mode) : false;
|
| }
|
|
|
| void DisplayManager::ResetInternalDisplayZoom() {
|
| if (IsInUnifiedMode()) {
|
| - const display::ManagedDisplayInfo& display_info =
|
| + const ManagedDisplayInfo& display_info =
|
| GetDisplayInfo(DisplayManager::kUnifiedDisplayId);
|
| - const display::ManagedDisplayInfo::ManagedDisplayModeList& modes =
|
| + const ManagedDisplayInfo::ManagedDisplayModeList& modes =
|
| display_info.display_modes();
|
| - auto iter = std::find_if(
|
| - modes.begin(), modes.end(),
|
| - [](const scoped_refptr<display::ManagedDisplayMode>& mode) {
|
| - return mode->native();
|
| - });
|
| + auto iter = std::find_if(modes.begin(), modes.end(),
|
| + [](const scoped_refptr<ManagedDisplayMode>& mode) {
|
| + return mode->native();
|
| + });
|
| SetDisplayMode(kUnifiedDisplayId, *iter);
|
| } else {
|
| ResetDisplayToDefaultMode(GetDisplayIdForUIScaling());
|
| @@ -1121,19 +1104,19 @@ void DisplayManager::CreateSoftwareMirroringDisplayInfo(
|
| return;
|
| bool zero_is_source =
|
| first_display_id_ == (*display_info_list)[0].id() ||
|
| - display::Display::IsInternalDisplayId((*display_info_list)[0].id());
|
| + Display::IsInternalDisplayId((*display_info_list)[0].id());
|
| DCHECK_EQ(MIRRORING, multi_display_mode_);
|
| mirroring_display_id_ = (*display_info_list)[zero_is_source ? 1 : 0].id();
|
|
|
| int64_t display_id = mirroring_display_id_;
|
| auto iter =
|
| std::find_if(display_info_list->begin(), display_info_list->end(),
|
| - [display_id](const display::ManagedDisplayInfo& info) {
|
| + [display_id](const ManagedDisplayInfo& info) {
|
| return info.id() == display_id;
|
| });
|
| DCHECK(iter != display_info_list->end());
|
|
|
| - display::ManagedDisplayInfo info = *iter;
|
| + ManagedDisplayInfo info = *iter;
|
| info.SetOverscanInsets(gfx::Insets());
|
| InsertAndUpdateDisplayInfo(info);
|
| software_mirroring_display_list_.push_back(
|
| @@ -1157,14 +1140,13 @@ void DisplayManager::CreateSoftwareMirroringDisplayInfo(
|
| float default_device_scale_factor = 1.0f;
|
| for (auto& info : *display_info_list) {
|
| max_height = std::max(max_height, info.size_in_pixel().height());
|
| - if (!default_height ||
|
| - display::Display::IsInternalDisplayId(info.id())) {
|
| + if (!default_height || Display::IsInternalDisplayId(info.id())) {
|
| default_height = info.size_in_pixel().height();
|
| default_device_scale_factor = info.device_scale_factor();
|
| }
|
| }
|
|
|
| - display::ManagedDisplayInfo::ManagedDisplayModeList display_mode_list;
|
| + ManagedDisplayInfo::ManagedDisplayModeList display_mode_list;
|
| std::set<std::pair<float, float>> dsf_scale_list;
|
|
|
| // 2nd Pass. Compute the unified display size.
|
| @@ -1174,7 +1156,7 @@ void DisplayManager::CreateSoftwareMirroringDisplayInfo(
|
| float scale =
|
| info.size_in_pixel().height() / static_cast<float>(max_height);
|
| // The display is scaled to fit the unified desktop size.
|
| - display::Display display = CreateMirroringDisplayFromDisplayInfoById(
|
| + Display display = CreateMirroringDisplayFromDisplayInfoById(
|
| info.id(), origin, 1.0f / scale);
|
| unified_bounds.Union(display.bounds());
|
|
|
| @@ -1182,26 +1164,24 @@ void DisplayManager::CreateSoftwareMirroringDisplayInfo(
|
| std::make_pair(info.device_scale_factor(), scale));
|
| }
|
|
|
| - display::ManagedDisplayInfo info(kUnifiedDisplayId, "Unified Desktop",
|
| - false);
|
| + ManagedDisplayInfo info(kUnifiedDisplayId, "Unified Desktop", false);
|
|
|
| - scoped_refptr<display::ManagedDisplayMode> native_mode(
|
| - new display::ManagedDisplayMode(unified_bounds.size(), 60.0f, false,
|
| - true, 1.0, 1.0));
|
| - display::ManagedDisplayInfo::ManagedDisplayModeList modes =
|
| + scoped_refptr<ManagedDisplayMode> native_mode(new ManagedDisplayMode(
|
| + unified_bounds.size(), 60.0f, false, true, 1.0, 1.0));
|
| + ManagedDisplayInfo::ManagedDisplayModeList modes =
|
| CreateUnifiedManagedDisplayModeList(native_mode, dsf_scale_list);
|
|
|
| // Find the default mode.
|
| auto iter = std::find_if(
|
| modes.begin(), modes.end(),
|
| [default_height, default_device_scale_factor](
|
| - const scoped_refptr<display::ManagedDisplayMode>& mode) {
|
| + const scoped_refptr<ManagedDisplayMode>& mode) {
|
| return mode->size().height() == default_height &&
|
| mode->device_scale_factor() == default_device_scale_factor;
|
| });
|
|
|
| - scoped_refptr<display::ManagedDisplayMode> dm(*iter);
|
| - *iter = make_scoped_refptr(new display::ManagedDisplayMode(
|
| + scoped_refptr<ManagedDisplayMode> dm(*iter);
|
| + *iter = make_scoped_refptr(new ManagedDisplayMode(
|
| dm->size(), dm->refresh_rate(), dm->is_interlaced(),
|
| true /* native */, dm->ui_scale(), dm->device_scale_factor()));
|
|
|
| @@ -1219,7 +1199,7 @@ void DisplayManager::CreateSoftwareMirroringDisplayInfo(
|
|
|
| // 3rd Pass. Set the selected mode, then recompute the mirroring
|
| // display size.
|
| - scoped_refptr<display::ManagedDisplayMode> mode =
|
| + scoped_refptr<ManagedDisplayMode> mode =
|
| GetSelectedModeForDisplayId(kUnifiedDisplayId);
|
| if (mode && FindDisplayMode(info, mode) != info.display_modes().end()) {
|
| info.set_device_scale_factor(mode->device_scale_factor());
|
| @@ -1233,7 +1213,7 @@ void DisplayManager::CreateSoftwareMirroringDisplayInfo(
|
| for (auto& info : *display_info_list) {
|
| float display_scale = info.size_in_pixel().height() /
|
| static_cast<float>(unified_display_height);
|
| - display::Display display = CreateMirroringDisplayFromDisplayInfoById(
|
| + Display display = CreateMirroringDisplayFromDisplayInfoById(
|
| info.id(), origin, 1.0f / display_scale);
|
| origin.Offset(display.size().width(), 0);
|
| display.UpdateWorkAreaFromInsets(gfx::Insets());
|
| @@ -1250,10 +1230,10 @@ void DisplayManager::CreateSoftwareMirroringDisplayInfo(
|
| }
|
| }
|
|
|
| -display::Display* DisplayManager::FindDisplayForId(int64_t id) {
|
| - auto iter = std::find_if(
|
| - active_display_list_.begin(), active_display_list_.end(),
|
| - [id](const display::Display& display) { return display.id() == id; });
|
| +Display* DisplayManager::FindDisplayForId(int64_t id) {
|
| + auto iter =
|
| + std::find_if(active_display_list_.begin(), active_display_list_.end(),
|
| + [id](const Display& display) { return display.id() == id; });
|
| if (iter != active_display_list_.end())
|
| return &(*iter);
|
| // TODO(oshima): This happens when windows in unified desktop have
|
| @@ -1272,8 +1252,8 @@ void DisplayManager::AddMirrorDisplayInfoIfAny(
|
| }
|
|
|
| void DisplayManager::InsertAndUpdateDisplayInfo(
|
| - const display::ManagedDisplayInfo& new_info) {
|
| - std::map<int64_t, display::ManagedDisplayInfo>::iterator info =
|
| + const ManagedDisplayInfo& new_info) {
|
| + std::map<int64_t, ManagedDisplayInfo>::iterator info =
|
| display_info_.find(new_info.id());
|
| if (info != display_info_.end()) {
|
| info->second.Copy(new_info);
|
| @@ -1284,7 +1264,7 @@ void DisplayManager::InsertAndUpdateDisplayInfo(
|
| // It uses 1.25 DSF only when UI-Scale is set to 0.8.
|
| // For new users, use the UI-scale to 0.8 so that it will use DSF=1.25
|
| // internally.
|
| - if (display::Display::IsInternalDisplayId(new_info.id()) &&
|
| + if (Display::IsInternalDisplayId(new_info.id()) &&
|
| new_info.bounds_in_native().height() == 1080 &&
|
| new_info.device_scale_factor() == 1.25f) {
|
| display_info_[new_info.id()].set_configured_ui_scale(0.8f);
|
| @@ -1295,7 +1275,7 @@ void DisplayManager::InsertAndUpdateDisplayInfo(
|
| }
|
|
|
| void DisplayManager::OnDisplayInfoUpdated(
|
| - const display::ManagedDisplayInfo& display_info) {
|
| + const ManagedDisplayInfo& display_info) {
|
| #if defined(OS_CHROMEOS)
|
| ui::ColorCalibrationProfile color_profile = display_info.color_profile();
|
| if (color_profile != ui::COLOR_PROFILE_STANDARD) {
|
| @@ -1305,11 +1285,11 @@ void DisplayManager::OnDisplayInfoUpdated(
|
| #endif
|
| }
|
|
|
| -display::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64_t id) {
|
| +Display DisplayManager::CreateDisplayFromDisplayInfoById(int64_t id) {
|
| DCHECK(display_info_.find(id) != display_info_.end()) << "id=" << id;
|
| - const display::ManagedDisplayInfo& display_info = display_info_[id];
|
| + const ManagedDisplayInfo& display_info = display_info_[id];
|
|
|
| - display::Display new_display(display_info.id());
|
| + Display new_display(display_info.id());
|
| gfx::Rect bounds_in_native(display_info.size_in_pixel());
|
| float device_scale_factor = display_info.GetEffectiveDeviceScaleFactor();
|
|
|
| @@ -1324,14 +1304,14 @@ display::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64_t id) {
|
| return new_display;
|
| }
|
|
|
| -display::Display DisplayManager::CreateMirroringDisplayFromDisplayInfoById(
|
| +Display DisplayManager::CreateMirroringDisplayFromDisplayInfoById(
|
| int64_t id,
|
| const gfx::Point& origin,
|
| float scale) {
|
| DCHECK(display_info_.find(id) != display_info_.end()) << "id=" << id;
|
| - const display::ManagedDisplayInfo& display_info = display_info_[id];
|
| + const ManagedDisplayInfo& display_info = display_info_[id];
|
|
|
| - display::Display new_display(display_info.id());
|
| + Display new_display(display_info.id());
|
| new_display.SetScaleAndBounds(
|
| 1.0f, gfx::Rect(origin, gfx::ScaleToFlooredSize(
|
| display_info.size_in_pixel(), scale)));
|
| @@ -1341,14 +1321,13 @@ display::Display DisplayManager::CreateMirroringDisplayFromDisplayInfoById(
|
| }
|
|
|
| void DisplayManager::UpdateNonPrimaryDisplayBoundsForLayout(
|
| - display::Displays* display_list,
|
| + Displays* display_list,
|
| std::vector<size_t>* updated_indices) {
|
| if (display_list->size() == 1u)
|
| return;
|
|
|
| - const display::DisplayLayout& layout =
|
| - layout_store_->GetRegisteredDisplayLayout(
|
| - display::CreateDisplayIdList(*display_list));
|
| + const DisplayLayout& layout = layout_store_->GetRegisteredDisplayLayout(
|
| + CreateDisplayIdList(*display_list));
|
|
|
| // Ignore if a user has a old format (should be extremely rare)
|
| // and this will be replaced with DCHECK.
|
| @@ -1360,9 +1339,9 @@ void DisplayManager::UpdateNonPrimaryDisplayBoundsForLayout(
|
| ApplyDisplayLayout(layout, display_list, nullptr);
|
| size_t num_displays = display_list->size();
|
| for (size_t index = 0; index < num_displays; ++index) {
|
| - const display::Display& display = (*display_list)[index];
|
| + const Display& display = (*display_list)[index];
|
| int64_t id = display.id();
|
| - const display::Display* active_display = FindDisplayForId(id);
|
| + const Display* active_display = FindDisplayForId(id);
|
| if (!active_display || (active_display->bounds() != display.bounds()))
|
| updated_indices->push_back(index);
|
| }
|
| @@ -1377,8 +1356,8 @@ void DisplayManager::CreateMirrorWindowIfAny() {
|
| delegate_->CreateOrUpdateMirroringDisplay(list);
|
| }
|
|
|
| -void DisplayManager::ApplyDisplayLayout(const display::DisplayLayout& layout,
|
| - display::Displays* display_list,
|
| +void DisplayManager::ApplyDisplayLayout(const DisplayLayout& layout,
|
| + Displays* display_list,
|
| std::vector<int64_t>* updated_ids) {
|
| layout.ApplyToDisplayList(display_list, updated_ids,
|
| kMinimumOverlapForInvalidOffset);
|
| @@ -1389,34 +1368,33 @@ void DisplayManager::RunPendingTasksForTest() {
|
| base::RunLoop().RunUntilIdle();
|
| }
|
|
|
| -void DisplayManager::NotifyMetricsChanged(const display::Display& display,
|
| +void DisplayManager::NotifyMetricsChanged(const Display& display,
|
| uint32_t metrics) {
|
| for (auto& observer : observers_)
|
| observer.OnDisplayMetricsChanged(display, metrics);
|
| }
|
|
|
| -void DisplayManager::NotifyDisplayAdded(const display::Display& display) {
|
| +void DisplayManager::NotifyDisplayAdded(const Display& display) {
|
| for (auto& observer : observers_)
|
| observer.OnDisplayAdded(display);
|
| }
|
|
|
| -void DisplayManager::NotifyDisplayRemoved(const display::Display& display) {
|
| +void DisplayManager::NotifyDisplayRemoved(const Display& display) {
|
| for (auto& observer : observers_)
|
| observer.OnDisplayRemoved(display);
|
| }
|
|
|
| -void DisplayManager::AddObserver(display::DisplayObserver* observer) {
|
| +void DisplayManager::AddObserver(DisplayObserver* observer) {
|
| observers_.AddObserver(observer);
|
| }
|
|
|
| -void DisplayManager::RemoveObserver(display::DisplayObserver* observer) {
|
| +void DisplayManager::RemoveObserver(DisplayObserver* observer) {
|
| observers_.RemoveObserver(observer);
|
| }
|
|
|
| -const display::Display& DisplayManager::GetSecondaryDisplay() const {
|
| +const Display& DisplayManager::GetSecondaryDisplay() const {
|
| CHECK_LE(2U, GetNumDisplays());
|
| - return GetDisplayAt(0).id() ==
|
| - display::Screen::GetScreen()->GetPrimaryDisplay().id()
|
| + return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id()
|
| ? GetDisplayAt(1)
|
| : GetDisplayAt(0);
|
| }
|
|
|