summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/display/display_change_observer_chromeos.cc8
-rw-r--r--ash/display/display_layout.h4
-rw-r--r--ash/display/display_layout_store.cc51
-rw-r--r--ash/display/display_layout_store.h30
-rw-r--r--ash/display/display_manager.cc44
-rw-r--r--ash/display/display_manager.h4
-rw-r--r--ash/display/display_manager_unittest.cc25
-rw-r--r--ash/display/display_util.cc16
-rw-r--r--ash/display/display_util.h6
-rw-r--r--ash/display/display_util_unittest.cc36
-rw-r--r--ash/display/window_tree_host_manager.cc15
-rw-r--r--ash/shelf/shelf_layout_manager.cc6
-rw-r--r--ash/sticky_keys/sticky_keys_overlay_unittest.cc6
-rw-r--r--ash/touch/touch_transformer_controller.cc6
-rw-r--r--chrome/browser/chromeos/display/display_preferences.cc11
-rw-r--r--chrome/browser/chromeos/display/display_preferences_unittest.cc89
-rw-r--r--chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc6
17 files changed, 191 insertions, 172 deletions
diff --git a/ash/display/display_change_observer_chromeos.cc b/ash/display/display_change_observer_chromeos.cc
index 3f820a9..97a76e0 100644
--- a/ash/display/display_change_observer_chromeos.cc
+++ b/ash/display/display_change_observer_chromeos.cc
@@ -156,10 +156,12 @@ ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds(
UpdateInternalDisplayId(display_states);
if (display_states.size() != 2)
return ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
- DisplayIdPair pair = CreateDisplayIdPair(display_states[0]->display_id(),
+ DisplayIdList list = CreateDisplayIdList(display_states[0]->display_id(),
display_states[1]->display_id());
- DisplayLayout layout = Shell::GetInstance()->display_manager()->
- layout_store()->GetRegisteredDisplayLayout(pair);
+ DisplayLayout layout = Shell::GetInstance()
+ ->display_manager()
+ ->layout_store()
+ ->GetRegisteredDisplayLayout(list);
return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR :
ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
}
diff --git a/ash/display/display_layout.h b/ash/display/display_layout.h
index 23e5779..3f4c56a 100644
--- a/ash/display/display_layout.h
+++ b/ash/display/display_layout.h
@@ -7,8 +7,8 @@
#include <stdint.h>
-#include <map>
#include <string>
+#include <vector>
#include "ash/ash_export.h"
#include "base/compiler_specific.h"
@@ -20,7 +20,7 @@ template <typename T> class JSONValueConverter;
namespace ash {
-typedef std::pair<int64_t, int64_t> DisplayIdPair;
+typedef std::vector<int64_t> DisplayIdList;
struct ASH_EXPORT DisplayLayout {
// Layout options where the secondary display should be positioned.
diff --git a/ash/display/display_layout_store.cc b/ash/display/display_layout_store.cc
index 7cf3b03..111e679 100644
--- a/ash/display/display_layout_store.cc
+++ b/ash/display/display_layout_store.cc
@@ -45,58 +45,59 @@ void DisplayLayoutStore::SetDefaultDisplayLayout(const DisplayLayout& layout) {
default_display_layout_ = layout;
}
-void DisplayLayoutStore::RegisterLayoutForDisplayIdPair(
+void DisplayLayoutStore::RegisterLayoutForDisplayIdList(
int64_t id1,
int64_t id2,
const DisplayLayout& layout) {
- auto key = CreateDisplayIdPair(id1, id2);
+ auto key = CreateDisplayIdList(id1, id2);
// Do not overwrite the valid data with old invalid date.
- if (paired_layouts_.count(key) && !CompareDisplayIds(id1, id2))
+ if (layouts_.count(key) && !CompareDisplayIds(id1, id2))
return;
- paired_layouts_[key] = layout;
+ layouts_[key] = layout;
}
DisplayLayout DisplayLayoutStore::GetRegisteredDisplayLayout(
- const DisplayIdPair& pair) {
- std::map<DisplayIdPair, DisplayLayout>::const_iterator iter =
- paired_layouts_.find(pair);
- return
- iter != paired_layouts_.end() ? iter->second : CreateDisplayLayout(pair);
+ const DisplayIdList& list) {
+ std::map<DisplayIdList, DisplayLayout>::const_iterator iter =
+ layouts_.find(list);
+ return iter != layouts_.end() ? iter->second : CreateDisplayLayout(list);
}
-DisplayLayout DisplayLayoutStore::ComputeDisplayLayoutForDisplayIdPair(
- const DisplayIdPair& pair) {
- DisplayLayout layout = GetRegisteredDisplayLayout(pair);
+DisplayLayout DisplayLayoutStore::ComputeDisplayLayoutForDisplayIdList(
+ const DisplayIdList& list) {
+ DisplayLayout layout = GetRegisteredDisplayLayout(list);
DCHECK_NE(layout.primary_id, gfx::Display::kInvalidDisplayID);
// Invert if the primary was swapped. If mirrored, first is always
// primary.
return (layout.primary_id == gfx::Display::kInvalidDisplayID ||
- pair.first == layout.primary_id) ? layout : layout.Invert();
+ list[0] == layout.primary_id)
+ ? layout
+ : layout.Invert();
}
-void DisplayLayoutStore::UpdateMultiDisplayState(const DisplayIdPair& pair,
+void DisplayLayoutStore::UpdateMultiDisplayState(const DisplayIdList& list,
bool mirrored,
bool default_unified) {
- if (paired_layouts_.find(pair) == paired_layouts_.end())
- CreateDisplayLayout(pair);
- paired_layouts_[pair].mirrored = mirrored;
- paired_layouts_[pair].default_unified = default_unified;
+ if (layouts_.find(list) == layouts_.end())
+ CreateDisplayLayout(list);
+ layouts_[list].mirrored = mirrored;
+ layouts_[list].default_unified = default_unified;
}
-void DisplayLayoutStore::UpdatePrimaryDisplayId(const DisplayIdPair& pair,
+void DisplayLayoutStore::UpdatePrimaryDisplayId(const DisplayIdList& list,
int64_t display_id) {
- if (paired_layouts_.find(pair) == paired_layouts_.end())
- CreateDisplayLayout(pair);
- paired_layouts_[pair].primary_id = display_id;
+ if (layouts_.find(list) == layouts_.end())
+ CreateDisplayLayout(list);
+ layouts_[list].primary_id = display_id;
}
DisplayLayout DisplayLayoutStore::CreateDisplayLayout(
- const DisplayIdPair& pair) {
+ const DisplayIdList& list) {
DisplayLayout layout = default_display_layout_;
- layout.primary_id = pair.first;
- paired_layouts_[pair] = layout;
+ layout.primary_id = list[0];
+ layouts_[list] = layout;
return layout;
}
diff --git a/ash/display/display_layout_store.h b/ash/display/display_layout_store.h
index 7519ec4..84c8b69 100644
--- a/ash/display/display_layout_store.h
+++ b/ash/display/display_layout_store.h
@@ -26,42 +26,42 @@ class ASH_EXPORT DisplayLayoutStore {
void SetDefaultDisplayLayout(const DisplayLayout& layout);
// Registeres the display layout info for the specified display(s).
- void RegisterLayoutForDisplayIdPair(int64_t id1,
+ void RegisterLayoutForDisplayIdList(int64_t id1,
int64_t id2,
const DisplayLayout& layout);
// If no layout is registered, it creatas new layout using
// |default_display_layout_|.
- DisplayLayout GetRegisteredDisplayLayout(const DisplayIdPair& pair);
+ DisplayLayout GetRegisteredDisplayLayout(const DisplayIdList& list);
- // Returns the display layout for the display id pair
+ // Returns the display layout for the display id list
// with display swapping applied. That is, this returns
// flipped layout if the displays are swapped.
- DisplayLayout ComputeDisplayLayoutForDisplayIdPair(
- const DisplayIdPair& display_pair);
+ DisplayLayout ComputeDisplayLayoutForDisplayIdList(
+ const DisplayIdList& display_list);
// Update the multi display state in the display layout for
- // |display_pair|. This creates new display layout if no layout is
- // registered for |display_pair|.
- void UpdateMultiDisplayState(const DisplayIdPair& display_pair,
+ // |display_list|. This creates new display layout if no layout is
+ // registered for |display_list|.
+ void UpdateMultiDisplayState(const DisplayIdList& display_list,
bool mirrored,
bool default_unified);
// Update the |primary_id| in the display layout for
- // |display_pair|. This creates new display layout if no layout is
- // registered for |display_pair|.
- void UpdatePrimaryDisplayId(const DisplayIdPair& display_pair,
+ // |display_list|. This creates new display layout if no layout is
+ // registered for |display_list|.
+ void UpdatePrimaryDisplayId(const DisplayIdList& display_list,
int64_t display_id);
private:
- // Creates new layout for display pair from |default_display_layout_|.
- DisplayLayout CreateDisplayLayout(const DisplayIdPair& display_pair);
+ // Creates new layout for display list from |default_display_layout_|.
+ DisplayLayout CreateDisplayLayout(const DisplayIdList& display_list);
// The default display layout.
DisplayLayout default_display_layout_;
- // Display layout per pair of devices.
- std::map<DisplayIdPair, DisplayLayout> paired_layouts_;
+ // Display layout per list of devices.
+ std::map<DisplayIdList, DisplayLayout> layouts_;
DISALLOW_COPY_AND_ASSIGN(DisplayLayoutStore);
};
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index d403857..93bec38 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -208,8 +208,8 @@ DisplayLayout DisplayManager::GetCurrentDisplayLayout() {
DCHECK_LE(2U, num_connected_displays());
// Invert if the primary was swapped.
if (num_connected_displays() == 2) {
- DisplayIdPair pair = GetCurrentDisplayIdPair();
- return layout_store_->ComputeDisplayLayoutForDisplayIdPair(pair);
+ DisplayIdList list = GetCurrentDisplayIdList();
+ return layout_store_->ComputeDisplayLayoutForDisplayIdList(list);
} else if (num_connected_displays() > 2) {
// Return fixed horizontal layout for >= 3 displays.
DisplayLayout layout(DisplayLayout::RIGHT, 0);
@@ -223,9 +223,9 @@ DisplayLayout DisplayManager::GetCurrentDisplayLayout() {
return layout;
}
-DisplayIdPair DisplayManager::GetCurrentDisplayIdPair() const {
+DisplayIdList DisplayManager::GetCurrentDisplayIdList() const {
if (IsInUnifiedMode()) {
- return CreateDisplayIdPair(software_mirroring_display_list_[0].id(),
+ return CreateDisplayIdList(software_mirroring_display_list_[0].id(),
software_mirroring_display_list_[1].id());
} else if (IsInMirrorMode()) {
if (software_mirroring_enabled()) {
@@ -234,11 +234,11 @@ DisplayIdPair DisplayManager::GetCurrentDisplayIdPair() const {
// between two checks.
CHECK_EQ(1u, active_display_list_.size());
}
- return CreateDisplayIdPair(active_display_list_[0].id(),
+ return CreateDisplayIdList(active_display_list_[0].id(),
mirroring_display_id_);
} else {
CHECK_LE(2u, active_display_list_.size());
- return CreateDisplayIdPair(active_display_list_[0].id(),
+ return CreateDisplayIdList(active_display_list_[0].id(),
active_display_list_[1].id());
}
}
@@ -248,18 +248,18 @@ void DisplayManager::SetLayoutForCurrentDisplays(
if (GetNumDisplays() != 2)
return;
const gfx::Display& primary = screen_->GetPrimaryDisplay();
- const DisplayIdPair pair = GetCurrentDisplayIdPair();
+ const DisplayIdList list = GetCurrentDisplayIdList();
// Invert if the primary was swapped.
- DisplayLayout to_set = pair.first == primary.id() ?
- layout_relative_to_primary : layout_relative_to_primary.Invert();
+ DisplayLayout to_set = list[0] == primary.id()
+ ? layout_relative_to_primary
+ : layout_relative_to_primary.Invert();
DisplayLayout current_layout =
- layout_store_->GetRegisteredDisplayLayout(pair);
+ layout_store_->GetRegisteredDisplayLayout(list);
if (to_set.position != current_layout.position ||
to_set.offset != current_layout.offset) {
to_set.primary_id = primary.id();
- layout_store_->RegisterLayoutForDisplayIdPair(
- pair.first, pair.second, to_set);
+ layout_store_->RegisterLayoutForDisplayIdList(list[0], list[1], to_set);
if (delegate_)
delegate_->PreDisplayConfigurationChange(false);
// PreDisplayConfigurationChange(false);
@@ -619,9 +619,9 @@ void DisplayManager::OnNativeDisplaysChanged(
#if defined(OS_CHROMEOS)
if (!base::SysInfo::IsRunningOnChromeOS() &&
new_display_info_list.size() > 1) {
- DisplayIdPair pair = CreateDisplayIdPair(new_display_info_list[0].id(),
+ DisplayIdList list = CreateDisplayIdList(new_display_info_list[0].id(),
new_display_info_list[1].id());
- DisplayLayout layout = layout_store_->GetRegisteredDisplayLayout(pair);
+ DisplayLayout layout = layout_store_->GetRegisteredDisplayLayout(list);
// Mirror mode is set by DisplayConfigurator on the device.
// Emulate it when running on linux desktop.
if (layout.mirrored)
@@ -656,9 +656,9 @@ void DisplayManager::UpdateDisplaysWith(
DisplayInfoSortFunctor());
if (new_display_info_list.size() > 1) {
- DisplayIdPair pair = CreateDisplayIdPair(new_display_info_list[0].id(),
+ DisplayIdList list = CreateDisplayIdList(new_display_info_list[0].id(),
new_display_info_list[1].id());
- DisplayLayout layout = layout_store_->GetRegisteredDisplayLayout(pair);
+ DisplayLayout layout = layout_store_->GetRegisteredDisplayLayout(list);
current_default_multi_display_mode_ =
(layout.default_unified && unified_desktop_enabled_) ? UNIFIED
: EXTENDED;
@@ -858,8 +858,8 @@ const gfx::Display& DisplayManager::GetDisplayAt(size_t index) const {
const gfx::Display& DisplayManager::GetPrimaryDisplayCandidate() const {
if (GetNumDisplays() != 2)
return active_display_list_[0];
- DisplayLayout layout = layout_store_->GetRegisteredDisplayLayout(
- GetCurrentDisplayIdPair());
+ DisplayLayout layout =
+ layout_store_->GetRegisteredDisplayLayout(GetCurrentDisplayIdList());
return GetDisplayForId(layout.primary_id);
}
@@ -999,8 +999,8 @@ bool DisplayManager::SoftwareMirroringEnabled() const {
void DisplayManager::SetDefaultMultiDisplayModeForCurrentDisplays(
MultiDisplayMode mode) {
DCHECK_NE(MIRRORING, mode);
- DisplayIdPair pair = GetCurrentDisplayIdPair();
- layout_store_->UpdateMultiDisplayState(pair, IsInMirrorMode(),
+ DisplayIdList list = GetCurrentDisplayIdList();
+ layout_store_->UpdateMultiDisplayState(list, IsInMirrorMode(),
mode == UNIFIED);
ReconfigureDisplays();
}
@@ -1307,8 +1307,8 @@ bool DisplayManager::UpdateNonPrimaryDisplayBoundsForLayout(
return true;
}
- DisplayLayout layout = layout_store_->ComputeDisplayLayoutForDisplayIdPair(
- CreateDisplayIdPair(displays->at(0).id(), displays->at(1).id()));
+ DisplayLayout layout = layout_store_->ComputeDisplayLayoutForDisplayIdList(
+ CreateDisplayIdList(displays->at(0).id(), displays->at(1).id()));
// Ignore if a user has a old format (should be extremely rare)
// and this will be replaced with DCHECK.
diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h
index 4392202..a98b2a9 100644
--- a/ash/display/display_manager.h
+++ b/ash/display/display_manager.h
@@ -135,8 +135,8 @@ class ASH_EXPORT DisplayManager
// Returns the display layout used for current displays.
DisplayLayout GetCurrentDisplayLayout();
- // Returns the current display pair.
- DisplayIdPair GetCurrentDisplayIdPair() const;
+ // Returns the current display list.
+ DisplayIdList GetCurrentDisplayIdList() const;
// Sets the layout for the current display pair. The |layout| specifies
// the locaion of the secondary display relative to the primary.
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index 4bad4eb..8e0dccd 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -1602,11 +1602,11 @@ TEST_F(DisplayManagerTest, UnifiedDesktopWithHardwareMirroring) {
// if the displays are configured to use mirroring when running on desktop.
// This is a workdaround to force the display manager to forget
// the mirroing layout.
- DisplayIdPair pair = CreateDisplayIdPair(1, 2);
+ DisplayIdList list = CreateDisplayIdList(1, 2);
DisplayLayout layout =
- display_manager()->layout_store()->GetRegisteredDisplayLayout(pair);
+ display_manager()->layout_store()->GetRegisteredDisplayLayout(list);
layout.mirrored = false;
- display_manager()->layout_store()->RegisterLayoutForDisplayIdPair(1, 2,
+ display_manager()->layout_store()->RegisterLayoutForDisplayIdList(1, 2,
layout);
// Exit from hardware mirroring.
@@ -1626,12 +1626,12 @@ TEST_F(DisplayManagerTest, UnifiedDesktopEnabledWithExtended) {
Shell::GetPrimaryRootWindow()->RemoveObserver(this);
UpdateDisplay("400x500,300x200");
- DisplayIdPair pair = display_manager()->GetCurrentDisplayIdPair();
+ DisplayIdList list = display_manager()->GetCurrentDisplayIdList();
DisplayLayout layout =
- display_manager()->layout_store()->GetRegisteredDisplayLayout(pair);
+ display_manager()->layout_store()->GetRegisteredDisplayLayout(list);
layout.default_unified = false;
- display_manager()->layout_store()->RegisterLayoutForDisplayIdPair(
- pair.first, pair.second, layout);
+ display_manager()->layout_store()->RegisterLayoutForDisplayIdList(
+ list[0], list[1], layout);
display_manager()->SetUnifiedDesktopEnabled(true);
EXPECT_FALSE(display_manager()->IsInUnifiedMode());
}
@@ -2026,16 +2026,17 @@ TEST_F(DisplayManagerTest, RejectInvalidLayoutData) {
DisplayLayout good(DisplayLayout(DisplayLayout::LEFT, 0));
good.primary_id = id1;
- layout_store->RegisterLayoutForDisplayIdPair(id1, id2, good);
+ layout_store->RegisterLayoutForDisplayIdList(id1, id2, good);
DisplayLayout bad(DisplayLayout(DisplayLayout::BOTTOM, 0));
good.primary_id = id2;
- layout_store->RegisterLayoutForDisplayIdPair(id2, id1, bad);
+ layout_store->RegisterLayoutForDisplayIdList(id2, id1, bad);
- EXPECT_EQ(good.ToString(), layout_store->GetRegisteredDisplayLayout(
- CreateDisplayIdPair(id1, id2))
- .ToString());
+ EXPECT_EQ(
+ good.ToString(),
+ layout_store->GetRegisteredDisplayLayout(CreateDisplayIdList(id1, id2))
+ .ToString());
}
#endif // OS_CHROMEOS
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc
index ce0232b..6f4d9e5 100644
--- a/ash/display/display_util.cc
+++ b/ash/display/display_util.cc
@@ -10,6 +10,7 @@
#include "ash/display/display_manager.h"
#include "ash/host/ash_window_tree_host.h"
#include "ash/shell.h"
+#include "base/strings/string_number_conversions.h"
#include "ui/aura/env.h"
#include "ui/aura/window_tree_host.h"
#include "ui/gfx/display.h"
@@ -348,9 +349,18 @@ int FindDisplayIndexContainingPoint(const std::vector<gfx::Display>& displays,
return iter == displays.end() ? -1 : (iter - displays.begin());
}
-DisplayIdPair CreateDisplayIdPair(int64_t id1, int64_t id2) {
- return CompareDisplayIds(id1, id2) ? std::make_pair(id1, id2)
- : std::make_pair(id2, id1);
+DisplayIdList CreateDisplayIdList(int64_t id1, int64_t id2) {
+ std::vector<int64_t> ids;
+
+ ids.push_back(id1);
+ ids.push_back(id2);
+ std::sort(ids.begin(), ids.end(),
+ [](int64_t a, int64_t b) { return CompareDisplayIds(a, b); });
+ return ids;
+}
+
+std::string DisplayIdListToString(const ash::DisplayIdList& list) {
+ return base::Int64ToString(list[0]) + "," + base::Int64ToString(list[1]);
}
bool CompareDisplayIds(int64_t id1, int64_t id2) {
diff --git a/ash/display/display_util.h b/ash/display/display_util.h
index ccaa8df..cf8e0e0 100644
--- a/ash/display/display_util.h
+++ b/ash/display/display_util.h
@@ -89,9 +89,11 @@ ASH_EXPORT int FindDisplayIndexContainingPoint(
const std::vector<gfx::Display>& displays,
const gfx::Point& point_in_screen);
-// Creates the DisplayIdPair where ids are sorted using |CompareDisplayIds|
+// Creates the DisplayIdList where ids are sorted using |CompareDisplayIds|
// below.
-ASH_EXPORT DisplayIdPair CreateDisplayIdPair(int64_t id1, int64_t id2);
+ASH_EXPORT DisplayIdList CreateDisplayIdList(int64_t id1, int64_t id2);
+
+ASH_EXPORT std::string DisplayIdListToString(const DisplayIdList& list);
// Returns true if one of following conditinos is met.
// 1) id1 is internal.
diff --git a/ash/display/display_util_unittest.cc b/ash/display/display_util_unittest.cc
index 1dcd0c7..dabb91e 100644
--- a/ash/display/display_util_unittest.cc
+++ b/ash/display/display_util_unittest.cc
@@ -92,32 +92,32 @@ TEST_F(DisplayUtilTest, RotatedDisplay) {
}
TEST_F(DisplayUtilTest, CreateDisplayIdPair) {
- DisplayIdPair pair = CreateDisplayIdPair(10, 1);
- EXPECT_EQ(1, pair.first);
- EXPECT_EQ(10, pair.second);
- pair = CreateDisplayIdPair(10, 100);
- EXPECT_EQ(10, pair.first);
- EXPECT_EQ(100, pair.second);
+ DisplayIdList list = CreateDisplayIdList(10, 1);
+ EXPECT_EQ(1, list[0]);
+ EXPECT_EQ(10, list[1]);
+ list = CreateDisplayIdList(10, 100);
+ EXPECT_EQ(10, list[0]);
+ EXPECT_EQ(100, list[1]);
{
test::ScopedSetInternalDisplayId set_internal(100);
- pair = CreateDisplayIdPair(10, 100);
- EXPECT_EQ(100, pair.first);
- EXPECT_EQ(10, pair.second);
+ list = CreateDisplayIdList(10, 100);
+ EXPECT_EQ(100, list[0]);
+ EXPECT_EQ(10, list[1]);
- pair = CreateDisplayIdPair(100, 10);
- EXPECT_EQ(100, pair.first);
- EXPECT_EQ(10, pair.second);
+ list = CreateDisplayIdList(100, 10);
+ EXPECT_EQ(100, list[0]);
+ EXPECT_EQ(10, list[1]);
}
{
test::ScopedSetInternalDisplayId set_internal(10);
- pair = CreateDisplayIdPair(10, 100);
- EXPECT_EQ(10, pair.first);
- EXPECT_EQ(100, pair.second);
+ list = CreateDisplayIdList(10, 100);
+ EXPECT_EQ(10, list[0]);
+ EXPECT_EQ(100, list[1]);
- pair = CreateDisplayIdPair(100, 10);
- EXPECT_EQ(10, pair.first);
- EXPECT_EQ(100, pair.second);
+ list = CreateDisplayIdList(100, 10);
+ EXPECT_EQ(10, list[0]);
+ EXPECT_EQ(100, list[1]);
}
}
diff --git a/ash/display/window_tree_host_manager.cc b/ash/display/window_tree_host_manager.cc
index 486a40b..1ad96b8 100644
--- a/ash/display/window_tree_host_manager.cc
+++ b/ash/display/window_tree_host_manager.cc
@@ -451,7 +451,7 @@ void WindowTreeHostManager::SetPrimaryDisplay(
primary_display_id = new_primary_display.id();
GetDisplayManager()->layout_store()->UpdatePrimaryDisplayId(
- display_manager->GetCurrentDisplayIdPair(), primary_display_id);
+ display_manager->GetCurrentDisplayIdList(), primary_display_id);
UpdateWorkAreaOfDisplayNearestWindow(GetWindow(primary_host),
old_primary_display.GetWorkAreaInsets());
@@ -763,22 +763,21 @@ void WindowTreeHostManager::PostDisplayConfigurationChange() {
DisplayManager* display_manager = GetDisplayManager();
DisplayLayoutStore* layout_store = display_manager->layout_store();
if (display_manager->num_connected_displays() > 1) {
- DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair();
- DisplayLayout layout = layout_store->GetRegisteredDisplayLayout(pair);
+ DisplayIdList list = display_manager->GetCurrentDisplayIdList();
+ DisplayLayout layout = layout_store->GetRegisteredDisplayLayout(list);
layout_store->UpdateMultiDisplayState(
- pair, display_manager->IsInMirrorMode(), layout.default_unified);
+ list, display_manager->IsInMirrorMode(), layout.default_unified);
if (gfx::Screen::GetScreen()->GetNumDisplays() > 1) {
int64_t primary_id = layout.primary_id;
- SetPrimaryDisplayId(primary_id == gfx::Display::kInvalidDisplayID
- ? pair.first
- : primary_id);
+ SetPrimaryDisplayId(
+ primary_id == gfx::Display::kInvalidDisplayID ? list[0] : primary_id);
// Update the primary_id in case the above call is
// ignored. Happens when a) default layout's primary id
// doesn't exist, or b) the primary_id has already been
// set to the same and didn't update it.
layout_store->UpdatePrimaryDisplayId(
- pair, gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
+ list, gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
}
}
FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged());
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index aae4793..5b76b1f 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -705,6 +705,12 @@ void ShelfLayoutManager::UpdateBoundsAndOpacity(
target_bounds.shelf_bounds_in_root.x());
status_bounds.set_y(status_bounds.y() +
target_bounds.shelf_bounds_in_root.y());
+ LOG(ERROR) << "Status Area Widget Bounds:"
+ << ScreenUtil::ConvertRectToScreen(
+ shelf_->status_area_widget()->GetNativeView()->parent(),
+ status_bounds)
+ .ToString();
+
shelf_->status_area_widget()->SetBounds(
ScreenUtil::ConvertRectToScreen(
shelf_->status_area_widget()->GetNativeView()->parent(),
diff --git a/ash/sticky_keys/sticky_keys_overlay_unittest.cc b/ash/sticky_keys/sticky_keys_overlay_unittest.cc
index d28c536..819bc05 100644
--- a/ash/sticky_keys/sticky_keys_overlay_unittest.cc
+++ b/ash/sticky_keys/sticky_keys_overlay_unittest.cc
@@ -46,9 +46,9 @@ TEST_F(StickyKeysOverlayTest, OverlayNotDestroyedAfterDisplayRemoved) {
// Add a secondary display to the left of the primary one.
UpdateDisplay("1280x1024,1980x1080");
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
- DisplayIdPair display_ids = display_manager->GetCurrentDisplayIdPair();
- int64_t primary_display_id = display_ids.first;
- int64_t secondary_display_id = display_ids.second;
+ DisplayIdList display_ids = display_manager->GetCurrentDisplayIdList();
+ int64_t primary_display_id = display_ids[0];
+ int64_t secondary_display_id = display_ids[1];
display_manager->SetLayoutForCurrentDisplays(
DisplayLayout(DisplayLayout::LEFT, 0));
diff --git a/ash/touch/touch_transformer_controller.cc b/ash/touch/touch_transformer_controller.cc
index 0af8c8d..8bea2bf 100644
--- a/ash/touch/touch_transformer_controller.cc
+++ b/ash/touch/touch_transformer_controller.cc
@@ -174,9 +174,9 @@ void TouchTransformerController::UpdateTouchTransformer() const {
single_display = display_manager->GetDisplayInfo(single_display_id);
UpdateTouchRadius(single_display);
} else {
- DisplayIdPair id_pair = display_manager->GetCurrentDisplayIdPair();
- display1_id = id_pair.first;
- display2_id = id_pair.second;
+ DisplayIdList list = display_manager->GetCurrentDisplayIdList();
+ display1_id = list[0];
+ display2_id = list[1];
DCHECK(display1_id != gfx::Display::kInvalidDisplayID &&
display2_id != gfx::Display::kInvalidDisplayID);
display1 = display_manager->GetDisplayInfo(display1_id);
diff --git a/chrome/browser/chromeos/display/display_preferences.cc b/chrome/browser/chromeos/display/display_preferences.cc
index fe969f6..e6cb813 100644
--- a/chrome/browser/chromeos/display/display_preferences.cc
+++ b/chrome/browser/chromeos/display/display_preferences.cc
@@ -134,7 +134,7 @@ void LoadDisplayLayouts() {
id2 == gfx::Display::kInvalidDisplayID) {
continue;
}
- layout_store->RegisterLayoutForDisplayIdPair(id1, id2, layout);
+ layout_store->RegisterLayoutForDisplayIdList(id1, id2, layout);
}
}
}
@@ -210,10 +210,9 @@ void LoadDisplayRotationState() {
static_cast<gfx::Display::Rotation>(rotation));
}
-void StoreDisplayLayoutPref(const ash::DisplayIdPair& pair,
+void StoreDisplayLayoutPref(const ash::DisplayIdList& list,
const ash::DisplayLayout& display_layout) {
- std::string name =
- base::Int64ToString(pair.first) + "," + base::Int64ToString(pair.second);
+ std::string name = ash::DisplayIdListToString(list);
PrefService* local_state = g_browser_process->local_state();
DictionaryPrefUpdate update(local_state, prefs::kSecondaryDisplays);
@@ -235,7 +234,7 @@ void StoreCurrentDisplayLayoutPrefs() {
return;
}
- ash::DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair();
+ ash::DisplayIdList pair = display_manager->GetCurrentDisplayIdList();
ash::DisplayLayout display_layout =
display_manager->layout_store()->GetRegisteredDisplayLayout(pair);
StoreDisplayLayoutPref(pair, display_layout);
@@ -393,7 +392,7 @@ void LoadDisplayPreferences(bool first_run_after_boot) {
void StoreDisplayLayoutPrefForTest(int64_t id1,
int64_t id2,
const ash::DisplayLayout& layout) {
- StoreDisplayLayoutPref(ash::CreateDisplayIdPair(id1, id2), layout);
+ StoreDisplayLayoutPref(ash::CreateDisplayIdList(id1, id2), layout);
}
// Stores the given |power_state|.
diff --git a/chrome/browser/chromeos/display/display_preferences_unittest.cc b/chrome/browser/chromeos/display/display_preferences_unittest.cc
index c593aa2..bcfaaec 100644
--- a/chrome/browser/chromeos/display/display_preferences_unittest.cc
+++ b/chrome/browser/chromeos/display/display_preferences_unittest.cc
@@ -54,11 +54,6 @@ bool IsRotationLocked() {
->rotation_locked();
}
-std::string ToPairString(const ash::DisplayIdPair& pair) {
- return base::Int64ToString(pair.first) + "," +
- base::Int64ToString(pair.second);
-}
-
class DisplayPreferencesTest : public ash::test::AshTestBase {
protected:
DisplayPreferencesTest()
@@ -102,11 +97,11 @@ class DisplayPreferencesTest : public ash::test::AshTestBase {
// Do not use the implementation of display_preferences.cc directly to avoid
// notifying the update to the system.
- void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair& pair,
+ void StoreDisplayLayoutPrefForList(const ash::DisplayIdList& list,
ash::DisplayLayout::Position layout,
int offset,
int64_t primary_id) {
- std::string name = ToPairString(pair);
+ std::string name = ash::DisplayIdListToString(list);
DictionaryPrefUpdate update(&local_state_, prefs::kSecondaryDisplays);
ash::DisplayLayout display_layout(layout, offset);
display_layout.primary_id = primary_id;
@@ -124,10 +119,10 @@ class DisplayPreferencesTest : public ash::test::AshTestBase {
pref_data->Set(name, layout_value.release());
}
- void StoreDisplayPropertyForPair(const ash::DisplayIdPair& pair,
+ void StoreDisplayPropertyForList(const ash::DisplayIdList& list,
std::string key,
scoped_ptr<base::Value> value) {
- std::string name = ToPairString(pair);
+ std::string name = ash::DisplayIdListToString(list);
DictionaryPrefUpdate update(&local_state_, prefs::kSecondaryDisplays);
base::DictionaryValue* pref_data = update.Get();
@@ -146,17 +141,17 @@ class DisplayPreferencesTest : public ash::test::AshTestBase {
}
}
- void StoreDisplayBoolPropertyForPair(const ash::DisplayIdPair& pair,
+ void StoreDisplayBoolPropertyForList(const ash::DisplayIdList& list,
const std::string& key,
bool value) {
- StoreDisplayPropertyForPair(
- pair, key, make_scoped_ptr(new base::FundamentalValue(value)));
+ StoreDisplayPropertyForList(
+ list, key, make_scoped_ptr(new base::FundamentalValue(value)));
}
- void StoreDisplayLayoutPrefForPair(const ash::DisplayIdPair& pair,
+ void StoreDisplayLayoutPrefForList(const ash::DisplayIdList& list,
ash::DisplayLayout::Position layout,
int offset) {
- StoreDisplayLayoutPrefForPair(pair, layout, offset, pair.first);
+ StoreDisplayLayoutPrefForList(list, layout, offset, list[0]);
}
void StoreDisplayOverscan(int64_t id, const gfx::Insets& insets) {
@@ -190,9 +185,12 @@ class DisplayPreferencesTest : public ash::test::AshTestBase {
pref_data->SetInteger("orientation", static_cast<int>(rotation));
}
- std::string GetRegisteredDisplayLayoutStr(const ash::DisplayIdPair& pair) {
- return ash::Shell::GetInstance()->display_manager()->layout_store()->
- GetRegisteredDisplayLayout(pair).ToString();
+ std::string GetRegisteredDisplayLayoutStr(const ash::DisplayIdList& list) {
+ return ash::Shell::GetInstance()
+ ->display_manager()
+ ->layout_store()
+ ->GetRegisteredDisplayLayout(list)
+ .ToString();
}
PrefService* local_state() { return &local_state_; }
@@ -208,17 +206,18 @@ class DisplayPreferencesTest : public ash::test::AshTestBase {
} // namespace
-TEST_F(DisplayPreferencesTest, PairedLayoutOverrides) {
+TEST_F(DisplayPreferencesTest, ListedLayoutOverrides) {
UpdateDisplay("100x100,200x200");
ash::DisplayManager* display_manager =
ash::Shell::GetInstance()->display_manager();
- ash::DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair();
- ash::DisplayIdPair dummy_pair = std::make_pair(pair.first, pair.second + 1);
- ASSERT_NE(pair.first, dummy_pair.second);
+ ash::DisplayIdList list = display_manager->GetCurrentDisplayIdList();
+ ash::DisplayIdList dummy_list =
+ ash::CreateDisplayIdList(list[0], list[1] + 1);
+ ASSERT_NE(list[0], dummy_list[1]);
- StoreDisplayLayoutPrefForPair(pair, ash::DisplayLayout::TOP, 20);
- StoreDisplayLayoutPrefForPair(dummy_pair, ash::DisplayLayout::LEFT, 30);
+ StoreDisplayLayoutPrefForList(list, ash::DisplayLayout::TOP, 20);
+ StoreDisplayLayoutPrefForList(dummy_list, ash::DisplayLayout::LEFT, 30);
StoreDisplayPowerStateForTest(
chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON);
@@ -231,13 +230,13 @@ TEST_F(DisplayPreferencesTest, PairedLayoutOverrides) {
shell->display_manager()->UpdateDisplays();
// Check if the layout settings are notified to the system properly.
- // The paired layout overrides old layout.
- // Inverted one of for specified pair (id1, id2). Not used for the pair
+ // The new layout overrides old layout.
+ // Inverted one of for specified pair (id1, id2). Not used for the list
// (id1, dummy_id) since dummy_id is not connected right now.
EXPECT_EQ("top, 20",
shell->display_manager()->GetCurrentDisplayLayout().ToString());
- EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(pair));
- EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(dummy_pair));
+ EXPECT_EQ("top, 20", GetRegisteredDisplayLayoutStr(list));
+ EXPECT_EQ("left, 30", GetRegisteredDisplayLayoutStr(dummy_list));
}
TEST_F(DisplayPreferencesTest, BasicStores) {
@@ -887,15 +886,15 @@ TEST_F(DisplayPreferencesTest, SaveUnifiedMode) {
display_manager->SetUnifiedDesktopEnabled(true);
UpdateDisplay("200x200,100x100");
- ash::DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair();
+ ash::DisplayIdList list = display_manager->GetCurrentDisplayIdList();
EXPECT_EQ("400x200",
gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
const base::DictionaryValue* secondary_displays =
local_state()->GetDictionary(prefs::kSecondaryDisplays);
const base::DictionaryValue* new_value = NULL;
- EXPECT_TRUE(
- secondary_displays->GetDictionary(ToPairString(pair), &new_value));
+ EXPECT_TRUE(secondary_displays->GetDictionary(
+ ash::DisplayIdListToString(list), &new_value));
ash::DisplayLayout stored_layout;
EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
@@ -916,15 +915,15 @@ TEST_F(DisplayPreferencesTest, SaveUnifiedMode) {
// Mirror mode should remember if the default mode was unified.
display_manager->SetMirrorMode(true);
- ASSERT_TRUE(
- secondary_displays->GetDictionary(ToPairString(pair), &new_value));
+ ASSERT_TRUE(secondary_displays->GetDictionary(
+ ash::DisplayIdListToString(list), &new_value));
EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
EXPECT_TRUE(stored_layout.default_unified);
EXPECT_TRUE(stored_layout.mirrored);
display_manager->SetMirrorMode(false);
- ASSERT_TRUE(
- secondary_displays->GetDictionary(ToPairString(pair), &new_value));
+ ASSERT_TRUE(secondary_displays->GetDictionary(
+ ash::DisplayIdListToString(list), &new_value));
EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
EXPECT_TRUE(stored_layout.default_unified);
EXPECT_FALSE(stored_layout.mirrored);
@@ -932,8 +931,8 @@ TEST_F(DisplayPreferencesTest, SaveUnifiedMode) {
// Exit unified mode.
display_manager->SetDefaultMultiDisplayModeForCurrentDisplays(
ash::DisplayManager::EXTENDED);
- ASSERT_TRUE(
- secondary_displays->GetDictionary(ToPairString(pair), &new_value));
+ ASSERT_TRUE(secondary_displays->GetDictionary(
+ ash::DisplayIdListToString(list), &new_value));
EXPECT_TRUE(ash::DisplayLayout::ConvertFromValue(*new_value, &stored_layout));
EXPECT_FALSE(stored_layout.default_unified);
EXPECT_FALSE(stored_layout.mirrored);
@@ -941,10 +940,10 @@ TEST_F(DisplayPreferencesTest, SaveUnifiedMode) {
TEST_F(DisplayPreferencesTest, RestoreUnifiedMode) {
int64_t id1 = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
- ash::DisplayIdPair pair = std::make_pair(id1, id1 + 1);
- StoreDisplayBoolPropertyForPair(pair, "default_unified", true);
- StoreDisplayPropertyForPair(
- pair, "primary-id",
+ ash::DisplayIdList list = ash::CreateDisplayIdList(id1, id1 + 1);
+ StoreDisplayBoolPropertyForList(list, "default_unified", true);
+ StoreDisplayPropertyForList(
+ list, "primary-id",
make_scoped_ptr(new base::StringValue(base::Int64ToString(id1))));
LoadDisplayPreferences(false);
@@ -956,14 +955,14 @@ TEST_F(DisplayPreferencesTest, RestoreUnifiedMode) {
// Restored to unified.
display_manager->SetUnifiedDesktopEnabled(true);
- StoreDisplayBoolPropertyForPair(pair, "default_unified", true);
+ StoreDisplayBoolPropertyForList(list, "default_unified", true);
LoadDisplayPreferences(false);
UpdateDisplay("100x100,200x200");
EXPECT_TRUE(display_manager->IsInUnifiedMode());
// Restored to mirror, then unified.
- StoreDisplayBoolPropertyForPair(pair, "mirrored", true);
- StoreDisplayBoolPropertyForPair(pair, "default_unified", true);
+ StoreDisplayBoolPropertyForList(list, "mirrored", true);
+ StoreDisplayBoolPropertyForList(list, "default_unified", true);
LoadDisplayPreferences(false);
UpdateDisplay("100x100,200x200");
EXPECT_TRUE(display_manager->IsInMirrorMode());
@@ -972,8 +971,8 @@ TEST_F(DisplayPreferencesTest, RestoreUnifiedMode) {
EXPECT_TRUE(display_manager->IsInUnifiedMode());
// Sanity check. Restore to extended.
- StoreDisplayBoolPropertyForPair(pair, "default_unified", false);
- StoreDisplayBoolPropertyForPair(pair, "mirrored", false);
+ StoreDisplayBoolPropertyForList(list, "default_unified", false);
+ StoreDisplayBoolPropertyForList(list, "mirrored", false);
LoadDisplayPreferences(false);
UpdateDisplay("100x100,200x200");
EXPECT_FALSE(display_manager->IsInMirrorMode());
diff --git a/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc b/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc
index 0796ddf..111defe 100644
--- a/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc
+++ b/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc
@@ -56,10 +56,10 @@ gfx::Display::Rotation GetRotationOfSecondDisplay() {
<< "Requested rotation of second display while there was only one.";
return gfx::Display::ROTATE_0;
}
- const ash::DisplayIdPair display_id_pair =
- display_manager->GetCurrentDisplayIdPair();
+ const ash::DisplayIdList display_id_pair =
+ display_manager->GetCurrentDisplayIdList();
const gfx::Display& second_display =
- display_manager->GetDisplayForId(display_id_pair.second);
+ display_manager->GetDisplayForId(display_id_pair[1]);
return second_display.rotation();
}