#include "ash/metrics/user_metrics_recorder.h"
#include "ash/root_window_controller.h"
#include "ash/scoped_target_root_window.h"
-#include "ash/shelf/alternate_app_list_button.h"
#include "ash/shelf/app_list_button.h"
#include "ash/shelf/overflow_bubble.h"
#include "ash/shelf/overflow_bubble_view.h"
#include "base/metrics/histogram.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
+#include "ui/accessibility/ax_view_state.h"
#include "ui/aura/client/screen_position_client.h"
-#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
-#include "ui/base/accessibility/accessible_view_state.h"
+#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/base/resource/resource_bundle.h"
using views::View;
namespace ash {
-namespace internal {
const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM = 0;
const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT = 1;
// Minimum distance before drag starts.
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;
namespace {
+// A class to temporarily disable a given bounds animator.
+class BoundsAnimatorDisabler {
+ public:
+ BoundsAnimatorDisabler(views::BoundsAnimator* bounds_animator)
+ : old_duration_(bounds_animator->GetAnimationDuration()),
+ bounds_animator_(bounds_animator) {
+ bounds_animator_->SetAnimationDuration(1);
+ }
+
+ ~BoundsAnimatorDisabler() {
+ bounds_animator_->SetAnimationDuration(old_duration_);
+ }
+
+ private:
+ // The previous animation duration.
+ int old_duration_;
+ // The bounds animator which gets used.
+ views::BoundsAnimator* bounds_animator_;
+
+ DISALLOW_COPY_AND_ASSIGN(BoundsAnimatorDisabler);
+};
+
// The MenuModelAdapter gets slightly changed to adapt the menu appearance to
// our requirements.
class ShelfMenuModelAdapter : public views::MenuModelAdapter {
DISALLOW_COPY_AND_ASSIGN(FadeInAnimationDelegate);
};
-void ReflectItemStatus(const LauncherItem& item, ShelfButton* button) {
+void ReflectItemStatus(const ShelfItem& item, ShelfButton* button) {
switch (item.status) {
case STATUS_CLOSED:
button->ClearState(ShelfButton::STATE_ACTIVE);
closing_event_time_(base::TimeDelta()),
got_deleted_(NULL),
drag_and_drop_item_pinned_(false),
- drag_and_drop_launcher_id_(0),
+ drag_and_drop_shelf_id_(0),
dragged_off_shelf_(false),
snap_back_from_rip_off_view_(NULL),
item_manager_(Shell::GetInstance()->shelf_item_delegate_manager()),
void ShelfView::Init() {
model_->AddObserver(this);
- const LauncherItems& items(model_->items());
- for (LauncherItems::const_iterator i = items.begin(); i != items.end(); ++i) {
+ const ShelfItems& items(model_->items());
+ for (ShelfItems::const_iterator i = items.begin(); i != items.end(); ++i) {
views::View* child = CreateViewForItem(*i);
child->SetPaintToLayer(true);
view_model_->Add(child, static_cast<int>(i - items.begin()));
AddChildView(child);
}
- ShelfStatusChanged();
overflow_button_ = new OverflowButton(this);
overflow_button_->set_context_menu_controller(this);
ConfigureChildView(overflow_button_);
AddChildView(overflow_button_);
- UpdateFirstButtonPadding();
// We'll layout when our bounds change.
}
void ShelfView::OnShelfAlignmentChanged() {
- UpdateFirstButtonPadding();
overflow_button_->OnShelfAlignmentChanged();
LayoutToIdealBounds();
for (int i=0; i < view_model_->view_size(); ++i) {
- // TODO: remove when AppIcon is a Shelf Button.
- if (TYPE_APP_LIST == model_->items()[i].type &&
- !ash::switches::UseAlternateShelfLayout()) {
- static_cast<AppListButton*>(view_model_->view_at(i))->SetImageAlignment(
- layout_manager_->SelectValueForShelfAlignment(
- views::ImageButton::ALIGN_CENTER,
- views::ImageButton::ALIGN_LEFT,
- views::ImageButton::ALIGN_RIGHT,
- views::ImageButton::ALIGN_CENTER),
- layout_manager_->SelectValueForShelfAlignment(
- views::ImageButton::ALIGN_TOP,
- views::ImageButton::ALIGN_MIDDLE,
- views::ImageButton::ALIGN_MIDDLE,
- views::ImageButton::ALIGN_BOTTOM));
- }
if (i >= first_visible_index_ && i <= last_visible_index_)
view_model_->view_at(i)->Layout();
}
overflow_button_->SchedulePaint();
}
-gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(LauncherID id) {
+gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(ShelfID id) {
int index = model_->ItemIndexByID(id);
if (index == -1 || (index > last_visible_index_ &&
index < model_->FirstPanelIndex()))
icon_bounds.height());
}
-void ShelfView::UpdatePanelIconPosition(LauncherID id,
+void ShelfView::UpdatePanelIconPosition(ShelfID id,
const gfx::Point& midpoint) {
int current_index = model_->ItemIndexByID(id);
int first_panel_index = model_->FirstPanelIndex();
const gfx::Vector2d& cursor_offset_from_center,
float scale_factor) {
drag_replaced_view_ = replaced_view;
- drag_image_.reset(new ash::internal::DragImageView(
+ drag_image_.reset(new ash::DragImageView(
drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow(),
ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE));
drag_image_->SetImage(icon);
void ShelfView::UpdateDragIconProxy(
const gfx::Point& location_in_screen_coordinates) {
- drag_image_->SetScreenPosition(
- location_in_screen_coordinates - drag_image_offset_);
+ // TODO(jennyz): Investigate why drag_image_ becomes NULL at this point per
+ // crbug.com/34722, while the app list item is still being dragged around.
+ if (drag_image_) {
+ drag_image_->SetScreenPosition(
+ location_in_screen_coordinates - drag_image_offset_);
+ }
}
void ShelfView::DestroyDragIconProxy() {
const gfx::Point& location_in_screen_coordinates) {
// Bail if an operation is already going on - or the cursor is not inside.
// This could happen if mouse / touch operations overlap.
- if (drag_and_drop_launcher_id_ ||
+ if (drag_and_drop_shelf_id_ ||
!GetBoundsInScreen().Contains(location_in_screen_coordinates))
return false;
CancelDrag(-1);
drag_and_drop_item_pinned_ = false;
drag_and_drop_app_id_ = app_id;
- drag_and_drop_launcher_id_ =
- delegate_->GetLauncherIDForAppID(drag_and_drop_app_id_);
+ drag_and_drop_shelf_id_ =
+ delegate_->GetShelfIDForAppID(drag_and_drop_app_id_);
// Check if the application is known and pinned - if not, we have to pin it so
// that we can re-arrange the shelf order accordingly. Note that items have
// to be pinned to give them the same (order) possibilities as a shortcut.
// When an item is dragged from overflow to shelf, IsShowingOverflowBubble()
// returns true. At this time, we don't need to pin the item.
if (!IsShowingOverflowBubble() &&
- (!drag_and_drop_launcher_id_ ||
+ (!drag_and_drop_shelf_id_ ||
!delegate_->IsAppPinned(app_id))) {
delegate_->PinAppWithID(app_id);
- drag_and_drop_launcher_id_ =
- delegate_->GetLauncherIDForAppID(drag_and_drop_app_id_);
- if (!drag_and_drop_launcher_id_)
+ drag_and_drop_shelf_id_ =
+ delegate_->GetShelfIDForAppID(drag_and_drop_app_id_);
+ if (!drag_and_drop_shelf_id_)
return false;
drag_and_drop_item_pinned_ = true;
}
views::View* drag_and_drop_view = view_model_->view_at(
- model_->ItemIndexByID(drag_and_drop_launcher_id_));
+ model_->ItemIndexByID(drag_and_drop_shelf_id_));
DCHECK(drag_and_drop_view);
// Since there is already an icon presented by the caller, we hide this item
}
bool ShelfView::Drag(const gfx::Point& location_in_screen_coordinates) {
- if (!drag_and_drop_launcher_id_ ||
+ if (!drag_and_drop_shelf_id_ ||
!GetBoundsInScreen().Contains(location_in_screen_coordinates))
return false;
gfx::Point pt = location_in_screen_coordinates;
views::View* drag_and_drop_view = view_model_->view_at(
- model_->ItemIndexByID(drag_and_drop_launcher_id_));
+ model_->ItemIndexByID(drag_and_drop_shelf_id_));
ConvertPointFromScreen(drag_and_drop_view, &pt);
gfx::Point point_in_root = location_in_screen_coordinates;
ash::wm::ConvertPointFromScreen(
}
void ShelfView::EndDrag(bool cancel) {
- if (!drag_and_drop_launcher_id_)
+ if (!drag_and_drop_shelf_id_)
return;
views::View* drag_and_drop_view = view_model_->view_at(
- model_->ItemIndexByID(drag_and_drop_launcher_id_));
+ model_->ItemIndexByID(drag_and_drop_shelf_id_));
PointerReleasedOnButton(
drag_and_drop_view, ShelfButtonHost::DRAG_AND_DROP, cancel);
}
}
- drag_and_drop_launcher_id_ = 0;
+ drag_and_drop_shelf_id_ = 0;
}
void ShelfView::LayoutToIdealBounds() {
void ShelfView::UpdateAllButtonsVisibilityInOverflowMode() {
// The overflow button is not shown in overflow mode.
overflow_button_->SetVisible(false);
- int last_button_index = model_->FirstPanelIndex() - 1;
DCHECK_LT(last_visible_index_, view_model_->view_size());
for (int i = 0; i < view_model_->view_size(); ++i) {
bool visible = i >= first_visible_index_ &&
i <= last_visible_index_;
- if (!ash::switches::UseAlternateShelfLayout())
- visible &= i != last_button_index;
-
// To track the dragging of |drag_view_| continuously, its visibility
// should be always true regardless of its position.
if (dragged_off_from_overflow_to_shelf_ &&
int first_panel_index = model_->FirstPanelIndex();
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
- // shelf (eg top edge on bottom-aligned shelf).
- int inset = ash::switches::UseAlternateShelfLayout() ? 0 : leading_inset_;
- int x = layout_manager_->SelectValueForShelfAlignment(inset, 0, 0, inset);
- int y = layout_manager_->SelectValueForShelfAlignment(0, inset, inset, 0);
-
- int button_size = GetButtonSize();
- int button_spacing = GetButtonSpacing();
+ int x = 0;
+ int y = 0;
+ int button_size = kShelfButtonSize;
+ int button_spacing = kShelfButtonSpacing;
int w = layout_manager_->PrimaryAxisValue(button_size, width());
int h = layout_manager_->PrimaryAxisValue(height(), button_size);
return;
}
- // To address Fitt's law, we make the first shelf button include the
- // leading inset (if there is one).
- if (!ash::switches::UseAlternateShelfLayout()) {
- if (view_model_->view_size() > 0) {
- view_model_->set_ideal_bounds(0, gfx::Rect(gfx::Size(
- layout_manager_->PrimaryAxisValue(inset + w, w),
- layout_manager_->PrimaryAxisValue(h, inset + h))));
- }
- }
-
// Right aligned icons.
int end_position = available_size - button_spacing;
x = layout_manager_->PrimaryAxisValue(end_position, 0);
// the available space.
int last_icon_position = layout_manager_->PrimaryAxisValue(
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;
+ view_model_->ideal_bounds(last_button_index).bottom()) + button_size;
int reserved_icon_space = available_size * kReservedNonPanelIconProportion;
if (last_icon_position < reserved_icon_space)
end_position = last_icon_position;
gfx::Size(layout_manager_->PrimaryAxisValue(w, width()),
layout_manager_->PrimaryAxisValue(height(), h)));
- if (ash::switches::UseAlternateShelfLayout()) {
- last_visible_index_ = DetermineLastVisibleIndex(
- end_position - button_size);
- } else {
- last_visible_index_ = DetermineLastVisibleIndex(
- end_position - inset - 2 * button_size);
- }
+ last_visible_index_ = DetermineLastVisibleIndex(
+ end_position - button_size);
last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1;
- bool show_overflow =
- ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) +
- last_visible_index_ < last_button_index ||
- last_hidden_index_ >= first_panel_index);
+ bool show_overflow = last_visible_index_ < last_button_index ||
+ last_hidden_index_ >= first_panel_index;
// Create Space for the overflow button
- if (show_overflow && ash::switches::UseAlternateShelfLayout() &&
+ if (show_overflow &&
last_visible_index_ > 0 && last_visible_index_ < last_button_index)
--last_visible_index_;
for (int i = 0; i < view_model_->view_size(); ++i) {
bool visible = i <= last_visible_index_ || i > last_hidden_index_;
- // Always show the app list.
- if (!ash::switches::UseAlternateShelfLayout())
- visible |= (i == last_button_index);
// To receive drag event continously from |drag_view_| during the dragging
// off from the shelf, don't make |drag_view_| invisible. It will be
// eventually invisible and removed from the |view_model_| by
if (show_overflow) {
DCHECK_NE(0, view_model_->view_size());
if (last_visible_index_ == -1) {
- x = layout_manager_->SelectValueForShelfAlignment(inset, 0, 0, inset);
- y = layout_manager_->SelectValueForShelfAlignment(0, inset, inset, 0);
- } else if (last_visible_index_ == last_button_index
- && !ash::switches::UseAlternateShelfLayout()) {
- x = view_model_->ideal_bounds(last_visible_index_).x();
- y = view_model_->ideal_bounds(last_visible_index_).y();
+ x = 0;
+ y = 0;
} else {
x = layout_manager_->PrimaryAxisValue(
view_model_->ideal_bounds(last_visible_index_).right(),
// Add more space between last visible item and overflow button.
// Without this, two buttons look too close compared with other items.
- if (ash::switches::UseAlternateShelfLayout()) {
- x = layout_manager_->PrimaryAxisValue(x + button_spacing, x);
- y = layout_manager_->PrimaryAxisValue(y, y + button_spacing);
- }
+ x = layout_manager_->PrimaryAxisValue(x + button_spacing, x);
+ y = layout_manager_->PrimaryAxisValue(y, y + button_spacing);
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 = layout_manager_->PrimaryAxisValue(x + w + button_spacing, x);
- y = layout_manager_->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_->shelf_view());
} else {
// padding of the first gets properly transferred to the new first item.
if (i && view->border())
view->SetBorder(views::Border::NullBorder());
- else if (!i && !view->border())
- UpdateFirstButtonPadding();
}
overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds);
}
-views::View* ShelfView::CreateViewForItem(const LauncherItem& item) {
+views::View* ShelfView::CreateViewForItem(const ShelfItem& item) {
views::View* view = NULL;
switch (item.type) {
case TYPE_BROWSER_SHORTCUT:
}
case TYPE_APP_LIST: {
- if (ash::switches::UseAlternateShelfLayout()) {
- view = new AlternateAppListButton(this,
- this,
- layout_manager_->shelf_widget());
- } else {
- // TODO(dave): turn this into a ShelfButton too.
- AppListButton* button = new AppListButton(this, this);
- button->SetImageAlignment(
- layout_manager_->SelectValueForShelfAlignment(
- views::ImageButton::ALIGN_CENTER,
- views::ImageButton::ALIGN_LEFT,
- views::ImageButton::ALIGN_RIGHT,
- views::ImageButton::ALIGN_CENTER),
- layout_manager_->SelectValueForShelfAlignment(
- views::ImageButton::ALIGN_TOP,
- views::ImageButton::ALIGN_MIDDLE,
- views::ImageButton::ALIGN_MIDDLE,
- views::ImageButton::ALIGN_BOTTOM));
- view = button;
- }
+ view = new AppListButton(this, this, layout_manager_->shelf_widget());
break;
}
// If this is not a drag and drop host operation and not the app list item,
// check if the item got ripped off the shelf - if it did we are done.
- if (!drag_and_drop_launcher_id_ && ash::switches::UseDragOffShelf() &&
+ if (!drag_and_drop_shelf_id_ &&
RemovableByRipOff(current_index) != NOT_REMOVABLE) {
if (HandleRipOffDrag(event))
return;
int current_index = view_model_->GetIndexOfView(drag_view_);
DCHECK_NE(-1, current_index);
std::string dragged_app_id =
- delegate_->GetAppIDForLauncherID(model_->items()[current_index].id);
+ delegate_->GetAppIDForShelfID(model_->items()[current_index].id);
gfx::Point screen_location = event.root_location();
ash::wm::ConvertPointToScreen(GetWidget()->GetNativeWindow()->GetRootWindow(),
// Make sure the item stays invisible upon removal.
drag_view_->SetVisible(false);
std::string app_id =
- delegate_->GetAppIDForLauncherID(model_->items()[current_index].id);
+ delegate_->GetAppIDForShelfID(model_->items()[current_index].id);
delegate_->UnpinAppWithID(app_id);
}
}
if (type == TYPE_APP_LIST || type == TYPE_DIALOG || !delegate_->CanPin())
return NOT_REMOVABLE;
- std::string app_id =
- delegate_->GetAppIDForLauncherID(model_->items()[index].id);
+ std::string app_id = delegate_->GetAppIDForShelfID(model_->items()[index].id);
// Note: Only pinned app shortcuts can be removed!
return (type == TYPE_APP_SHORTCUT && delegate_->IsAppPinned(app_id)) ?
REMOVABLE : DRAGGABLE;
Shell::GetInstance()->UpdateShelfVisibility();
}
-void ShelfView::UpdateFirstButtonPadding() {
- if (ash::switches::UseAlternateShelfLayout())
- return;
-
- // Creates an empty border for first shelf button to make included leading
- // inset act as the button's padding. This is only needed on button creation
- // and when shelf alignment changes.
- if (view_model_->view_size() > 0) {
- view_model_->view_at(0)->SetBorder(views::Border::CreateEmptyBorder(
- layout_manager_->PrimaryAxisValue(0, leading_inset_),
- layout_manager_->PrimaryAxisValue(leading_inset_, 0),
- 0,
- 0));
- }
-}
-
void ShelfView::OnFadeOutAnimationEnded() {
AnimateToIdealBounds();
StartFadeInLastVisibleItem();
overflow_view->last_visible_index_ = last_overflow_index;
}
-int ShelfView::GetButtonSize() const {
- return ash::switches::UseAlternateShelfLayout() ?
- kButtonSize : kShelfPreferredSize;
-}
-
-int ShelfView::GetButtonSpacing() const {
- return ash::switches::UseAlternateShelfLayout() ?
- kAlternateButtonSpacing : kButtonSpacing;
-}
-
bool ShelfView::ShouldHideTooltip(const gfx::Point& cursor_location) {
gfx::Rect active_bounds;
owner_overflow_bubble_->bubble_view()->GetBubbleBounds();
preferred_size = bubble_bounds.size();
} else {
- const int preferred_shelf_size = layout_manager_->GetPreferredShelfSize();
-
const int last_button_index = view_model_->view_size() - 1;
gfx::Rect last_button_bounds =
view_model_->view_at(last_button_index)->bounds();
if (layout_manager_->IsHorizontalAlignment()) {
preferred_size = gfx::Size(last_button_bounds.right() + leading_inset_,
- preferred_shelf_size);
+ kShelfSize);
} else {
- preferred_size = gfx::Size(preferred_shelf_size,
+ preferred_size = gfx::Size(kShelfSize,
last_button_bounds.bottom() + leading_inset_);
}
}
IdealBounds ideal_bounds;
CalculateIdealBounds(&ideal_bounds);
- const int preferred_size = layout_manager_->GetPreferredShelfSize();
-
int last_button_index = is_overflow_mode() ?
last_visible_index_ : view_model_->view_size() - 1;
const gfx::Rect last_button_bounds =
last_button_index >= first_visible_index_ ?
view_model_->ideal_bounds(last_button_index) :
- gfx::Rect(gfx::Size(preferred_size, preferred_size));
+ gfx::Rect(gfx::Size(kShelfSize, kShelfSize));
if (layout_manager_->IsHorizontalAlignment()) {
- return gfx::Size(last_button_bounds.right() + leading_inset_,
- preferred_size);
+ return gfx::Size(last_button_bounds.right() + leading_inset_, kShelfSize);
}
- return gfx::Size(preferred_size,
+ return gfx::Size(kShelfSize,
last_button_bounds.bottom() + leading_inset_);
}
void ShelfView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
+ // This bounds change is produced by the shelf movement and all content has
+ // to follow. Using an animation at that time would produce a time lag since
+ // the animation of the BoundsAnimator has itself a delay before it arrives
+ // at the required location. As such we tell the animator to go there
+ // immediately.
+ BoundsAnimatorDisabler disabler(bounds_animator_.get());
LayoutToIdealBounds();
FOR_EACH_OBSERVER(ShelfIconObserver, observers_,
OnShelfIconPositionsChanged());
return this;
}
-void ShelfView::GetAccessibleState(ui::AccessibleViewState* state) {
- state->role = ui::AccessibilityTypes::ROLE_TOOLBAR;
+void ShelfView::GetAccessibleState(ui::AXViewState* state) {
+ state->role = ui::AX_ROLE_TOOLBAR;
state->name = l10n_util::GetStringUTF16(IDS_ASH_SHELF_ACCESSIBLE_NAME);
}
}
}
-void ShelfView::ShelfItemRemoved(int model_index, LauncherID id) {
+void ShelfView::ShelfItemRemoved(int model_index, ShelfID id) {
if (id == context_menu_id_)
launcher_menu_runner_.reset();
{
tooltip_->Close();
}
-void ShelfView::ShelfItemChanged(int model_index,
- const LauncherItem& old_item) {
- const LauncherItem& item(model_->items()[model_index]);
+void ShelfView::ShelfItemChanged(int model_index, const ShelfItem& old_item) {
+ const ShelfItem& item(model_->items()[model_index]);
if (old_item.type != item.type) {
// Type changed, swap the views.
model_index = CancelDrag(model_index);
}
void ShelfView::ShelfStatusChanged() {
- if (ash::switches::UseAlternateShelfLayout())
- return;
- AppListButton* app_list_button =
- static_cast<AppListButton*>(GetAppListButtonView());
- if (model_->status() == ShelfModel::STATUS_LOADING)
- app_list_button->StartLoadingAnimation();
- else
- app_list_button->StopLoadingAnimation();
+ // Nothing to do here.
}
void ShelfView::PointerPressedOnButton(views::View* view,
}
}
-bool ShelfView::ShowListMenuForView(const LauncherItem& item,
+bool ShelfView::ShowListMenuForView(const ShelfItem& item,
views::View* source,
const ui::Event& event) {
scoped_ptr<ShelfMenuModel> menu_model;
if (!menu_model)
return;
- base::AutoReset<LauncherID> reseter(
+ base::AutoReset<ShelfID> reseter(
&context_menu_id_,
view_index == -1 ? 0 : model_->items()[view_index].id);
source->GetWidget()->GetNativeView()->GetRootWindow());
// Determine the menu alignment dependent on the shelf.
- views::MenuItemView::AnchorPosition menu_alignment =
- views::MenuItemView::TOPLEFT;
+ views::MenuAnchorPosition menu_alignment = views::MENU_ANCHOR_TOPLEFT;
gfx::Rect anchor_point = gfx::Rect(click_point, gfx::Size());
ShelfWidget* shelf = RootWindowController::ForShelf(
switch (align) {
case SHELF_ALIGNMENT_BOTTOM:
- menu_alignment = views::MenuItemView::BUBBLE_ABOVE;
+ menu_alignment = views::MENU_ANCHOR_BUBBLE_ABOVE;
break;
case SHELF_ALIGNMENT_LEFT:
- menu_alignment = views::MenuItemView::BUBBLE_RIGHT;
+ menu_alignment = views::MENU_ANCHOR_BUBBLE_RIGHT;
break;
case SHELF_ALIGNMENT_RIGHT:
- menu_alignment = views::MenuItemView::BUBBLE_LEFT;
+ menu_alignment = views::MENU_ANCHOR_BUBBLE_LEFT;
break;
case SHELF_ALIGNMENT_TOP:
- menu_alignment = views::MenuItemView::BUBBLE_BELOW;
+ menu_alignment = views::MENU_ANCHOR_BUBBLE_BELOW;
break;
}
}
return (delta.InMilliseconds() < 0 || delta.InMilliseconds() > 130);
}
-const LauncherItem* ShelfView::LauncherItemForView(
- const views::View* view) const {
+const ShelfItem* ShelfView::ShelfItemForView(const views::View* view) const {
int view_index = view_model_->GetIndexOfView(view);
if (view_index == -1)
return NULL;
if (view == GetAppListButtonView() &&
Shell::GetInstance()->GetAppListWindow())
return false;
- const LauncherItem* item = LauncherItemForView(view);
+ const ShelfItem* item = ShelfItemForView(view);
if (!item)
return true;
ShelfItemDelegate* item_delegate =
return distance > 0 ? distance : 0;
}
-} // namespace internal
} // namespace ash