summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-17 23:34:50 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-17 23:34:50 +0000
commit8039e06c060c94a67d8478bd81e2c0609c6b7b26 (patch)
treed0e7f7b04a9fa21bd026978388781f82ce120ca7 /ash
parent6cdd707b95c519e342df380b5ee9d177f7965dd2 (diff)
downloadchromium_src-8039e06c060c94a67d8478bd81e2c0609c6b7b26.zip
chromium_src-8039e06c060c94a67d8478bd81e2c0609c6b7b26.tar.gz
chromium_src-8039e06c060c94a67d8478bd81e2c0609c6b7b26.tar.bz2
Enable launcher on all displays by default
Updated tests to work on both environment. I did this so that we can just flip the flag when we need to turn this off. BUG=166119 TEST=some tests were updated to work under this environment. Review URL: https://chromiumcodereview.appspot.com/11975019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177529 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash_switches.cc4
-rw-r--r--ash/ash_switches.h2
-rw-r--r--ash/display/display_controller_unittest.cc18
-rw-r--r--ash/launcher/launcher_view.cc4
-rw-r--r--ash/root_window_controller.cc4
-rw-r--r--ash/root_window_controller_unittest.cc13
-rw-r--r--ash/screen_ash_unittest.cc24
-rw-r--r--ash/shell.cc2
8 files changed, 49 insertions, 22 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index 2895519..ca42f45 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -76,8 +76,8 @@ const char kAshEnableTrayDragging[] = "ash-enable-tray-dragging";
const char kAshImmersiveHideTabIndicators[] =
"ash-immersive-hide-tab-indicators";
-// Enables creating a launcher per display.
-const char kAshLauncherPerDisplay[] = "ash-launcher-per-display";
+// Disables creating a launcher per display.
+const char kAshDisableLauncherPerDisplay[] = "ash-disable-launcher-per-display";
// If present new lock animations are enabled.
const char kAshDisableNewLockAnimations[] = "ash-disable-new-lock-animations";
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index aa3c37c..bc45e4a 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -28,6 +28,7 @@ ASH_EXPORT extern const char kAshDisableDisplayChangeLimiter[];
ASH_EXPORT extern const char kAshDisablePanelFitting[];
ASH_EXPORT extern const char kAshDisableBootAnimation2[];
ASH_EXPORT extern const char kAshDisableNewLockAnimations[];
+ASH_EXPORT extern const char kAshDisableLauncherPerDisplay[];
ASH_EXPORT extern const char kAshEnableAdvancedGestures[];
ASH_EXPORT extern const char kAshEnableBrightnessControl[];
#if defined(OS_LINUX)
@@ -38,7 +39,6 @@ ASH_EXPORT extern const char kAshEnableOak[];
ASH_EXPORT extern const char kAshEnableTrayDragging[];
ASH_EXPORT extern const char kAshEnableWorkspaceScrubbing[];
ASH_EXPORT extern const char kAshImmersiveHideTabIndicators[];
-ASH_EXPORT extern const char kAshLauncherPerDisplay[];
ASH_EXPORT extern const char kAshSecondaryDisplayLayout[];
ASH_EXPORT extern const char kAshTouchHud[];
ASH_EXPORT extern const char kAuraLegacyPowerButton[];
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc
index 515df0e..a9244e6 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -158,7 +158,6 @@ TEST_F(DisplayControllerTest, SecondaryDisplayLayout) {
EXPECT_EQ(1, observer.CountAndReset()); // resize and add
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("-300,500 400x400", GetSecondaryDisplay().bounds().ToString());
-
}
TEST_F(DisplayControllerTest, BoundsUpdated) {
@@ -180,13 +179,15 @@ TEST_F(DisplayControllerTest, BoundsUpdated) {
EXPECT_EQ(2, observer.CountAndReset()); // two resizes
EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,400 200x200", GetSecondaryDisplay().bounds().ToString());
- EXPECT_EQ("5,405 190x190", GetSecondaryDisplay().work_area().ToString());
+ if (!ash::Shell::IsLauncherPerDisplayEnabled())
+ EXPECT_EQ("5,405 190x190", GetSecondaryDisplay().work_area().ToString());
UpdateDisplay("400x400,300x300");
EXPECT_EQ(1, observer.CountAndReset());
EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("0,400 300x300", GetSecondaryDisplay().bounds().ToString());
- EXPECT_EQ("5,405 290x290", GetSecondaryDisplay().work_area().ToString());
+ if (!ash::Shell::IsLauncherPerDisplayEnabled())
+ EXPECT_EQ("5,405 290x290", GetSecondaryDisplay().work_area().ToString());
UpdateDisplay("400x400");
EXPECT_EQ(1, observer.CountAndReset());
@@ -261,7 +262,10 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString());
EXPECT_EQ("0,0 200x152", primary_display.work_area().ToString());
EXPECT_EQ("200,0 300x300", secondary_display.bounds().ToString());
- EXPECT_EQ("200,0 300x300", secondary_display.work_area().ToString());
+ if (ash::Shell::IsLauncherPerDisplayEnabled())
+ EXPECT_EQ("200,0 300x252", secondary_display.work_area().ToString());
+ else
+ EXPECT_EQ("200,0 300x300", secondary_display.work_area().ToString());
// Switch primary and secondary
display_controller->SetPrimaryDisplay(secondary_display);
@@ -289,7 +293,11 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
EXPECT_EQ("0,0 300x300", swapped_primary.bounds().ToString());
EXPECT_EQ("0,0 300x252", swapped_primary.work_area().ToString());
EXPECT_EQ("-200,-50 200x200", swapped_secondary.bounds().ToString());
- EXPECT_EQ("-200,-50 200x200", swapped_secondary.work_area().ToString());
+
+ if (ash::Shell::IsLauncherPerDisplayEnabled())
+ EXPECT_EQ("-200,-50 200x152", swapped_secondary.work_area().ToString());
+ else
+ EXPECT_EQ("-200,-50 200x200", swapped_secondary.work_area().ToString());
const DisplayLayout& inverted_layout =
display_controller->GetLayoutForDisplay(primary_display);
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index 6156c84..58f2f26 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -20,7 +20,6 @@
#include "ash/shell_delegate.h"
#include "ash/wm/shelf_layout_manager.h"
#include "base/auto_reset.h"
-#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "grit/ash_strings.h"
#include "grit/ash_resources.h"
@@ -963,8 +962,7 @@ void LauncherView::LauncherItemChanged(int model_index,
break;
}
case TYPE_BROWSER_SHORTCUT:
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- ash::switches::kAshEnablePerAppLauncher))
+ if (!Shell::IsLauncherPerDisplayEnabled())
break;
// Fallthrough for the new Launcher since it needs to show the activation
// change as well.
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 543a084..b3d1f7e 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -451,6 +451,10 @@ void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) {
// be re-focused below.
aura::client::GetFocusClient(dst)->FocusWindow(NULL);
+ // Forget the shelf early so that shelf don't update itself using wrong
+ // display info.
+ workspace_controller_->SetShelf(NULL);
+
ReparentAllWindows(root_window_.get(), dst);
// Restore focused or active window if it's still alive.
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index f50fcdc..af45230 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -133,10 +133,15 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100));
maximized->Maximize();
EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow());
-
- EXPECT_EQ("600,0 500x500", maximized->GetWindowBoundsInScreen().ToString());
- EXPECT_EQ("0,0 500x500",
- maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
+ if (Shell::IsLauncherPerDisplayEnabled()) {
+ EXPECT_EQ("600,0 500x452", maximized->GetWindowBoundsInScreen().ToString());
+ EXPECT_EQ("0,0 500x452",
+ maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
+ } else {
+ EXPECT_EQ("600,0 500x500", maximized->GetWindowBoundsInScreen().ToString());
+ EXPECT_EQ("0,0 500x500",
+ maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
+ }
views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100));
minimized->Minimize();
diff --git a/ash/screen_ash_unittest.cc b/ash/screen_ash_unittest.cc
index 2320877..cdc854a 100644
--- a/ash/screen_ash_unittest.cc
+++ b/ash/screen_ash_unittest.cc
@@ -36,9 +36,15 @@ TEST_F(ScreenAshTest, Bounds) {
EXPECT_EQ("0,0 600x597",
ScreenAsh::GetMaximizedWindowBoundsInParent(
primary->GetNativeView()).ToString());
- EXPECT_EQ("0,0 500x500",
- ScreenAsh::GetMaximizedWindowBoundsInParent(
- secondary->GetNativeView()).ToString());
+ if (Shell::IsLauncherPerDisplayEnabled()) {
+ EXPECT_EQ("0,0 500x452",
+ ScreenAsh::GetMaximizedWindowBoundsInParent(
+ secondary->GetNativeView()).ToString());
+ } else {
+ EXPECT_EQ("0,0 500x500",
+ ScreenAsh::GetMaximizedWindowBoundsInParent(
+ secondary->GetNativeView()).ToString());
+ }
// Display bounds
EXPECT_EQ("0,0 600x600",
@@ -52,9 +58,15 @@ TEST_F(ScreenAshTest, Bounds) {
EXPECT_EQ("0,0 600x597",
ScreenAsh::GetDisplayWorkAreaBoundsInParent(
primary->GetNativeView()).ToString());
- EXPECT_EQ("0,0 500x500",
- ScreenAsh::GetDisplayWorkAreaBoundsInParent(
- secondary->GetNativeView()).ToString());
+ if (Shell::IsLauncherPerDisplayEnabled()) {
+ EXPECT_EQ("0,0 500x452",
+ ScreenAsh::GetDisplayWorkAreaBoundsInParent(
+ secondary->GetNativeView()).ToString());
+ } else {
+ EXPECT_EQ("0,0 500x500",
+ ScreenAsh::GetDisplayWorkAreaBoundsInParent(
+ secondary->GetNativeView()).ToString());
+ }
}
TEST_F(ScreenAshTest, ConvertRect) {
diff --git a/ash/shell.cc b/ash/shell.cc
index f1c6d99..9a8841b 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -396,7 +396,7 @@ std::vector<aura::Window*> Shell::GetContainersFromAllRootWindows(
// static
bool Shell::IsLauncherPerDisplayEnabled() {
CommandLine* command_line = CommandLine::ForCurrentProcess();
- return command_line->HasSwitch(switches::kAshLauncherPerDisplay);
+ return !command_line->HasSwitch(switches::kAshDisableLauncherPerDisplay);
}
void Shell::Init() {