summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
Diffstat (limited to 'ash')
-rw-r--r--ash/display/display_controller.cc15
-rw-r--r--ash/display/display_controller.h3
-rw-r--r--ash/shell.cc6
-rw-r--r--ash/shell.h6
-rw-r--r--ash/test/ash_test_base.cc2
-rw-r--r--ash/test/shell_test_api.cc15
-rw-r--r--ash/test/shell_test_api.h2
7 files changed, 34 insertions, 15 deletions
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index d16af04..8ce4c2f 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -199,6 +199,11 @@ void SetDisplayPropertiesOnHostWindow(aura::RootWindow* root,
////////////////////////////////////////////////////////////////////////////////
// DisplayLayout
+// static
+DisplayLayout DisplayLayout::FromInts(int position, int offsets) {
+ return DisplayLayout(static_cast<Position>(position), offsets);
+}
+
DisplayLayout::DisplayLayout()
: position(RIGHT),
offset(0) {}
@@ -532,12 +537,10 @@ DisplayIdPair DisplayController::GetCurrentDisplayIdPair() const {
DisplayIdPair pair;
if (primary.IsInternal() ||
GetDisplayManager()->first_display_id() == primary.id()) {
- pair.first = primary.id();
- pair.second = secondary.id();
+ pair = std::make_pair(primary.id(), secondary.id());
} else {
// Display has been Swapped.
- pair.first = secondary.id();
- pair.second = primary.id();
+ pair = std::make_pair(secondary.id(), primary.id());
}
return pair;
}
@@ -864,9 +867,7 @@ void DisplayController::RegisterLayoutForDisplayIdPairInternal(
int64 id2,
const DisplayLayout& layout,
bool override) {
- DisplayIdPair pair;
- pair.first = id1;
- pair.second = id2;
+ DisplayIdPair pair = std::make_pair(id1, id2);
if (override || paired_layouts_.find(pair) == paired_layouts_.end())
paired_layouts_[pair] = layout;
}
diff --git a/ash/display/display_controller.h b/ash/display/display_controller.h
index f58dc12..051704c 100644
--- a/ash/display/display_controller.h
+++ b/ash/display/display_controller.h
@@ -44,6 +44,9 @@ struct ASH_EXPORT DisplayLayout {
BOTTOM,
LEFT
};
+ // Factory method to create DisplayLayout from int values.
+ // Used for persistence and webui.
+ static DisplayLayout FromInts(int position, int offsets);
DisplayLayout();
DisplayLayout(Position position, int offset);
diff --git a/ash/shell.cc b/ash/shell.cc
index 366d2e3..8660194 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -417,15 +417,15 @@ bool Shell::IsLauncherPerDisplayEnabled() {
void Shell::Init() {
#if defined(OS_CHROMEOS)
+ output_configurator_animation_.reset(
+ new internal::OutputConfiguratorAnimation());
+ output_configurator_->AddObserver(output_configurator_animation_.get());
if (base::chromeos::IsRunningOnChromeOS()) {
display_change_observer_.reset(new internal::DisplayChangeObserverX11);
// Register |display_change_observer_| first so that the rest of
// observer gets invoked after the root windows are configured.
output_configurator_->AddObserver(display_change_observer_.get());
- output_configurator_animation_.reset(
- new internal::OutputConfiguratorAnimation());
display_error_observer_.reset(new internal::DisplayErrorObserver());
- output_configurator_->AddObserver(output_configurator_animation_.get());
output_configurator_->AddObserver(display_error_observer_.get());
display_change_observer_->OnDisplayModeChanged();
}
diff --git a/ash/shell.h b/ash/shell.h
index 1b659b8..7e3fab3c 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -425,6 +425,7 @@ class ASH_EXPORT Shell
void DoInitialWorkspaceAnimation();
#if defined(OS_CHROMEOS)
+ // TODO(oshima): Move these objects to DisplayController.
chromeos::OutputConfigurator* output_configurator() {
return output_configurator_.get();
}
@@ -466,11 +467,6 @@ class ASH_EXPORT Shell
// can host browser windows.
void InitRootWindowController(internal::RootWindowController* root);
- // Initializes the layout managers and event filters specific for
- // primary display.
- void InitLayoutManagersForPrimaryDisplay(
- internal::RootWindowController* root_window_controller);
-
// ash::internal::SystemModalContainerEventFilterDelegate overrides:
virtual bool CanWindowReceiveEvents(aura::Window* window) OVERRIDE;
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index 2e2dd3e..ce7dad2 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -13,6 +13,7 @@
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/test/display_manager_test_api.h"
+#include "ash/test/shell_test_api.h"
#include "ash/test/test_shell_delegate.h"
#include "ash/wm/coordinate_conversion.h"
#include "base/command_line.h"
@@ -119,6 +120,7 @@ void AshTestBase::SetUp() {
// interfere test expectations.
Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000));
shell->cursor_manager()->EnableMouseEvents();
+ ShellTestApi(shell).DisableOutputConfiguratorAnimation();
#if defined(OS_WIN)
if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
diff --git a/ash/test/shell_test_api.cc b/ash/test/shell_test_api.cc
index f4ba794..72b869a 100644
--- a/ash/test/shell_test_api.cc
+++ b/ash/test/shell_test_api.cc
@@ -7,6 +7,11 @@
#include "ash/root_window_controller.h"
#include "ash/shell.h"
+#if defined(OS_CHROMEOS)
+#include "ash/display/output_configurator_animation.h"
+#include "chromeos/display/output_configurator.h"
+#endif
+
namespace ash {
namespace test {
@@ -43,5 +48,15 @@ LauncherModel* ShellTestApi::launcher_model() {
return shell_->launcher_model_.get();
}
+void ShellTestApi::DisableOutputConfiguratorAnimation() {
+#if defined(OS_CHROMEOS)
+ if (shell_->output_configurator_animation_.get()) {
+ shell_->output_configurator_->RemoveObserver(
+ shell_->output_configurator_animation_.get());
+ shell_->output_configurator_animation_.reset();
+ }
+#endif // defined(OS_CHROMEOS)
+}
+
} // namespace test
} // namespace ash
diff --git a/ash/test/shell_test_api.h b/ash/test/shell_test_api.h
index 8f0ea44..f36716a 100644
--- a/ash/test/shell_test_api.h
+++ b/ash/test/shell_test_api.h
@@ -40,6 +40,8 @@ public:
AshNativeCursorManager* ash_native_cursor_manager();
LauncherModel* launcher_model();
+ void DisableOutputConfiguratorAnimation();
+
private:
Shell* shell_; // not owned