| Index: ash/display/display_manager.cc
|
| diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
|
| index 64f7e4687731cdb09b245e08dba7ecfa7b7c3075..ff27f3fbee6a512e06fa3772e13605c32d508dba 100644
|
| --- a/ash/display/display_manager.cc
|
| +++ b/ash/display/display_manager.cc
|
| @@ -72,6 +72,14 @@ int64 GetDisplayIdForOutput(XID output) {
|
| }
|
| #endif
|
|
|
| +gfx::Insets GetDefaultDisplayOverscan(const gfx::Display& display) {
|
| + // Currently we assume 5% overscan and hope for the best if TV claims it
|
| + // overscan, but doesn't expose how much.
|
| + int width = display.bounds().width() / 40;
|
| + int height = display.bounds().height() / 40;
|
| + return gfx::Insets(height, width, height, width);
|
| +}
|
| +
|
| } // namespace
|
|
|
| using aura::RootWindow;
|
| @@ -146,6 +154,7 @@ const gfx::Display& DisplayManager::FindDisplayContainingPoint(
|
| void DisplayManager::SetOverscanInsets(int64 display_id,
|
| const gfx::Insets& insets_in_dip) {
|
| display_info_[display_id].overscan_insets_in_dip = insets_in_dip;
|
| + display_info_[display_id].has_custom_overscan_insets = true;
|
|
|
| // Copies the |displays_| because UpdateDisplays() compares the passed
|
| // displays and its internal |displays_|.
|
| @@ -201,12 +210,16 @@ void DisplayManager::OnNativeDisplaysChanged(
|
| new_displays = updated_displays;
|
| }
|
|
|
| + RefreshDisplayInfo();
|
| +
|
| for (DisplayList::const_iterator iter = new_displays.begin();
|
| iter != new_displays.end(); ++iter) {
|
| std::map<int64, DisplayInfo>::iterator info =
|
| display_info_.find(iter->id());
|
| if (info != display_info_.end()) {
|
| info->second.original_bounds_in_pixel = iter->bounds_in_pixel();
|
| + if (info->second.has_overscan && !info->second.has_custom_overscan_insets)
|
| + info->second.overscan_insets_in_dip = GetDefaultDisplayOverscan(*iter);
|
| } else {
|
| display_info_[iter->id()].original_bounds_in_pixel =
|
| iter->bounds_in_pixel();
|
| @@ -214,7 +227,6 @@ void DisplayManager::OnNativeDisplaysChanged(
|
| }
|
|
|
| UpdateDisplays(new_displays);
|
| - RefreshDisplayNames();
|
| }
|
|
|
| void DisplayManager::UpdateDisplays(
|
| @@ -424,7 +436,7 @@ void DisplayManager::Init() {
|
| }
|
| #endif
|
|
|
| - RefreshDisplayNames();
|
| + RefreshDisplayInfo();
|
|
|
| #if defined(OS_WIN)
|
| if (base::win::GetVersion() >= base::win::VERSION_WIN8)
|
| @@ -550,7 +562,12 @@ void DisplayManager::EnsurePointerInDisplays() {
|
| root_window->MoveCursorTo(target_location);
|
| }
|
|
|
| -void DisplayManager::RefreshDisplayNames() {
|
| +DisplayManager::DisplayInfo::DisplayInfo()
|
| + : has_overscan(false),
|
| + has_custom_overscan_insets(false) {
|
| +}
|
| +
|
| +void DisplayManager::RefreshDisplayInfo() {
|
| #if defined(OS_CHROMEOS)
|
| if (!base::chromeos::IsRunningOnChromeOS())
|
| return;
|
| @@ -574,6 +591,8 @@ void DisplayManager::RefreshDisplayNames() {
|
| } else if (!name.empty()) {
|
| display_info_[id].name = name;
|
| }
|
| +
|
| + ui::GetOutputOverscanFlag(outputs[i], &display_info_[id].has_overscan);
|
| }
|
| #endif
|
| }
|
| @@ -587,5 +606,9 @@ void DisplayManager::SetDisplayIdsForTest(DisplayList* to_update) const {
|
| }
|
| }
|
|
|
| +void DisplayManager::SetHasOverscanFlagForTest(int64 id, bool has_overscan) {
|
| + display_info_[id].has_overscan = has_overscan;
|
| +}
|
| +
|
| } // namespace internal
|
| } // namespace ash
|
|
|