Skip to content

Commit

Permalink
Shelf Cleanup AlternateShelfLayout P1 Attempt 3
Browse files Browse the repository at this point in the history
R=skuhne@chromium.org
TBR=jamescook@chromium.org, miket@chromium.org, skuhne@chromium.org
BUG=338429
re-landing of https://codereview.chromium.org/176883022/ with fix for the inset of app panel as discussed offline /w jennyz@

Review URL: https://codereview.chromium.org/229453005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263451 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
harrym@chromium.org committed Apr 12, 2014
1 parent 7177c43 commit 0ac2311
Show file tree
Hide file tree
Showing 40 changed files with 326 additions and 1,501 deletions.
2 changes: 0 additions & 2 deletions ash/ash.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@
'session_state_delegate.h',
'session_state_observer.cc',
'session_state_observer.h',
'shelf/alternate_app_list_button.cc',
'shelf/alternate_app_list_button.h',
'shelf/app_list_button.cc',
'shelf/app_list_button.h',
'shelf/app_list_shelf_item_delegate.cc',
Expand Down
17 changes: 0 additions & 17 deletions ash/ash_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ const char kAshDefaultWallpaperSmall[] = "ash-default-wallpaper-small";
const char kAshDisableAlternateFrameCaptionButtonStyle[] =
"ash-disable-alternate-caption-button";

// Disable the alternate shelf layout.
const char kAshDisableAlternateShelfLayout[] =
"ash-disable-alternate-shelf-layout";

// Disable ability to dock windows at the desktop edge.
const char kAshDisableDockedWindows[] = "ash-disable-docked-windows";

Expand Down Expand Up @@ -103,14 +99,6 @@ const char kAshSecondaryDisplayLayout[] = "ash-secondary-display-layout";
// Enables the heads-up display for tracking touch points.
const char kAshTouchHud[] = "ash-touch-hud";

// Use alternate layout of the shelf for testing a new look and feel:
// Slightly smaller profile, only 2 states for the "bar highlight" on
// launcher buttons, app list icon with more visible state indication,
// app list icon repositionable and defaulting as 1st item in shelf,
// more visible state indication for background on status area.
// crbug's [244983, 244990, 244994, 245005, 245012]
const char kAshUseAlternateShelfLayout[] = "ash-use-alternate-shelf";

// Uses the 1st display in --ash-host-window-bounds as internal display.
// This is for debugging on linux desktop.
const char kAshUseFirstDisplayAsInternal[] =
Expand All @@ -134,11 +122,6 @@ bool UseAlternateFrameCaptionButtonStyle() {
HasSwitch(kAshDisableAlternateFrameCaptionButtonStyle);
}

bool UseAlternateShelfLayout() {
return !CommandLine::ForCurrentProcess()->
HasSwitch(kAshDisableAlternateShelfLayout);
}

bool UseDockedWindows() {
return !CommandLine::ForCurrentProcess()->HasSwitch(kAshDisableDockedWindows);
}
Expand Down
5 changes: 0 additions & 5 deletions ash/ash_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ ASH_EXPORT extern const char kAshDefaultWallpaperIsOem[];
ASH_EXPORT extern const char kAshDefaultWallpaperLarge[];
ASH_EXPORT extern const char kAshDefaultWallpaperSmall[];
ASH_EXPORT extern const char kAshDisableAlternateFrameCaptionButtonStyle[];
ASH_EXPORT extern const char kAshDisableAlternateShelfLayout[];
ASH_EXPORT extern const char kAshDisableDockedWindows[];
ASH_EXPORT extern const char kAshEnableAlternateFrameCaptionButtonStyle[];
#if defined(OS_CHROMEOS)
Expand All @@ -42,7 +41,6 @@ ASH_EXPORT extern const char kAshHideNotificationsForFactory[];
ASH_EXPORT extern const char kAshHostWindowBounds[];
ASH_EXPORT extern const char kAshSecondaryDisplayLayout[];
ASH_EXPORT extern const char kAshTouchHud[];
ASH_EXPORT extern const char kAshUseAlternateShelfLayout[];
ASH_EXPORT extern const char kAshUseFirstDisplayAsInternal[];
ASH_EXPORT extern const char kAuraLegacyPowerButton[];
#if defined(OS_WIN)
Expand All @@ -53,9 +51,6 @@ ASH_EXPORT extern const char kForceAshToDesktop[];
// maximize, restore, close) should be used.
ASH_EXPORT bool UseAlternateFrameCaptionButtonStyle();

// Returns true if the alternate shelf layout should be used.
ASH_EXPORT bool UseAlternateShelfLayout();

// Returns true if items can be dragged off the shelf to unpin.
ASH_EXPORT bool UseDragOffShelf();

Expand Down
39 changes: 0 additions & 39 deletions ash/dip_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,43 +69,4 @@ TEST_F(DIPTest, WorkArea) {
shelf->shelf_widget()->GetNativeView()->layer()->bounds().height());
}

TEST_F(DIPTest, WorkAreaForLegacyShelfLayout) {
CommandLine::ForCurrentProcess()->AppendSwitch(
ash::switches::kAshDisableAlternateShelfLayout);
UpdateDisplay("1000x900*1.0f");

aura::Window* root = Shell::GetPrimaryRootWindow();
const gfx::Display display =
Shell::GetScreen()->GetDisplayNearestWindow(root);

EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
gfx::Rect work_area = display.work_area();
EXPECT_EQ("0,0 1000x852", work_area.ToString());
EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString());

UpdateDisplay("2000x1800*2.0f");
gfx::Screen* screen = Shell::GetScreen();

const gfx::Display display_2x = screen->GetDisplayNearestWindow(root);
const DisplayInfo display_info_2x =
Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id());

// The |bounds_in_native()| should report bounds in pixel coordinate.
EXPECT_EQ("1,1 2000x1800",
display_info_2x.bounds_in_native().ToString());

// Aura and views coordinates are in DIP, so they their bounds do not change.
EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString());
work_area = display_2x.work_area();
EXPECT_EQ("0,0 1000x852", work_area.ToString());
EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString());

// Sanity check if the workarea's inset hight is same as
// the shelf's height.
Shelf* shelf = Shelf::ForPrimaryDisplay();
EXPECT_EQ(
display_2x.bounds().InsetsFrom(work_area).height(),
shelf->shelf_widget()->GetNativeView()->layer()->bounds().height());
}

} // namespace ash
93 changes: 0 additions & 93 deletions ash/display/display_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -790,99 +790,6 @@ TEST_F(DisplayControllerTest, FindNearestDisplay) {
gfx::Point(300, 400)).id());
}

TEST_F(DisplayControllerTest, SwapPrimaryForLegacyShelfLayout) {
if (!SupportsMultipleDisplays())
return;

CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kAshDisableAlternateShelfLayout);

DisplayController* display_controller =
Shell::GetInstance()->display_controller();
DisplayManager* display_manager = Shell::GetInstance()->display_manager();

UpdateDisplay("200x200,300x300");
gfx::Display primary_display = Shell::GetScreen()->GetPrimaryDisplay();
gfx::Display secondary_display = ScreenUtil::GetSecondaryDisplay();

DisplayLayout display_layout(DisplayLayout::RIGHT, 50);
display_manager->SetLayoutForCurrentDisplays(display_layout);

EXPECT_NE(primary_display.id(), secondary_display.id());
aura::Window* primary_root =
display_controller->GetRootWindowForDisplayId(primary_display.id());
aura::Window* secondary_root =
display_controller->GetRootWindowForDisplayId(secondary_display.id());
EXPECT_NE(primary_root, secondary_root);
aura::Window* shelf_window =
Shelf::ForPrimaryDisplay()->shelf_widget()->GetNativeView();
EXPECT_TRUE(primary_root->Contains(shelf_window));
EXPECT_FALSE(secondary_root->Contains(shelf_window));
EXPECT_EQ(primary_display.id(),
Shell::GetScreen()->GetDisplayNearestPoint(
gfx::Point(-100, -100)).id());
EXPECT_EQ(primary_display.id(),
Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());

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 300x252", secondary_display.work_area().ToString());
EXPECT_EQ("right, 50",
display_manager->GetCurrentDisplayLayout().ToString());

// Switch primary and secondary
display_controller->SetPrimaryDisplay(secondary_display);
const DisplayLayout& inverted_layout =
display_manager->GetCurrentDisplayLayout();
EXPECT_EQ("left, -50", inverted_layout.ToString());

EXPECT_EQ(secondary_display.id(),
Shell::GetScreen()->GetPrimaryDisplay().id());
EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id());
EXPECT_EQ(primary_display.id(),
Shell::GetScreen()->GetDisplayNearestPoint(
gfx::Point(-100, -100)).id());
EXPECT_EQ(secondary_display.id(),
Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());

EXPECT_EQ(
primary_root,
display_controller->GetRootWindowForDisplayId(secondary_display.id()));
EXPECT_EQ(
secondary_root,
display_controller->GetRootWindowForDisplayId(primary_display.id()));
EXPECT_TRUE(primary_root->Contains(shelf_window));
EXPECT_FALSE(secondary_root->Contains(shelf_window));

// Test if the bounds are correctly swapped.
gfx::Display swapped_primary = Shell::GetScreen()->GetPrimaryDisplay();
gfx::Display swapped_secondary = ScreenUtil::GetSecondaryDisplay();
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 200x152", swapped_secondary.work_area().ToString());

aura::WindowTracker tracker;
tracker.Add(primary_root);
tracker.Add(secondary_root);

// Deleting 2nd display should move the primary to original primary display.
UpdateDisplay("200x200");
RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task.
EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays());
EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetPrimaryDisplay().id());
EXPECT_EQ(primary_display.id(),
Shell::GetScreen()->GetDisplayNearestPoint(
gfx::Point(-100, -100)).id());
EXPECT_EQ(primary_display.id(),
Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
EXPECT_TRUE(tracker.Contains(primary_root));
EXPECT_FALSE(tracker.Contains(secondary_root));
EXPECT_TRUE(primary_root->Contains(shelf_window));
}

TEST_F(DisplayControllerTest, SwapPrimaryById) {
if (!SupportsMultipleDisplays())
return;
Expand Down
10 changes: 3 additions & 7 deletions ash/resources/ash_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_BACKGROUND" file="common/launcher/launcher_background.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_CORNER" file="common/launcher/launcher_corner.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_DIMMING" file="common/launcher/launcher_dimming.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_ICON_APPLIST" file="common/launcher/launcher_appmenu.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_ICON_APPLIST_ALTERNATE" file="common/alt_launcher/status_app_menu_icon.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_ICON_APPLIST" file="common/alt_launcher/status_app_menu_icon.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_ICON_APPLIST_HOT" file="common/launcher/launcher_appmenu_hover.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_ICON_APPLIST_PUSHED" file="common/launcher/launcher_appmenu_pressed.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_LIST_BROWSER" file="common/launcher/window_switcher_icon_normal.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_LIST_INCOGNITO_BROWSER" file="common/launcher/window_switcher_icon_incognito.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_OVERFLOW" file="common/launcher/launcher_overflow.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_UNDERLINE_ACTIVE" file="common/launcher/launcher_underline_bottom_active.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_UNDERLINE_ACTIVE_ALTERNATE" file="common/alt_launcher/launcher_underline_active.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_UNDERLINE_HOVER" file="common/launcher/launcher_underline_bottom_hover.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_UNDERLINE_RUNNING" file="common/launcher/launcher_underline_bottom_running.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_UNDERLINE_RUNNING_ALTERNATE" file="common/alt_launcher/launcher_underline_running.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_UNDERLINE_ACTIVE" file="common/alt_launcher/launcher_underline_active.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_UNDERLINE_RUNNING" file="common/alt_launcher/launcher_underline_running.png" />
<structure type="chrome_scaled_image" name="IDR_ASH_SHELF_ICON_TASK_MANAGER" file="common/launcher/task_manager.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_MULTI_WINDOW_RESIZE_H" file="common/multi_window_resize_horizontal.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_MULTI_WINDOW_RESIZE_V" file="common/multi_window_resize_vertical.png" />
Expand Down
54 changes: 0 additions & 54 deletions ash/shelf/alternate_app_list_button.h

This file was deleted.

Loading

0 comments on commit 0ac2311

Please sign in to comment.