summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/launcher/alternate_app_list_button.cc21
-rw-r--r--ash/launcher/alternate_app_list_button.h3
-rw-r--r--ash/launcher/launcher_button.cc2
-rw-r--r--ash/launcher/launcher_model.cc40
-rw-r--r--ash/launcher/launcher_view.cc181
-rw-r--r--ash/launcher/launcher_view_unittest.cc44
-rw-r--r--ash/launcher/overflow_bubble.cc2
-rw-r--r--ash/shelf/shelf_layout_manager.cc43
-rw-r--r--ash/system/status_area_widget_delegate.cc5
-rw-r--r--ash/system/tray/tray_background_view.cc4
-rw-r--r--ash/system/tray/tray_constants.cc9
-rw-r--r--ash/system/tray/tray_constants.h4
-rw-r--r--ash/system/web_notification/web_notification_tray.cc3
-rw-r--r--ash/test/launcher_view_test_api.cc5
-rw-r--r--ash/test/launcher_view_test_api.h4
-rw-r--r--ui/views/bubble/tray_bubble_view.cc4
16 files changed, 222 insertions, 152 deletions
diff --git a/ash/launcher/alternate_app_list_button.cc b/ash/launcher/alternate_app_list_button.cc
index 9a2ffcc..0466c71 100644
--- a/ash/launcher/alternate_app_list_button.cc
+++ b/ash/launcher/alternate_app_list_button.cc
@@ -146,26 +146,5 @@ void AlternateAppListButton::GetAccessibleState(
state->name = host_->GetAccessibleName(this);
}
-void AlternateAppListButton::OnGestureEvent(ui::GestureEvent* event) {
- switch (event->type()) {
- case ui::ET_GESTURE_SCROLL_BEGIN:
- host_->PointerPressedOnButton(this, LauncherButtonHost::TOUCH, *event);
- event->SetHandled();
- return;
- case ui::ET_GESTURE_SCROLL_UPDATE:
- host_->PointerDraggedOnButton(this, LauncherButtonHost::TOUCH, *event);
- event->SetHandled();
- return;
- case ui::ET_GESTURE_SCROLL_END:
- case ui::ET_SCROLL_FLING_START:
- host_->PointerReleasedOnButton(this, LauncherButtonHost::TOUCH, false);
- event->SetHandled();
- return;
- default:
- ImageButton::OnGestureEvent(event);
- return;
- }
-}
-
} // namespace internal
} // namespace ash
diff --git a/ash/launcher/alternate_app_list_button.h b/ash/launcher/alternate_app_list_button.h
index b03c31e..f68207c 100644
--- a/ash/launcher/alternate_app_list_button.h
+++ b/ash/launcher/alternate_app_list_button.h
@@ -43,9 +43,6 @@ class AlternateAppListButton : public views::ImageButton {
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
- // ui::EventHandler overrides:
- virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
-
private:
LauncherButtonHost* host_;
// Reference to the shelf widget containing this button, owned by the
diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc
index 194c7c4..2859d98 100644
--- a/ash/launcher/launcher_button.cc
+++ b/ash/launcher/launcher_button.cc
@@ -33,7 +33,7 @@ const int kBarSpacing = 5;
const int kIconSize = 32;
const int kHopSpacing = 2;
const int kIconPad = 8;
-const int kAlternateIconPad = 7;
+const int kAlternateIconPad = 5;
const int kHopUpMS = 0;
const int kHopDownMS = 200;
const int kAttentionThrobDurationMS = 800;
diff --git a/ash/launcher/launcher_model.cc b/ash/launcher/launcher_model.cc
index 8daf561..9607de6 100644
--- a/ash/launcher/launcher_model.cc
+++ b/ash/launcher/launcher_model.cc
@@ -14,18 +14,34 @@ namespace ash {
namespace {
int LauncherItemTypeToWeight(LauncherItemType type) {
- switch (type) {
- case TYPE_BROWSER_SHORTCUT:
- case TYPE_APP_SHORTCUT:
- case TYPE_WINDOWED_APP:
- return 0;
- case TYPE_TABBED:
- case TYPE_PLATFORM_APP:
- return 1;
- case TYPE_APP_LIST:
- return ash::switches::UseAlternateShelfLayout() ? 0 : 2;
- case TYPE_APP_PANEL:
- return 3;
+ if (ash::switches::UseAlternateShelfLayout()) {
+ switch (type) {
+ case TYPE_APP_LIST:
+ return 0;
+ case TYPE_BROWSER_SHORTCUT:
+ case TYPE_APP_SHORTCUT:
+ case TYPE_WINDOWED_APP:
+ return 1;
+ case TYPE_TABBED:
+ case TYPE_PLATFORM_APP:
+ return 2;
+ case TYPE_APP_PANEL:
+ return 3;
+ }
+ } else {
+ switch (type) {
+ case TYPE_BROWSER_SHORTCUT:
+ case TYPE_APP_SHORTCUT:
+ case TYPE_WINDOWED_APP:
+ return 0;
+ case TYPE_TABBED:
+ case TYPE_PLATFORM_APP:
+ return 1;
+ case TYPE_APP_LIST:
+ return 2;
+ case TYPE_APP_PANEL:
+ return 3;
+ }
}
NOTREACHED() << "Invalid type " << type;
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index caa7f1e..2bc06d5 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -65,6 +65,10 @@ const int kMinimumDragDistance = 8;
// Size between the buttons.
const int kButtonSpacing = 4;
+const int kAlternateButtonSpacing = 10;
+
+// Size allocated to for each button.
+const int kButtonSize = 44;
// Additional spacing for the left and right side of icons.
const int kHorizontalIconSpacing = 2;
@@ -685,28 +689,22 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
return;
int first_panel_index = model_->FirstPanelIndex();
- // TODO(harrym): if alternate shelf layout stays, rename app_list_index.
- int app_list_index = first_panel_index - 1;
+ int last_button_index = first_panel_index - 1;
// Initial x,y values account both leading_inset in primary
// coordinate and secondary coordinate based on the dynamic edge of the
// launcher (eg top edge on bottom-aligned launcher).
- int x = shelf->SelectValueForShelfAlignment(
- leading_inset(),
- 0,
- 0,
- leading_inset());
- int y = shelf->SelectValueForShelfAlignment(
- 0,
- leading_inset(),
- leading_inset(),
- 0);
-
- int shelf_size = ash::switches::UseAlternateShelfLayout() ?
- ShelfLayoutManager::kShelfSize : kLauncherPreferredSize;
-
- int w = shelf->PrimaryAxisValue(shelf_size, width());
- int h = shelf->PrimaryAxisValue(height(), shelf_size);
+ int inset = ash::switches::UseAlternateShelfLayout() ? 0 : leading_inset();
+ int x = shelf->SelectValueForShelfAlignment(inset, 0, 0, inset);
+ int y = shelf->SelectValueForShelfAlignment(0, inset, inset, 0);
+
+ int button_size = ash::switches::UseAlternateShelfLayout() ?
+ kButtonSize : kLauncherPreferredSize;
+ int button_spacing = ash::switches::UseAlternateShelfLayout() ?
+ kAlternateButtonSpacing : kButtonSpacing;
+
+ int w = shelf->PrimaryAxisValue(button_size, width());
+ int h = shelf->PrimaryAxisValue(height(), button_size);
for (int i = 0; i < view_model_->view_size(); ++i) {
if (i < first_visible_index_) {
view_model_->set_ideal_bounds(i, gfx::Rect(x, y, 0, 0));
@@ -714,39 +712,42 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
}
view_model_->set_ideal_bounds(i, gfx::Rect(x, y, w, h));
- if (i != app_list_index) {
- x = shelf->PrimaryAxisValue(x + w + kButtonSpacing, x);
- y = shelf->PrimaryAxisValue(y, y + h + kButtonSpacing);
+ if (i != last_button_index) {
+ x = shelf->PrimaryAxisValue(x + w + button_spacing, x);
+ y = shelf->PrimaryAxisValue(y, y + h + button_spacing);
}
}
if (is_overflow_mode()) {
DCHECK_LT(last_visible_index_, view_model_->view_size());
for (int i = 0; i < view_model_->view_size(); ++i) {
- view_model_->view_at(i)->SetVisible(
- i >= first_visible_index_ &&
- i != app_list_index &&
- i <= last_visible_index_);
+ bool visible = i >= first_visible_index_ &&
+ i <= last_visible_index_;
+ if (!ash::switches::UseAlternateShelfLayout())
+ visible &= i != last_button_index;
+ view_model_->view_at(i)->SetVisible(visible);
}
return;
}
// To address Fitt's law, we make the first launcher button include the
// leading inset (if there is one).
- if (view_model_->view_size() > 0) {
- view_model_->set_ideal_bounds(0, gfx::Rect(gfx::Size(
- shelf->PrimaryAxisValue(leading_inset() + w, w),
- shelf->PrimaryAxisValue(h, leading_inset() + h))));
+ if (!ash::switches::UseAlternateShelfLayout()) {
+ if (view_model_->view_size() > 0) {
+ view_model_->set_ideal_bounds(0, gfx::Rect(gfx::Size(
+ shelf->PrimaryAxisValue(inset + w, w),
+ shelf->PrimaryAxisValue(h, inset + h))));
+ }
}
// Right aligned icons.
- int end_position = available_size - kButtonSpacing;
+ int end_position = available_size - button_spacing;
x = shelf->PrimaryAxisValue(end_position, 0);
y = shelf->PrimaryAxisValue(0, end_position);
for (int i = view_model_->view_size() - 1;
i >= first_panel_index; --i) {
- x = shelf->PrimaryAxisValue(x - w - kButtonSpacing, x);
- y = shelf->PrimaryAxisValue(y, y - h - kButtonSpacing);
+ x = shelf->PrimaryAxisValue(x - w - button_spacing, x);
+ y = shelf->PrimaryAxisValue(y, y - h - button_spacing);
view_model_->set_ideal_bounds(i, gfx::Rect(x, y, w, h));
end_position = shelf->PrimaryAxisValue(x, y);
}
@@ -754,9 +755,11 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
// Icons on the left / top are guaranteed up to kLeftIconProportion of
// the available space.
int last_icon_position = shelf->PrimaryAxisValue(
- view_model_->ideal_bounds(first_panel_index - 1).right(),
- view_model_->ideal_bounds(first_panel_index - 1).bottom()) +
- 2 * kLauncherPreferredSize + leading_inset();
+ view_model_->ideal_bounds(last_button_index).right(),
+ view_model_->ideal_bounds(last_button_index).bottom())
+ + button_size + inset;
+ if (!ash::switches::UseAlternateShelfLayout())
+ last_icon_position += button_size;
int reserved_icon_space = available_size * kReservedNonPanelIconProportion;
if (last_icon_position < reserved_icon_space)
end_position = last_icon_position;
@@ -766,34 +769,38 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
bounds->overflow_bounds.set_size(gfx::Size(
shelf->PrimaryAxisValue(w, width()),
shelf->PrimaryAxisValue(height(), h)));
- last_visible_index_ = DetermineLastVisibleIndex(
- end_position - leading_inset() - 2 * kLauncherPreferredSize);
+ if (ash::switches::UseAlternateShelfLayout())
+ last_visible_index_ = DetermineLastVisibleIndex(
+ end_position - button_size);
+ else
+ last_visible_index_ = DetermineLastVisibleIndex(
+ end_position - inset - 2 * button_size);
last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1;
- bool show_overflow = (last_visible_index_ + 1 < app_list_index ||
- last_hidden_index_ >= first_panel_index);
-
+ bool show_overflow =
+ ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) +
+ last_visible_index_ < last_button_index ||
+ last_hidden_index_ >= first_panel_index);
+
+ // Create Space for the overflow button
+ if (show_overflow && ash::switches::UseAlternateShelfLayout()) {
+ DCHECK(last_visible_index_ > 0);
+ --last_visible_index_;
+ }
for (int i = 0; i < view_model_->view_size(); ++i) {
- view_model_->view_at(i)->SetVisible(
- i <= last_visible_index_ ||
- i == app_list_index ||
- i > last_hidden_index_);
+ bool visible = i <= last_visible_index_ || i > last_hidden_index_;
+ // Always show the app list.
+ if (!ash::switches::UseAlternateShelfLayout())
+ visible |= (i == last_button_index);
+ view_model_->view_at(i)->SetVisible(visible);
}
overflow_button_->SetVisible(show_overflow);
if (show_overflow) {
DCHECK_NE(0, view_model_->view_size());
if (last_visible_index_ == -1) {
- x = shelf->SelectValueForShelfAlignment(
- leading_inset(),
- 0,
- 0,
- leading_inset());
- y = shelf->SelectValueForShelfAlignment(
- 0,
- leading_inset(),
- leading_inset(),
- 0);
- } else if (last_visible_index_ == app_list_index) {
+ x = shelf->SelectValueForShelfAlignment(inset, 0, 0, inset);
+ y = shelf->SelectValueForShelfAlignment(0, inset, inset, 0);
+ } else if (last_visible_index_ == last_button_index) {
x = view_model_->ideal_bounds(last_visible_index_).x();
y = view_model_->ideal_bounds(last_visible_index_).y();
} else {
@@ -804,20 +811,22 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
view_model_->ideal_bounds(last_visible_index_).y(),
view_model_->ideal_bounds(last_visible_index_).bottom());
}
- gfx::Rect app_list_bounds = view_model_->ideal_bounds(app_list_index);
- bounds->overflow_bounds.set_x(x);
- bounds->overflow_bounds.set_y(y);
-
// Set all hidden panel icon positions to be on the overflow button.
for (int i = first_panel_index; i <= last_hidden_index_; ++i)
view_model_->set_ideal_bounds(i, gfx::Rect(x, y, w, h));
- x = shelf->PrimaryAxisValue(x + w + kButtonSpacing, x);
- y = shelf->PrimaryAxisValue(y, y + h + kButtonSpacing);
- app_list_bounds.set_x(x);
- app_list_bounds.set_y(y);
- view_model_->set_ideal_bounds(app_list_index, app_list_bounds);
-
+ bounds->overflow_bounds.set_x(x);
+ bounds->overflow_bounds.set_y(y);
+ if (!ash::switches::UseAlternateShelfLayout()) {
+ // Position app list after overflow button.
+ gfx::Rect app_list_bounds = view_model_->ideal_bounds(last_button_index);
+
+ x = shelf->PrimaryAxisValue(x + w + button_spacing, x);
+ y = shelf->PrimaryAxisValue(y, y + h + button_spacing);
+ app_list_bounds.set_x(x);
+ app_list_bounds.set_y(y);
+ view_model_->set_ideal_bounds(last_button_index, app_list_bounds);
+ }
if (overflow_bubble_.get() && overflow_bubble_->IsShowing())
UpdateOverflowRange(overflow_bubble_->launcher_view());
} else {
@@ -1035,36 +1044,17 @@ void LauncherView::ContinueDrag(const ui::LocatedEvent& event) {
bool LauncherView::SameDragType(LauncherItemType typea,
LauncherItemType typeb) const {
- if (ash::switches::UseAlternateShelfLayout()) {
- // TODO(harrym): Allow app list to be repositionable, if this goes live
- // (no flag) the pref file has to be updated so the changes persist.
- switch (typea) {
- case TYPE_TABBED:
- case TYPE_PLATFORM_APP:
+ switch (typea) {
+ case TYPE_TABBED:
+ case TYPE_PLATFORM_APP:
return (typeb == TYPE_TABBED || typeb == TYPE_PLATFORM_APP);
- case TYPE_APP_SHORTCUT:
- case TYPE_APP_LIST:
- case TYPE_BROWSER_SHORTCUT:
- return (typeb == TYPE_APP_SHORTCUT ||
- typeb == TYPE_APP_LIST ||
- typeb == TYPE_BROWSER_SHORTCUT);
- case TYPE_WINDOWED_APP:
- case TYPE_APP_PANEL:
- return typeb == typea;
- }
- } else {
- switch (typea) {
- case TYPE_TABBED:
- case TYPE_PLATFORM_APP:
- return (typeb == TYPE_TABBED || typeb == TYPE_PLATFORM_APP);
- case TYPE_APP_SHORTCUT:
- case TYPE_BROWSER_SHORTCUT:
- return (typeb == TYPE_APP_SHORTCUT || typeb == TYPE_BROWSER_SHORTCUT);
- case TYPE_WINDOWED_APP:
- case TYPE_APP_LIST:
- case TYPE_APP_PANEL:
- return typeb == typea;
- }
+ case TYPE_APP_SHORTCUT:
+ case TYPE_BROWSER_SHORTCUT:
+ return (typeb == TYPE_APP_SHORTCUT || typeb == TYPE_BROWSER_SHORTCUT);
+ case TYPE_WINDOWED_APP:
+ case TYPE_APP_LIST:
+ case TYPE_APP_PANEL:
+ return typeb == typea;
}
NOTREACHED();
return false;
@@ -1110,6 +1100,9 @@ void LauncherView::ToggleOverflowBubble() {
}
void LauncherView::UpdateFirstButtonPadding() {
+ if (ash::switches::UseAlternateShelfLayout())
+ return;
+
ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager();
// Creates an empty border for first launcher button to make included leading
diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc
index b4b7842..7731655 100644
--- a/ash/launcher/launcher_view_unittest.cc
+++ b/ash/launcher/launcher_view_unittest.cc
@@ -13,6 +13,7 @@
#include "ash/launcher/launcher_icon_observer.h"
#include "ash/launcher/launcher_model.h"
#include "ash/launcher/launcher_tooltip_manager.h"
+#include "ash/launcher/launcher_types.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_widget.h"
@@ -451,6 +452,49 @@ TEST_P(LauncherViewTextDirectionTest, IdealBoundsOfItemIcon) {
EXPECT_EQ(item_bounds.y(), ideal_bounds.y());
}
+// Checks that launcher view contents are considered in the correct drag group.
+TEST_F(LauncherViewTest, EnforceDragType) {
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_TABBED, TYPE_TABBED));
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_TABBED, TYPE_PLATFORM_APP));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_APP_SHORTCUT));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_BROWSER_SHORTCUT));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_WINDOWED_APP));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_APP_LIST));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_APP_PANEL));
+
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_PLATFORM_APP));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_SHORTCUT));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP,
+ TYPE_BROWSER_SHORTCUT));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_WINDOWED_APP));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_LIST));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_PANEL));
+
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_SHORTCUT));
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_SHORTCUT,
+ TYPE_BROWSER_SHORTCUT));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT,
+ TYPE_WINDOWED_APP));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_LIST));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_PANEL));
+
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT,
+ TYPE_BROWSER_SHORTCUT));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT,
+ TYPE_WINDOWED_APP));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_LIST));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_PANEL));
+
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_WINDOWED_APP));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_APP_LIST));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_APP_PANEL));
+
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_LIST));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_PANEL));
+
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_PANEL, TYPE_APP_PANEL));
+}
+
// Adds browser button until overflow and verifies that the last added browser
// button is hidden.
TEST_F(LauncherViewTest, AddBrowserUntilOverflow) {
diff --git a/ash/launcher/overflow_bubble.cc b/ash/launcher/overflow_bubble.cc
index 09613ca..64b3e61 100644
--- a/ash/launcher/overflow_bubble.cc
+++ b/ash/launcher/overflow_bubble.cc
@@ -200,7 +200,7 @@ gfx::Rect OverflowBubbleView::GetBubbleBounds() {
views::BubbleBorder::is_arrow_on_horizontal(arrow()) ?
bubble_insets.left() : bubble_insets.top();
const int arrow_offset = border_size + kPadding + kLauncherViewLeadingInset +
- kLauncherPreferredSize / 2;
+ ShelfLayoutManager::GetPreferredShelfSize() / 2;
const gfx::Size content_size = GetPreferredSize();
border->set_arrow_offset(arrow_offset);
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 6830287..3e9b8f9 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -72,6 +72,9 @@ const int kNotificationBubbleGapHeight = 6;
// the auto hidden shelf when the shelf is on the boundary between displays.
const int kMaxAutoHideShowShelfRegionSize = 10;
+// Const inset from the edget of the shelf to the edget of the status area.
+const int kStatusAreaInset = 3;
+
ui::Layer* GetLayer(views::Widget* widget) {
return widget->GetNativeView()->layer();
}
@@ -747,6 +750,9 @@ void ShelfLayoutManager::CalculateTargetBounds(
int status_inset = std::max(0, GetPreferredShelfSize() -
PrimaryAxisValue(status_size.height(), status_size.width()));
+ if (ash::switches::UseAlternateShelfLayout())
+ status_inset = kStatusAreaInset;
+
target_bounds->status_bounds_in_shelf = SelectValueForShelfAlignment(
gfx::Rect(base::i18n::IsRTL() ? 0 : shelf_width - status_size.width(),
status_inset, status_size.width(), status_size.height()),
@@ -855,12 +861,16 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
available_bounds.bottom() - shelf_height);
}
- // The statusbar should be in the center of the shelf.
- gfx::Rect status_y = target_bounds->shelf_bounds_in_root;
- status_y.set_y(0);
- status_y.ClampToCenteredSize(
- target_bounds->status_bounds_in_shelf.size());
- target_bounds->status_bounds_in_shelf.set_y(status_y.y());
+ if (ash::switches::UseAlternateShelfLayout()) {
+ target_bounds->status_bounds_in_shelf.set_y(kStatusAreaInset);
+ } else {
+ // The statusbar should be in the center of the shelf.
+ gfx::Rect status_y = target_bounds->shelf_bounds_in_root;
+ status_y.set_y(0);
+ status_y.ClampToCenteredSize(
+ target_bounds->status_bounds_in_shelf.size());
+ target_bounds->status_bounds_in_shelf.set_y(status_y.y());
+ }
} else {
// Move and size the launcher with the gesture.
int shelf_width = target_bounds->shelf_bounds_in_root.width();
@@ -875,12 +885,21 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
available_bounds.right() - shelf_width);
}
- // The statusbar should be in the center of the shelf.
- gfx::Rect status_x = target_bounds->shelf_bounds_in_root;
- status_x.set_x(0);
- status_x.ClampToCenteredSize(
- target_bounds->status_bounds_in_shelf.size());
- target_bounds->status_bounds_in_shelf.set_x(status_x.x());
+ if (ash::switches::UseAlternateShelfLayout()) {
+ if (alignment_ == SHELF_ALIGNMENT_RIGHT) {
+ target_bounds->shelf_bounds_in_root.set_x(
+ available_bounds.right() - shelf_width + kStatusAreaInset);
+ } else {
+ target_bounds->shelf_bounds_in_root.set_x(kStatusAreaInset);
+ }
+ } else {
+ // The statusbar should be in the center of the shelf.
+ gfx::Rect status_x = target_bounds->shelf_bounds_in_root;
+ status_x.set_x(0);
+ status_x.ClampToCenteredSize(
+ target_bounds->status_bounds_in_shelf.size());
+ target_bounds->status_bounds_in_shelf.set_x(status_x.x());
+ }
}
}
diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc
index 77d3cbf..7e15b7e 100644
--- a/ash/system/status_area_widget_delegate.cc
+++ b/ash/system/status_area_widget_delegate.cc
@@ -5,6 +5,7 @@
#include "ash/system/status_area_widget_delegate.h"
#include "ash/ash_export.h"
+#include "ash/ash_switches.h"
#include "ash/focus_cycler.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
@@ -98,7 +99,7 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
if (!child->visible())
continue;
if (!is_first_visible_child)
- columns->AddPaddingColumn(0, kTraySpacing);
+ columns->AddPaddingColumn(0, GetTraySpacing());
is_first_visible_child = false;
columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL,
0, /* resize percent */
@@ -124,7 +125,7 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
if (!child->visible())
continue;
if (!is_first_visible_child)
- layout->AddPaddingRow(0, kTraySpacing);
+ layout->AddPaddingRow(0, GetTraySpacing());
is_first_visible_child = false;
layout->StartRow(0, 0);
layout->AddView(child);
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
index 2d788d6..d5e2a30 100644
--- a/ash/system/tray/tray_background_view.cc
+++ b/ash/system/tray/tray_background_view.cc
@@ -288,8 +288,8 @@ void TrayBackgroundView::TrayContainer::UpdateLayout() {
set_border(views::Border::CreateEmptyBorder(
vertical_padding,
horizontal_padding,
- horizontal_padding,
- vertical_padding));
+ vertical_padding,
+ horizontal_padding));
views::BoxLayout* layout =
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0);
diff --git a/ash/system/tray/tray_constants.cc b/ash/system/tray/tray_constants.cc
index 45047e7..6d108c8 100644
--- a/ash/system/tray/tray_constants.cc
+++ b/ash/system/tray/tray_constants.cc
@@ -4,6 +4,7 @@
#include "ash/system/tray/tray_constants.h"
+#include "ash/ash_switches.h"
#include "third_party/skia/include/core/SkColor.h"
namespace ash {
@@ -65,5 +66,13 @@ const int kTrayNotificationContentsWidth = kTrayPopupMinWidth -
(kNotificationIconWidth + kNotificationButtonWidth +
(kTrayPopupPaddingHorizontal / 2) * 3);
const int kTraySpacing = 8;
+const int kAlternateTraySpacing = 4;
+
+// Returns kTraySpacing or kAlternateTraySpacing as applicable
+// (Determined by ash::switches::UseAlternateShelfLayout).
+int GetTraySpacing() {
+ return ash::switches::UseAlternateShelfLayout() ?
+ kAlternateTraySpacing : kTraySpacing;
+}
} // namespace ash
diff --git a/ash/system/tray/tray_constants.h b/ash/system/tray/tray_constants.h
index 2b0f5ae..480d5d54 100644
--- a/ash/system/tray/tray_constants.h
+++ b/ash/system/tray/tray_constants.h
@@ -62,7 +62,9 @@ extern const int kNotificationIconWidth;
extern const int kNotificationButtonWidth;
extern const int kTrayNotificationContentsWidth;
-extern const int kTraySpacing;
+// Returns kTraySpacing or kAlternateTraySpacing as applicable
+// (Determined by ash::switches::UseAlternateShelfLayout).
+int GetTraySpacing();
} // namespace ash
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index 2b33e44..2a6e2de 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -330,7 +330,8 @@ bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings) {
NOTREACHED();
}
- message_center_bubble->SetMaxHeight(std::max(0, max_height - kTraySpacing));
+ message_center_bubble->SetMaxHeight(std::max(0,
+ max_height - GetTraySpacing()));
if (show_settings)
message_center_bubble->SetSettingsVisible();
message_center_bubble_.reset(
diff --git a/ash/test/launcher_view_test_api.cc b/ash/test/launcher_view_test_api.cc
index 13881b3..e357920 100644
--- a/ash/test/launcher_view_test_api.cc
+++ b/ash/test/launcher_view_test_api.cc
@@ -95,5 +95,10 @@ void LauncherViewTestAPI::RunMessageLoopUntilAnimationsDone() {
launcher_view_->bounds_animator_->RemoveObserver(observer.get());
}
+bool LauncherViewTestAPI::SameDragType(LauncherItemType typea,
+ LauncherItemType typeb) const {
+ return launcher_view_->SameDragType(typea, typeb);
+}
+
} // namespace test
} // namespace ash
diff --git a/ash/test/launcher_view_test_api.h b/ash/test/launcher_view_test_api.h
index 35cb444..0162f7f 100644
--- a/ash/test/launcher_view_test_api.h
+++ b/ash/test/launcher_view_test_api.h
@@ -5,6 +5,7 @@
#ifndef ASH_TEST_LAUNCHER_VIEW_TEST_API_H_
#define ASH_TEST_LAUNCHER_VIEW_TEST_API_H_
+#include "ash/launcher/launcher_types.h"
#include "base/basictypes.h"
namespace gfx {
@@ -54,6 +55,9 @@ class LauncherViewTestAPI {
// An accessor for |launcher_view|.
internal::LauncherView* launcher_view() { return launcher_view_; }
+ // Wrapper for LauncherView::SameDragType.
+ bool SameDragType(LauncherItemType typea, LauncherItemType typeb) const;
+
private:
internal::LauncherView* launcher_view_;
diff --git a/ui/views/bubble/tray_bubble_view.cc b/ui/views/bubble/tray_bubble_view.cc
index 76a2d42..40b83b5 100644
--- a/ui/views/bubble/tray_bubble_view.cc
+++ b/ui/views/bubble/tray_bubble_view.cc
@@ -33,10 +33,10 @@ const int kBubbleSpacing = 20;
// The new theme adjusts the menus / bubbles to be flush with the shelf when
// there is no bubble. These are the offsets which need to be applied.
-const int kArrowOffsetTopBottom = 5;
+const int kArrowOffsetTopBottom = 4;
const int kArrowOffsetLeft = 9;
const int kArrowOffsetRight = -5;
-const int kOffsetLeftRightForTopBottomOrientation = 2;
+const int kOffsetLeftRightForTopBottomOrientation = 5;
} // namespace