summaryrefslogtreecommitdiffstats
path: root/ash/shelf
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-19 04:19:38 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-19 04:19:38 +0000
commit864b5855c27945ea0f099bf82d44f41a041851ff (patch)
tree8f3737b10405128113a113f373f4472727f149de /ash/shelf
parent7a22adbf507b6f35788ea89f12bbd2c1b96d451b (diff)
downloadchromium_src-864b5855c27945ea0f099bf82d44f41a041851ff.zip
chromium_src-864b5855c27945ea0f099bf82d44f41a041851ff.tar.gz
chromium_src-864b5855c27945ea0f099bf82d44f41a041851ff.tar.bz2
Rename Launcher to Shelf.
- move launcher* from launcher to shelf. - rename to launcher.* to shelf.* and launcher_unittest.cc to shelf_unittest.cc - rename LauncherTestAPI to ShelfTestAPI. - rename to launcher_test_api.* to shelf_test_api.* BUG=248353 TEST=None, no functional changes R=jamescook@chromium.org,harrym@chromium.org TBR=sky Review URL: https://codereview.chromium.org/115113006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241794 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shelf')
-rw-r--r--ash/shelf/overflow_bubble.cc4
-rw-r--r--ash/shelf/overflow_bubble_view.cc23
-rw-r--r--ash/shelf/overflow_bubble_view.h2
-rw-r--r--ash/shelf/overflow_button.cc8
-rw-r--r--ash/shelf/shelf.cc198
-rw-r--r--ash/shelf/shelf.h131
-rw-r--r--ash/shelf/shelf_alignment_menu.cc2
-rw-r--r--ash/shelf/shelf_delegate.h22
-rw-r--r--ash/shelf/shelf_layout_manager.cc40
-rw-r--r--ash/shelf/shelf_layout_manager.h34
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc65
-rw-r--r--ash/shelf/shelf_navigator_unittest.cc2
-rw-r--r--ash/shelf/shelf_tooltip_manager_unittest.cc4
-rw-r--r--ash/shelf/shelf_unittest.cc165
-rw-r--r--ash/shelf/shelf_util.cc6
-rw-r--r--ash/shelf/shelf_util.h6
-rw-r--r--ash/shelf/shelf_view.cc36
-rw-r--r--ash/shelf/shelf_view_unittest.cc111
-rw-r--r--ash/shelf/shelf_widget.cc130
-rw-r--r--ash/shelf/shelf_widget.h18
-rw-r--r--ash/shelf/shelf_widget_unittest.cc48
-rw-r--r--ash/shelf/shelf_window_watcher.cc6
-rw-r--r--ash/shelf/shelf_window_watcher_unittest.cc24
23 files changed, 795 insertions, 290 deletions
diff --git a/ash/shelf/overflow_bubble.cc b/ash/shelf/overflow_bubble.cc
index 35c885f..05106ec 100644
--- a/ash/shelf/overflow_bubble.cc
+++ b/ash/shelf/overflow_bubble.cc
@@ -96,8 +96,8 @@ void OverflowBubble::OnWidgetDestroying(views::Widget* widget) {
bubble_ = NULL;
anchor_ = NULL;
shelf_view_ = NULL;
- ShelfLayoutManager::ForLauncher(
- widget->GetNativeView())->shelf_widget()->launcher()->SchedulePaint();
+ ShelfLayoutManager::ForShelf(
+ widget->GetNativeView())->shelf_widget()->shelf()->SchedulePaint();
}
} // namespace internal
diff --git a/ash/shelf/overflow_bubble_view.cc b/ash/shelf/overflow_bubble_view.cc
index 67b483d..d878b08 100644
--- a/ash/shelf/overflow_bubble_view.cc
+++ b/ash/shelf/overflow_bubble_view.cc
@@ -42,8 +42,8 @@ OverflowBubbleView::~OverflowBubbleView() {
void OverflowBubbleView::InitOverflowBubble(views::View* anchor,
ShelfView* shelf_view) {
- // set_anchor_view needs to be called before GetShelfLayoutManagerForLauncher
- // can be called.
+ // set_anchor_view needs to be called before GetShelfLayoutManager() can be
+ // called.
SetAnchorView(anchor);
set_arrow(GetBubbleArrow());
set_background(NULL);
@@ -69,10 +69,9 @@ void OverflowBubbleView::InitOverflowBubble(views::View* anchor,
}
bool OverflowBubbleView::IsHorizontalAlignment() const {
- ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManagerForLauncher();
- return shelf_layout_manager ?
- shelf_layout_manager->IsHorizontalAlignment() :
- false;
+ ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager();
+ return shelf_layout_manager ? shelf_layout_manager->IsHorizontalAlignment()
+ : false;
}
const gfx::Size OverflowBubbleView::GetContentsSize() const {
@@ -81,7 +80,7 @@ const gfx::Size OverflowBubbleView::GetContentsSize() const {
// Gets arrow location based on shelf alignment.
views::BubbleBorder::Arrow OverflowBubbleView::GetBubbleArrow() const {
- ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManagerForLauncher();
+ ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager();
return shelf_layout_manager ?
shelf_layout_manager->SelectValueForShelfAlignment(
views::BubbleBorder::BOTTOM_LEFT,
@@ -165,12 +164,10 @@ bool OverflowBubbleView::OnMouseWheel(const ui::MouseWheelEvent& event) {
return true;
}
-ShelfLayoutManager*
-OverflowBubbleView::GetShelfLayoutManagerForLauncher() const {
- return GetAnchorView() ?
- ShelfLayoutManager::ForLauncher(
- GetAnchorView()->GetWidget()->GetNativeView()) :
- NULL;
+ShelfLayoutManager* OverflowBubbleView::GetShelfLayoutManager() const {
+ return GetAnchorView() ? ShelfLayoutManager::ForShelf(
+ GetAnchorView()->GetWidget()->GetNativeView())
+ : NULL;
}
void OverflowBubbleView::OnScrollEvent(ui::ScrollEvent* event) {
diff --git a/ash/shelf/overflow_bubble_view.h b/ash/shelf/overflow_bubble_view.h
index f5bfdc1..e8533c1 100644
--- a/ash/shelf/overflow_bubble_view.h
+++ b/ash/shelf/overflow_bubble_view.h
@@ -55,7 +55,7 @@ class ASH_EXPORT OverflowBubbleView : public views::BubbleDelegateView {
// ui::EventHandler overrides:
virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- ShelfLayoutManager* GetShelfLayoutManagerForLauncher() const;
+ ShelfLayoutManager* GetShelfLayoutManager() const;
ShelfView* shelf_view_; // Owned by views hierarchy.
gfx::Vector2d scroll_offset_;
diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc
index 66d5476..3c899ef 100644
--- a/ash/shelf/overflow_button.cc
+++ b/ash/shelf/overflow_button.cc
@@ -57,7 +57,7 @@ void OverflowButton::PaintBackground(gfx::Canvas* canvas, int alpha) {
gfx::Rect bounds(GetContentsBounds());
gfx::Rect rect(0, 0, kButtonHoverSize, kButtonHoverSize);
ShelfLayoutManager* shelf =
- ShelfLayoutManager::ForLauncher(GetWidget()->GetNativeView());
+ ShelfLayoutManager::ForShelf(GetWidget()->GetNativeView());
// Nudge the background a little to line up right.
if (shelf->IsHorizontalAlignment()) {
@@ -85,15 +85,15 @@ void OverflowButton::PaintBackground(gfx::Canvas* canvas, int alpha) {
}
void OverflowButton::OnPaint(gfx::Canvas* canvas) {
- ShelfLayoutManager* layout_manager = ShelfLayoutManager::ForLauncher(
- GetWidget()->GetNativeView());
+ ShelfLayoutManager* layout_manager =
+ ShelfLayoutManager::ForShelf(GetWidget()->GetNativeView());
ShelfAlignment alignment = layout_manager->GetAlignment();
gfx::Rect bounds(GetContentsBounds());
if (ash::switches::UseAlternateShelfLayout()) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
int background_image_id = 0;
- if (layout_manager->shelf_widget()->launcher()->IsShowingOverflowBubble())
+ if (layout_manager->shelf_widget()->shelf()->IsShowingOverflowBubble())
background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED;
else if(layout_manager->shelf_widget()->GetDimsShelf())
background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK;
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc
new file mode 100644
index 0000000..e016875
--- /dev/null
+++ b/ash/shelf/shelf.cc
@@ -0,0 +1,198 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/shelf/shelf.h"
+
+#include <algorithm>
+#include <cmath>
+
+#include "ash/focus_cycler.h"
+#include "ash/root_window_controller.h"
+#include "ash/screen_ash.h"
+#include "ash/shelf/shelf_delegate.h"
+#include "ash/shelf/shelf_item_delegate.h"
+#include "ash/shelf/shelf_item_delegate_manager.h"
+#include "ash/shelf/shelf_layout_manager.h"
+#include "ash/shelf/shelf_model.h"
+#include "ash/shelf/shelf_navigator.h"
+#include "ash/shelf/shelf_util.h"
+#include "ash/shelf/shelf_view.h"
+#include "ash/shelf/shelf_widget.h"
+#include "ash/shell.h"
+#include "ash/shell_delegate.h"
+#include "ash/shell_window_ids.h"
+#include "ash/wm/window_properties.h"
+#include "grit/ash_resources.h"
+#include "ui/aura/client/activation_client.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_observer.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/compositor/layer.h"
+#include "ui/gfx/canvas.h"
+#include "ui/gfx/image/image.h"
+#include "ui/gfx/image/image_skia_operations.h"
+#include "ui/gfx/skbitmap_operations.h"
+#include "ui/views/accessible_pane_view.h"
+#include "ui/views/widget/widget.h"
+#include "ui/views/widget/widget_delegate.h"
+
+namespace ash {
+
+const char Shelf::kNativeViewName[] = "ShelfView";
+
+Shelf::Shelf(ShelfModel* shelf_model,
+ ShelfDelegate* shelf_delegate,
+ ShelfWidget* shelf_widget)
+ : shelf_view_(NULL),
+ alignment_(shelf_widget->GetAlignment()),
+ delegate_(shelf_delegate),
+ shelf_widget_(shelf_widget) {
+ shelf_view_ = new internal::ShelfView(
+ shelf_model, delegate_, shelf_widget_->shelf_layout_manager());
+ shelf_view_->Init();
+ shelf_widget_->GetContentsView()->AddChildView(shelf_view_);
+ shelf_widget_->GetNativeView()->SetName(kNativeViewName);
+ delegate_->OnShelfCreated(this);
+}
+
+Shelf::~Shelf() {
+ delegate_->OnShelfDestroyed(this);
+}
+
+// static
+Shelf* Shelf::ForPrimaryDisplay() {
+ ShelfWidget* shelf_widget = internal::RootWindowController::ForShelf(
+ Shell::GetPrimaryRootWindow())->shelf();
+ return shelf_widget ? shelf_widget->shelf() : NULL;
+}
+
+// static
+Shelf* Shelf::ForWindow(aura::Window* window) {
+ ShelfWidget* shelf_widget =
+ internal::RootWindowController::ForShelf(window)->shelf();
+ return shelf_widget ? shelf_widget->shelf() : NULL;
+}
+
+void Shelf::SetAlignment(ShelfAlignment alignment) {
+ alignment_ = alignment;
+ shelf_view_->OnShelfAlignmentChanged();
+ // ShelfLayoutManager will resize the shelf.
+}
+
+gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(aura::Window* window) {
+ LauncherID id = GetLauncherIDForWindow(window);
+ gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id));
+ gfx::Point screen_origin;
+ views::View::ConvertPointToScreen(shelf_view_, &screen_origin);
+ return gfx::Rect(screen_origin.x() + bounds.x(),
+ screen_origin.y() + bounds.y(),
+ bounds.width(),
+ bounds.height());
+}
+
+void Shelf::UpdateIconPositionForWindow(aura::Window* window) {
+ shelf_view_->UpdatePanelIconPosition(
+ GetLauncherIDForWindow(window),
+ ScreenAsh::ConvertRectFromScreen(
+ shelf_widget()->GetNativeView(),
+ window->GetBoundsInScreen()).CenterPoint());
+}
+
+void Shelf::ActivateShelfItem(int index) {
+ // We pass in a keyboard event which will then trigger a switch to the
+ // next item if the current one is already active.
+ ui::KeyEvent event(ui::ET_KEY_RELEASED,
+ ui::VKEY_UNKNOWN, // The actual key gets ignored.
+ ui::EF_NONE,
+ false);
+
+ const LauncherItem& item = shelf_view_->model()->items()[index];
+ ShelfItemDelegate* item_delegate =
+ Shell::GetInstance()->shelf_item_delegate_manager()->GetShelfItemDelegate(
+ item.id);
+ item_delegate->ItemSelected(event);
+}
+
+void Shelf::CycleWindowLinear(CycleDirection direction) {
+ int item_index = GetNextActivatedItemIndex(
+ *(shelf_view_->model()), direction);
+ if (item_index >= 0)
+ ActivateShelfItem(item_index);
+}
+
+void Shelf::AddIconObserver(ShelfIconObserver* observer) {
+ shelf_view_->AddIconObserver(observer);
+}
+
+void Shelf::RemoveIconObserver(ShelfIconObserver* observer) {
+ shelf_view_->RemoveIconObserver(observer);
+}
+
+bool Shelf::IsShowingMenu() const {
+ return shelf_view_->IsShowingMenu();
+}
+
+bool Shelf::IsShowingOverflowBubble() const {
+ return shelf_view_->IsShowingOverflowBubble();
+}
+
+void Shelf::SetVisible(bool visible) const {
+ shelf_view_->SetVisible(visible);
+}
+
+bool Shelf::IsVisible() const {
+ return shelf_view_->visible();
+}
+
+void Shelf::SchedulePaint() {
+ shelf_view_->SchedulePaintForAllButtons();
+}
+
+views::View* Shelf::GetAppListButtonView() const {
+ return shelf_view_->GetAppListButtonView();
+}
+
+void Shelf::LaunchAppIndexAt(int item_index) {
+ ShelfModel* shelf_model = shelf_view_->model();
+ const LauncherItems& items = shelf_model->items();
+ int item_count = shelf_model->item_count();
+ int indexes_left = item_index >= 0 ? item_index : item_count;
+ int found_index = -1;
+
+ // Iterating until we have hit the index we are interested in which
+ // is true once indexes_left becomes negative.
+ for (int i = 0; i < item_count && indexes_left >= 0; i++) {
+ if (items[i].type != TYPE_APP_LIST) {
+ found_index = i;
+ indexes_left--;
+ }
+ }
+
+ // There are two ways how found_index can be valid: a.) the nth item was
+ // found (which is true when indexes_left is -1) or b.) the last item was
+ // requested (which is true when index was passed in as a negative number).
+ if (found_index >= 0 && (indexes_left == -1 || item_index < 0)) {
+ // Then set this one as active (or advance to the next item of its kind).
+ ActivateShelfItem(found_index);
+ }
+}
+
+void Shelf::SetShelfViewBounds(gfx::Rect bounds) {
+ shelf_view_->SetBoundsRect(bounds);
+}
+
+gfx::Rect Shelf::GetShelfViewBounds() const {
+ return shelf_view_->bounds();
+}
+
+gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const {
+ return shelf_view_->GetVisibleItemsBoundsInScreen();
+}
+
+app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() {
+ return shelf_view_;
+}
+
+} // namespace ash
diff --git a/ash/shelf/shelf.h b/ash/shelf/shelf.h
new file mode 100644
index 0000000..00cb127
--- /dev/null
+++ b/ash/shelf/shelf.h
@@ -0,0 +1,131 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_SHELF_SHELF_H_
+#define ASH_SHELF_SHELF_H_
+
+#include "ash/ash_export.h"
+#include "ash/launcher/launcher_types.h"
+#include "ash/shelf/shelf_types.h"
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/gfx/size.h"
+#include "ui/views/widget/widget_observer.h"
+
+namespace app_list {
+class ApplicationDragAndDropHost;
+}
+
+namespace aura {
+class Window;
+}
+
+namespace gfx {
+class Rect;
+}
+
+namespace views {
+class View;
+}
+
+namespace ash {
+
+namespace internal {
+class FocusCycler;
+class ShelfLayoutManager;
+class ShelfView;
+}
+
+namespace test {
+class ShelfTestAPI;
+}
+
+class ShelfDelegate;
+class ShelfIconObserver;
+class ShelfModel;
+class ShelfWidget;
+
+class ASH_EXPORT Shelf {
+ public:
+ static const char kNativeViewName[];
+
+ Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget);
+ virtual ~Shelf();
+
+ // Return the shelf for the primary display. NULL if no user is logged in yet.
+ static Shelf* ForPrimaryDisplay();
+
+ // Return the shelf for the display that |window| is currently on, or a shelf
+ // on primary display if the shelf per display feature is disabled. NULL if
+ // no user is logged in yet.
+ static Shelf* ForWindow(aura::Window* window);
+
+ void SetAlignment(ShelfAlignment alignment);
+ ShelfAlignment alignment() const { return alignment_; }
+
+ // Returns the screen bounds of the item for the specified window. If there is
+ // no item for the specified window an empty rect is returned.
+ gfx::Rect GetScreenBoundsOfItemIconForWindow(aura::Window* window);
+
+ // Updates the icon position given the current window bounds. This is used
+ // when dragging panels to reposition them with respect to the other panels.
+ void UpdateIconPositionForWindow(aura::Window* window);
+
+ // Activates the the shelf item specified by the index in the list of shelf
+ // items.
+ void ActivateShelfItem(int index);
+
+ // Cycles the window focus linearly over the current shelf items.
+ void CycleWindowLinear(CycleDirection direction);
+
+ void AddIconObserver(ShelfIconObserver* observer);
+ void RemoveIconObserver(ShelfIconObserver* observer);
+
+ // Returns true if the shelf is showing a context menu.
+ bool IsShowingMenu() const;
+
+ bool IsShowingOverflowBubble() const;
+
+ void SetVisible(bool visible) const;
+ bool IsVisible() const;
+
+ void SchedulePaint();
+
+ views::View* GetAppListButtonView() const;
+
+ // Launch a 0-indexed shelf item in the shelf.
+ // A negative index launches the last shelf item in the shelf.
+ void LaunchAppIndexAt(int item_index);
+
+ ShelfWidget* shelf_widget() { return shelf_widget_; }
+
+ // Set the bounds of the shelf view.
+ void SetShelfViewBounds(gfx::Rect bounds);
+ gfx::Rect GetShelfViewBounds() const;
+
+ // Returns rectangle bounding all visible shelf items. Used screen coordinate
+ // system.
+ gfx::Rect GetVisibleItemsBoundsInScreen() const;
+
+ // Returns ApplicationDragAndDropHost for this shelf.
+ app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList();
+
+ private:
+ friend class test::ShelfTestAPI;
+
+ // ShelfView used to display icons.
+ internal::ShelfView* shelf_view_;
+
+ ShelfAlignment alignment_;
+
+ ShelfDelegate* delegate_;
+
+ ShelfWidget* shelf_widget_;
+
+ DISALLOW_COPY_AND_ASSIGN(Shelf);
+};
+
+} // namespace ash
+
+#endif // ASH_SHELF_SHELF_H_
diff --git a/ash/shelf/shelf_alignment_menu.cc b/ash/shelf/shelf_alignment_menu.cc
index 3f77da1..84fe792 100644
--- a/ash/shelf/shelf_alignment_menu.cc
+++ b/ash/shelf/shelf_alignment_menu.cc
@@ -34,7 +34,7 @@ ShelfAlignmentMenu::ShelfAlignmentMenu(aura::Window* root)
ShelfAlignmentMenu::~ShelfAlignmentMenu() {}
bool ShelfAlignmentMenu::IsCommandIdChecked(int command_id) const {
- return internal::ShelfLayoutManager::ForLauncher(root_window_)->
+ return internal::ShelfLayoutManager::ForShelf(root_window_)->
SelectValueForShelfAlignment(
MENU_ALIGN_BOTTOM == command_id,
MENU_ALIGN_LEFT == command_id,
diff --git a/ash/shelf/shelf_delegate.h b/ash/shelf/shelf_delegate.h
index e168c47..03c2beb 100644
--- a/ash/shelf/shelf_delegate.h
+++ b/ash/shelf/shelf_delegate.h
@@ -9,34 +9,34 @@
#include "ash/launcher/launcher_types.h"
namespace ash {
-class Launcher;
+class Shelf;
-// Delegate for the Launcher.
+// Delegate for the Shelf.
class ASH_EXPORT ShelfDelegate {
public:
- // Launcher owns the delegate.
+ // Shelf owns the delegate.
virtual ~ShelfDelegate() {}
// Callback used to allow delegate to perform initialization actions that
- // depend on the Launcher being in a known state.
- virtual void OnLauncherCreated(Launcher* launcher) = 0;
+ // depend on the Shelf being in a known state.
+ virtual void OnShelfCreated(Shelf* shelf) = 0;
- // Callback used to inform the delegate that a specific launcher no longer
+ // Callback used to inform the delegate that a specific shelf no longer
// exists.
- virtual void OnLauncherDestroyed(Launcher* launcher) = 0;
+ virtual void OnShelfDestroyed(Shelf* shelf) = 0;
- // Get the launcher ID from an application ID.
+ // Get the shelf ID from an application ID.
virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) = 0;
// Get the application ID for a given launcher ID.
virtual const std::string& GetAppIDForLauncherID(LauncherID id) = 0;
- // Pins an app with |app_id| to launcher. A running instance will get pinned.
- // In case there is no running instance a new launcher item is created and
+ // Pins an app with |app_id| to shelf. A running instance will get pinned.
+ // In case there is no running instance a new shelf item is created and
// pinned.
virtual void PinAppWithID(const std::string& app_id) = 0;
- // Check if the app with |app_id_| is pinned to the launcher.
+ // Check if the app with |app_id_| is pinned to the shelf.
virtual bool IsAppPinned(const std::string& app_id) = 0;
// Checks whether the user is allowed to pin/unpin apps. Pinning may be
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 999bd32..28ce634 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -11,11 +11,11 @@
#include <vector>
#include "ash/ash_switches.h"
-#include "ash/launcher/launcher.h"
#include "ash/launcher/launcher_types.h"
#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/session_state_delegate.h"
+#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_bezel_event_filter.h"
#include "ash/shelf/shelf_layout_manager_observer.h"
#include "ash/shelf/shelf_widget.h"
@@ -53,7 +53,7 @@ namespace internal {
namespace {
-// Delay before showing the launcher. This is after the mouse stops moving.
+// Delay before showing the shelf. This is after the mouse stops moving.
const int kAutoHideDelayMS = 200;
// To avoid hiding the shelf when the mouse transitions from a message bubble
@@ -286,15 +286,15 @@ void ShelfLayoutManager::LayoutShelf() {
CalculateTargetBounds(state_, &target_bounds);
UpdateBoundsAndOpacity(target_bounds, false, NULL);
- if (shelf_->launcher()) {
+ if (shelf_->shelf()) {
// This is not part of UpdateBoundsAndOpacity() because
// SetShelfViewBounds() sets the bounds immediately and does not animate.
// The height of the ShelfView for a horizontal shelf and the width of
// the ShelfView for a vertical shelf are set when |shelf_|'s bounds
// are changed via UpdateBoundsAndOpacity(). This sets the origin and the
// dimension in the other direction.
- shelf_->launcher()->SetShelfViewBounds(
- target_bounds.launcher_bounds_in_shelf);
+ shelf_->shelf()->SetShelfViewBounds(
+ target_bounds.shelf_bounds_in_shelf);
}
}
@@ -544,8 +544,8 @@ bool ShelfLayoutManager::IsHorizontalAlignment() const {
}
// static
-ShelfLayoutManager* ShelfLayoutManager::ForLauncher(aura::Window* window) {
- ShelfWidget* shelf = RootWindowController::ForLauncher(window)->shelf();
+ShelfLayoutManager* ShelfLayoutManager::ForShelf(aura::Window* window) {
+ ShelfWidget* shelf = RootWindowController::ForShelf(window)->shelf();
return shelf ? shelf->shelf_layout_manager() : NULL;
}
@@ -581,7 +581,7 @@ void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) {
if (state.visibility_state == SHELF_AUTO_HIDE) {
// When state is SHELF_AUTO_HIDE we need to track when the mouse is over the
- // launcher to unhide the shelf. AutoHideEventFilter does that for us.
+ // shelf to unhide it. AutoHideEventFilter does that for us.
if (!auto_hide_event_filter_)
auto_hide_event_filter_.reset(new AutoHideEventFilter(this));
} else {
@@ -650,15 +650,15 @@ void ShelfLayoutManager::UpdateBoundsAndOpacity(
ui::ImplicitAnimationObserver* observer) {
base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true);
- ui::ScopedLayerAnimationSettings launcher_animation_setter(
+ ui::ScopedLayerAnimationSettings shelf_animation_setter(
GetLayer(shelf_)->GetAnimator());
ui::ScopedLayerAnimationSettings status_animation_setter(
GetLayer(shelf_->status_area_widget())->GetAnimator());
if (animate) {
- launcher_animation_setter.SetTransitionDuration(
+ shelf_animation_setter.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS));
- launcher_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
- launcher_animation_setter.SetPreemptionStrategy(
+ shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
+ shelf_animation_setter.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
status_animation_setter.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS));
@@ -667,7 +667,7 @@ void ShelfLayoutManager::UpdateBoundsAndOpacity(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
} else {
StopAnimating();
- launcher_animation_setter.SetTransitionDuration(base::TimeDelta());
+ shelf_animation_setter.SetTransitionDuration(base::TimeDelta());
status_animation_setter.SetTransitionDuration(base::TimeDelta());
}
if (observer)
@@ -822,7 +822,7 @@ void ShelfLayoutManager::CalculateTargetBounds(
// This needs to happen after calling UpdateTargetBoundsForGesture(), because
// that can change the size of the shelf.
- target_bounds->launcher_bounds_in_shelf = SelectValueForShelfAlignment(
+ target_bounds->shelf_bounds_in_shelf = SelectValueForShelfAlignment(
gfx::Rect(0, 0,
shelf_width - status_size.width(),
target_bounds->shelf_bounds_in_root.height()),
@@ -871,7 +871,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
}
if (horizontal) {
- // Move and size the launcher with the gesture.
+ // Move and size the shelf with the gesture.
int shelf_height = target_bounds->shelf_bounds_in_root.height() - translate;
shelf_height = std::max(shelf_height, kAutoHideSize);
target_bounds->shelf_bounds_in_root.set_height(shelf_height);
@@ -891,7 +891,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
target_bounds->status_bounds_in_shelf.set_y(status_y.y());
}
} else {
- // Move and size the launcher with the gesture.
+ // Move and size the shelf with the gesture.
int shelf_width = target_bounds->shelf_bounds_in_root.width();
bool right_aligned = GetAlignment() == SHELF_ALIGNMENT_RIGHT;
if (right_aligned)
@@ -988,13 +988,13 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
return SHELF_AUTO_HIDE_SHOWN;
if (shelf_->status_area_widget() &&
- shelf_->status_area_widget()->ShouldShowLauncher())
+ shelf_->status_area_widget()->ShouldShowShelf())
return SHELF_AUTO_HIDE_SHOWN;
- if (shelf_->launcher() && shelf_->launcher()->IsShowingMenu())
+ if (shelf_->shelf() && shelf_->shelf()->IsShowingMenu())
return SHELF_AUTO_HIDE_SHOWN;
- if (shelf_->launcher() && shelf_->launcher()->IsShowingOverflowBubble())
+ if (shelf_->shelf() && shelf_->shelf()->IsShowingOverflowBubble())
return SHELF_AUTO_HIDE_SHOWN;
if (shelf_->IsActive() || shelf_->status_area_widget()->IsActive())
@@ -1078,7 +1078,7 @@ void ShelfLayoutManager::UpdateHitTestBounds() {
gfx::Insets mouse_insets;
gfx::Insets touch_insets;
if (state_.visibility_state == SHELF_VISIBLE) {
- // Let clicks at the very top of the launcher through so windows can be
+ // Let clicks at the very top of the shelf through so windows can be
// resized with the bottom-right corner and bottom edge.
mouse_insets = GetInsetsForAlignment(kWorkspaceAreaVisibleInset);
} else if (state_.visibility_state == SHELF_AUTO_HIDE) {
diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h
index 5d0496b..ee9091b 100644
--- a/ash/shelf/shelf_layout_manager.h
+++ b/ash/shelf/shelf_layout_manager.h
@@ -8,8 +8,8 @@
#include <vector>
#include "ash/ash_export.h"
-#include "ash/launcher/launcher.h"
#include "ash/shelf/background_animator.h"
+#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_types.h"
#include "ash/shell_observer.h"
#include "ash/system/status_area_widget.h"
@@ -51,9 +51,9 @@ class ShelfLayoutManagerTest;
class StatusAreaWidget;
class WorkspaceController;
-// ShelfLayoutManager is the layout manager responsible for the launcher and
-// status widgets. The launcher is given the total available width and told the
-// width of the status area. This allows the launcher to draw the background and
+// ShelfLayoutManager is the layout manager responsible for the shelf and
+// status widgets. The shelf is given the total available width and told the
+// width of the status area. This allows the shelf to draw the background and
// layout to the status area.
// To respond to bounds changes in the status area StatusAreaLayoutManager works
// closely with ShelfLayoutManager.
@@ -82,7 +82,7 @@ class ASH_EXPORT ShelfLayoutManager :
static const int kShelfSize;
// Inset between the inner edge of the shelf (towards centre of screen), and
- // the launcher items, notifications, status area etc.
+ // the shelf items, notifications, status area etc.
static const int kShelfItemInset;
// Returns the preferred size for the shelf (either kLauncherPreferredSize or
@@ -115,7 +115,7 @@ class ASH_EXPORT ShelfLayoutManager :
// Clears internal data for shutdown process.
void PrepareForShutdown();
- // Returns whether the shelf and its contents (launcher, status) are visible
+ // Returns whether the shelf and its contents (shelf, status) are visible
// on the screen.
bool IsVisible() const;
@@ -125,7 +125,7 @@ class ASH_EXPORT ShelfLayoutManager :
// Returns the docked area bounds.
const gfx::Rect& dock_bounds() const { return dock_bounds_; }
- // Stops any animations and sets the bounds of the launcher and status
+ // Stops any animations and sets the bounds of the shelf and status
// widgets.
void LayoutShelf();
@@ -136,7 +136,7 @@ class ASH_EXPORT ShelfLayoutManager :
// Updates the visibility state.
void UpdateVisibilityState();
- // Invoked by the shelf/launcher when the auto-hide state may have changed.
+ // Invoked by the shelf when the auto-hide state may have changed.
void UpdateAutoHideState();
ShelfVisibilityState visibility_state() const {
@@ -215,9 +215,9 @@ class ASH_EXPORT ShelfLayoutManager :
// Is the shelf's alignment horizontal?
bool IsHorizontalAlignment() const;
- // Returns a ShelfLayoutManager on the display which has a launcher for
- // given |window|. See RootWindowController::ForLauncher for more info.
- static ShelfLayoutManager* ForLauncher(aura::Window* window);
+ // Returns a ShelfLayoutManager on the display which has a shelf for
+ // given |window|. See RootWindowController::ForShelf for more info.
+ static ShelfLayoutManager* ForShelf(aura::Window* window);
private:
class AutoHideEventFilter;
@@ -234,7 +234,7 @@ class ASH_EXPORT ShelfLayoutManager :
float opacity;
float status_opacity;
gfx::Rect shelf_bounds_in_root;
- gfx::Rect launcher_bounds_in_shelf;
+ gfx::Rect shelf_bounds_in_shelf;
gfx::Rect status_bounds_in_shelf;
gfx::Insets work_area_insets;
};
@@ -266,7 +266,7 @@ class ASH_EXPORT ShelfLayoutManager :
// Sets the visibility of the shelf to |state|.
void SetState(ShelfVisibilityState visibility_state);
- // Updates the bounds and opacity of the launcher and status widgets.
+ // Updates the bounds and opacity of the shelf and status widgets.
// If |observer| is specified, it will be called back when the animations, if
// any, are complete.
void UpdateBoundsAndOpacity(const TargetBounds& target_bounds,
@@ -309,12 +309,12 @@ class ASH_EXPORT ShelfLayoutManager :
// two displays.
gfx::Rect GetAutoHideShowShelfRegionInScreen() const;
- // Returns the AutoHideState. This value is determined from the launcher and
+ // Returns the AutoHideState. This value is determined from the shelf and
// tray.
ShelfAutoHideState CalculateAutoHideState(
ShelfVisibilityState visibility_state) const;
- // Updates the hit test bounds override for launcher and status area.
+ // Updates the hit test bounds override for shelf and status area.
void UpdateHitTestBounds();
// Returns true if |window| is a descendant of the shelf.
@@ -369,8 +369,8 @@ class ASH_EXPORT ShelfLayoutManager :
// False when neither the auto hide timer nor the timer task are running.
bool mouse_over_shelf_when_auto_hide_timer_started_;
- // EventFilter used to detect when user moves the mouse over the launcher to
- // trigger showing the launcher.
+ // EventFilter used to detect when user moves the mouse over the shelf to
+ // trigger showing the shelf.
scoped_ptr<AutoHideEventFilter> auto_hide_event_filter_;
// EventFilter used to detect when user issues a gesture on a bezel sensor.
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index e8300d3..500450a 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -9,10 +9,10 @@
#include "ash/ash_switches.h"
#include "ash/display/display_manager.h"
#include "ash/focus_cycler.h"
-#include "ash/launcher/launcher.h"
#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/session_state_delegate.h"
+#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager_observer.h"
#include "ash/shelf/shelf_view.h"
#include "ash/shelf/shelf_widget.h"
@@ -22,7 +22,7 @@
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_item.h"
#include "ash/test/ash_test_base.h"
-#include "ash/test/launcher_test_api.h"
+#include "ash/test/shelf_test_api.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
@@ -669,7 +669,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
gfx::Rect status_bounds(
shelf->status_area_widget()->GetWindowBoundsInScreen());
- gfx::Rect launcher_bounds(
+ gfx::Rect shelf_bounds(
shelf->GetWindowBoundsInScreen());
int shelf_height = manager->GetIdealBounds().height();
gfx::Screen* screen = Shell::GetScreen();
@@ -707,9 +707,8 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
EXPECT_EQ(shelf_height, display.GetWorkAreaInsets().bottom());
// Make sure the bounds of the two widgets changed.
- launcher_bounds = shelf->GetNativeView()->bounds();
- EXPECT_LT(launcher_bounds.y(),
- screen->GetPrimaryDisplay().bounds().bottom());
+ shelf_bounds = shelf->GetNativeView()->bounds();
+ EXPECT_LT(shelf_bounds.y(), screen->GetPrimaryDisplay().bounds().bottom());
status_bounds = shelf->status_area_widget()->GetNativeView()->bounds();
EXPECT_LT(status_bounds.y(),
screen->GetPrimaryDisplay().bounds().bottom());
@@ -775,17 +774,17 @@ TEST_F(ShelfLayoutManagerTest, SetStateWhileAnimating) {
small_change);
}
-// Makes sure the launcher is sized when the status area changes size.
-TEST_F(ShelfLayoutManagerTest, LauncherUpdatedWhenStatusAreaChangesSize) {
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- ASSERT_TRUE(launcher);
+// Makes sure the shelf is sized when the status area changes size.
+TEST_F(ShelfLayoutManagerTest, ShelfUpdatedWhenStatusAreaChangesSize) {
+ Shelf* shelf = Shelf::ForPrimaryDisplay();
+ ASSERT_TRUE(shelf);
ShelfWidget* shelf_widget = GetShelfWidget();
ASSERT_TRUE(shelf_widget);
ASSERT_TRUE(shelf_widget->status_area_widget());
shelf_widget->status_area_widget()->SetBounds(
gfx::Rect(0, 0, 200, 200));
EXPECT_EQ(200, shelf_widget->GetContentsView()->width() -
- test::LauncherTestAPI(launcher).shelf_view()->width());
+ test::ShelfTestAPI(shelf).shelf_view()->width());
}
@@ -816,7 +815,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) {
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
// LayoutShelf() forces the animation to completion, at which point the
- // launcher should go off the screen.
+ // shelf should go off the screen.
shelf->LayoutShelf();
EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize,
GetShelfWidget()->GetWindowBoundsInScreen().y());
@@ -977,7 +976,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) {
aura::Window* root = Shell::GetPrimaryRootWindow();
// LayoutShelf() forces the animation to completion, at which point the
- // launcher should go off the screen.
+ // shelf should go off the screen.
shelf->LayoutShelf();
EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize,
GetShelfWidget()->GetWindowBoundsInScreen().y());
@@ -1197,8 +1196,8 @@ TEST_F(ShelfLayoutManagerTest, TestDimmingBehaviorWithMenus) {
EXPECT_EQ(0, shelf->shelf_widget()->GetDimmingAlphaForTest());
}
-// Verifies the shelf is visible when status/launcher is focused.
-TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) {
+// Verifies the shelf is visible when status/shelf is focused.
+TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrShelfFocused) {
// Since ShelfLayoutManager queries for mouse location, move the mouse so
// it isn't over the shelf.
aura::test::EventGenerator generator(
@@ -1217,7 +1216,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) {
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
- // Focus the launcher. Have to go through the focus cycler as normal focus
+ // Focus the shelf. Have to go through the focus cycler as normal focus
// requests to it do nothing.
GetShelfWidget()->GetFocusCycler()->RotateFocus(FocusCycler::FORWARD);
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
@@ -1404,7 +1403,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
- gfx::Rect launcher_bounds(
+ gfx::Rect shelf_bounds(
GetShelfWidget()->GetWindowBoundsInScreen());
const gfx::Screen* screen = Shell::GetScreen();
gfx::Display display =
@@ -1413,7 +1412,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
EXPECT_EQ(shelf->GetIdealBounds().width(),
display.GetWorkAreaInsets().left());
EXPECT_GE(
- launcher_bounds.width(),
+ shelf_bounds.width(),
GetShelfWidget()->GetContentsView()->GetPreferredSize().width());
EXPECT_EQ(SHELF_ALIGNMENT_LEFT, GetSystemTray()->shelf_alignment());
StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget();
@@ -1425,9 +1424,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
EXPECT_EQ(0, display.GetWorkAreaInsets().top());
EXPECT_EQ(0, display.GetWorkAreaInsets().bottom());
EXPECT_EQ(0, display.GetWorkAreaInsets().right());
- EXPECT_EQ(display.bounds().x(), launcher_bounds.x());
- EXPECT_EQ(display.bounds().y(), launcher_bounds.y());
- EXPECT_EQ(display.bounds().height(), launcher_bounds.height());
+ EXPECT_EQ(display.bounds().x(), shelf_bounds.x());
+ EXPECT_EQ(display.bounds().y(), shelf_bounds.y());
+ EXPECT_EQ(display.bounds().height(), shelf_bounds.height());
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
EXPECT_EQ(ShelfLayoutManager::kAutoHideSize,
@@ -1437,13 +1436,13 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT);
display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
- launcher_bounds = GetShelfWidget()->GetWindowBoundsInScreen();
+ shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen();
display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
ASSERT_NE(-1, display.id());
EXPECT_EQ(shelf->GetIdealBounds().width(),
display.GetWorkAreaInsets().right());
- EXPECT_GE(launcher_bounds.width(),
- GetShelfWidget()->GetContentsView()->GetPreferredSize().width());
+ EXPECT_GE(shelf_bounds.width(),
+ GetShelfWidget()->GetContentsView()->GetPreferredSize().width());
EXPECT_EQ(SHELF_ALIGNMENT_RIGHT, GetSystemTray()->shelf_alignment());
status_bounds = gfx::Rect(status_area_widget->GetWindowBoundsInScreen());
EXPECT_GE(status_bounds.width(),
@@ -1453,9 +1452,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
EXPECT_EQ(0, display.GetWorkAreaInsets().top());
EXPECT_EQ(0, display.GetWorkAreaInsets().bottom());
EXPECT_EQ(0, display.GetWorkAreaInsets().left());
- EXPECT_EQ(display.work_area().right(), launcher_bounds.x());
- EXPECT_EQ(display.bounds().y(), launcher_bounds.y());
- EXPECT_EQ(display.bounds().height(), launcher_bounds.height());
+ EXPECT_EQ(display.work_area().right(), shelf_bounds.x());
+ EXPECT_EQ(display.bounds().y(), shelf_bounds.y());
+ EXPECT_EQ(display.bounds().height(), shelf_bounds.height());
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
EXPECT_EQ(ShelfLayoutManager::kAutoHideSize,
@@ -1466,13 +1465,13 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
shelf->SetAlignment(SHELF_ALIGNMENT_TOP);
display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
- launcher_bounds = GetShelfWidget()->GetWindowBoundsInScreen();
+ shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen();
display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
ASSERT_NE(-1, display.id());
EXPECT_EQ(shelf->GetIdealBounds().height(),
display.GetWorkAreaInsets().top());
- EXPECT_GE(launcher_bounds.height(),
- GetShelfWidget()->GetContentsView()->GetPreferredSize().height());
+ EXPECT_GE(shelf_bounds.height(),
+ GetShelfWidget()->GetContentsView()->GetPreferredSize().height());
EXPECT_EQ(SHELF_ALIGNMENT_TOP, GetSystemTray()->shelf_alignment());
status_bounds = gfx::Rect(status_area_widget->GetWindowBoundsInScreen());
EXPECT_GE(status_bounds.height(),
@@ -1482,9 +1481,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
EXPECT_EQ(0, display.GetWorkAreaInsets().right());
EXPECT_EQ(0, display.GetWorkAreaInsets().bottom());
EXPECT_EQ(0, display.GetWorkAreaInsets().left());
- EXPECT_EQ(display.work_area().y(), launcher_bounds.bottom());
- EXPECT_EQ(display.bounds().x(), launcher_bounds.x());
- EXPECT_EQ(display.bounds().width(), launcher_bounds.width());
+ EXPECT_EQ(display.work_area().y(), shelf_bounds.bottom());
+ EXPECT_EQ(display.bounds().x(), shelf_bounds.x());
+ EXPECT_EQ(display.bounds().width(), shelf_bounds.width());
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
EXPECT_EQ(ShelfLayoutManager::kAutoHideSize,
diff --git a/ash/shelf/shelf_navigator_unittest.cc b/ash/shelf/shelf_navigator_unittest.cc
index c4f392d..6ee07a5 100644
--- a/ash/shelf/shelf_navigator_unittest.cc
+++ b/ash/shelf/shelf_navigator_unittest.cc
@@ -5,8 +5,8 @@
#include "ash/shelf/shelf_navigator.h"
#include "ash/ash_switches.h"
-#include "ash/launcher/launcher.h"
#include "ash/launcher/launcher_types.h"
+#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_model.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
diff --git a/ash/shelf/shelf_tooltip_manager_unittest.cc b/ash/shelf/shelf_tooltip_manager_unittest.cc
index 6114202..2294ba4 100644
--- a/ash/shelf/shelf_tooltip_manager_unittest.cc
+++ b/ash/shelf/shelf_tooltip_manager_unittest.cc
@@ -10,7 +10,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
-#include "ash/test/launcher_test_api.h"
+#include "ash/test/shelf_test_api.h"
#include "ash/wm/window_util.h"
#include "base/strings/string16.h"
#include "base/time/time.h"
@@ -46,7 +46,7 @@ class ShelfTooltipManagerTest : public AshTestBase {
Shell::GetPrimaryRootWindowController();
tooltip_manager_.reset(new internal::ShelfTooltipManager(
controller->GetShelfLayoutManager(),
- LauncherTestAPI(controller->shelf()->launcher()).shelf_view()));
+ ShelfTestAPI(controller->shelf()->shelf()).shelf_view()));
}
virtual void TearDown() OVERRIDE {
diff --git a/ash/shelf/shelf_unittest.cc b/ash/shelf/shelf_unittest.cc
new file mode 100644
index 0000000..5a7369e
--- /dev/null
+++ b/ash/shelf/shelf_unittest.cc
@@ -0,0 +1,165 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/shelf/shelf.h"
+#include "ash/shelf/shelf_button.h"
+#include "ash/shelf/shelf_item_delegate_manager.h"
+#include "ash/shelf/shelf_model.h"
+#include "ash/shelf/shelf_view.h"
+#include "ash/shelf/shelf_widget.h"
+#include "ash/shell.h"
+#include "ash/test/ash_test_base.h"
+#include "ash/test/shelf_test_api.h"
+#include "ash/test/shelf_view_test_api.h"
+#include "ash/test/test_shelf_item_delegate.h"
+#include "ash/wm/window_util.h"
+#include "ui/aura/root_window.h"
+#include "ui/gfx/display.h"
+#include "ui/gfx/screen.h"
+#include "ui/views/corewm/corewm_switches.h"
+#include "ui/views/view.h"
+#include "ui/views/widget/widget.h"
+
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#endif
+
+using ash::internal::ShelfView;
+using ash::internal::ShelfButton;
+
+namespace ash {
+
+class ShelfTest : public ash::test::AshTestBase {
+ public:
+ ShelfTest()
+ : shelf_(NULL),
+ shelf_view_(NULL),
+ shelf_model_(NULL),
+ item_delegate_manager_(NULL) {}
+
+ virtual ~ShelfTest() {}
+
+ virtual void SetUp() {
+ test::AshTestBase::SetUp();
+
+ shelf_ = Shelf::ForPrimaryDisplay();
+ ASSERT_TRUE(shelf_);
+
+ test::ShelfTestAPI test(shelf_);
+ shelf_view_ = test.shelf_view();
+ shelf_model_ = shelf_view_->model();
+ item_delegate_manager_ =
+ Shell::GetInstance()->shelf_item_delegate_manager();
+
+ test_.reset(new ash::test::ShelfViewTestAPI(shelf_view_));
+ }
+
+ virtual void TearDown() OVERRIDE {
+ test::AshTestBase::TearDown();
+ }
+
+ Shelf* shelf() {
+ return shelf_;
+ }
+
+ ShelfView* shelf_view() {
+ return shelf_view_;
+ }
+
+ ShelfModel* shelf_model() {
+ return shelf_model_;
+ }
+
+ ShelfItemDelegateManager* item_manager() {
+ return item_delegate_manager_;
+ }
+
+ ash::test::ShelfViewTestAPI* test_api() {
+ return test_.get();
+ }
+
+ private:
+ Shelf* shelf_;
+ ShelfView* shelf_view_;
+ ShelfModel* shelf_model_;
+ ShelfItemDelegateManager* item_delegate_manager_;
+ scoped_ptr<test::ShelfViewTestAPI> test_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShelfTest);
+};
+
+// Confirms that LauncherItem reflects the appropriated state.
+TEST_F(ShelfTest, StatusReflection) {
+ // Initially we have the app list.
+ int button_count = test_api()->GetButtonCount();
+
+ // Add running platform app.
+ LauncherItem item;
+ item.type = TYPE_PLATFORM_APP;
+ item.status = STATUS_RUNNING;
+ int index = shelf_model()->Add(item);
+ ASSERT_EQ(++button_count, test_api()->GetButtonCount());
+ ShelfButton* button = test_api()->GetButton(index);
+ EXPECT_EQ(ShelfButton::STATE_RUNNING, button->state());
+
+ // Remove it.
+ shelf_model()->RemoveItemAt(index);
+ ASSERT_EQ(--button_count, test_api()->GetButtonCount());
+}
+
+// Confirm that using the menu will clear the hover attribute. To avoid another
+// browser test we check this here.
+TEST_F(ShelfTest, checkHoverAfterMenu) {
+ // Initially we have the app list.
+ int button_count = test_api()->GetButtonCount();
+
+ // Add running platform app.
+ LauncherItem item;
+ item.type = TYPE_PLATFORM_APP;
+ item.status = STATUS_RUNNING;
+ int index = shelf_model()->Add(item);
+
+ scoped_ptr<ShelfItemDelegate> delegate(
+ new test::TestShelfItemDelegate(NULL));
+ item_manager()->SetShelfItemDelegate(shelf_model()->items()[index].id,
+ delegate.Pass());
+
+ ASSERT_EQ(++button_count, test_api()->GetButtonCount());
+ ShelfButton* button = test_api()->GetButton(index);
+ button->AddState(ShelfButton::STATE_HOVERED);
+ button->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE);
+ EXPECT_FALSE(button->state() & ShelfButton::STATE_HOVERED);
+
+ // Remove it.
+ shelf_model()->RemoveItemAt(index);
+}
+
+TEST_F(ShelfTest, ShowOverflowBubble) {
+ LauncherID first_item_id = shelf_model()->next_id();
+
+ // Add platform app button until overflow.
+ int items_added = 0;
+ while (!test_api()->IsOverflowButtonVisible()) {
+ LauncherItem item;
+ item.type = TYPE_PLATFORM_APP;
+ item.status = STATUS_RUNNING;
+ shelf_model()->Add(item);
+
+ ++items_added;
+ ASSERT_LT(items_added, 10000);
+ }
+
+ // Shows overflow bubble.
+ test_api()->ShowOverflowBubble();
+ EXPECT_TRUE(shelf()->IsShowingOverflowBubble());
+
+ // Removes the first item in main shelf view.
+ shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id));
+
+ // Waits for all transitions to finish and there should be no crash.
+ test_api()->RunMessageLoopUntilAnimationsDone();
+ EXPECT_FALSE(shelf()->IsShowingOverflowBubble());
+}
+
+} // namespace ash
diff --git a/ash/shelf/shelf_util.cc b/ash/shelf/shelf_util.cc
index 77031d8..f914188 100644
--- a/ash/shelf/shelf_util.cc
+++ b/ash/shelf/shelf_util.cc
@@ -31,14 +31,14 @@ LauncherID GetLauncherIDForWindow(aura::Window* window) {
return window->GetProperty(kLauncherID);
}
-void SetLauncherItemDetailsForWindow(aura::Window* window,
- const LauncherItemDetails& details) {
+void SetShelfItemDetailsForWindow(aura::Window* window,
+ const LauncherItemDetails& details) {
// |item_details| is owned by |window|.
LauncherItemDetails* item_details = new LauncherItemDetails(details);
window->SetProperty(kLauncherItemDetailsKey, item_details);
}
-void ClearLauncherItemDetailsForWindow(aura::Window* window) {
+void ClearShelfItemDetailsForWindow(aura::Window* window) {
window->ClearProperty(kLauncherItemDetailsKey);
}
diff --git a/ash/shelf/shelf_util.h b/ash/shelf/shelf_util.h
index 6fb3d5e..9b9764d 100644
--- a/ash/shelf/shelf_util.h
+++ b/ash/shelf/shelf_util.h
@@ -28,14 +28,14 @@ ASH_EXPORT void SetLauncherIDForWindow(LauncherID id, aura::Window* window);
ASH_EXPORT LauncherID GetLauncherIDForWindow(aura::Window* window);
// Sets LauncherItemDetails for |window|.
-ASH_EXPORT void SetLauncherItemDetailsForWindow(
+ASH_EXPORT void SetShelfItemDetailsForWindow(
aura::Window* window,
const LauncherItemDetails& details);
// Clears LauncherItemDetails for |window|.
-// If |window| has a LauncherItem by SetLauncherItemDetailsForWindow(), it will
+// If |window| has a LauncherItem by SetShelfItemDetailsForWindow(), it will
// be removed.
-ASH_EXPORT void ClearLauncherItemDetailsForWindow(aura::Window* window);
+ASH_EXPORT void ClearShelfItemDetailsForWindow(aura::Window* window);
// Returns LauncherItemDetails for |window| or NULL if it doesn't have.
// Returned LauncherItemDetails object is owned by the |window|.
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 101c0cd..01dfae4 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -87,7 +87,7 @@ const int kHorizontalIconSpacing = 2;
const int kHorizontalNoIconInsetSpacing =
kHorizontalIconSpacing + kDefaultLeadingInset;
-// The proportion of the launcher space reserved for non-panel icons. Panels
+// The proportion of the shelf space reserved for non-panel icons. Panels
// may flow into this space but will be put into the overflow bubble if there
// is contention for the space.
const float kReservedNonPanelIconProportion = 0.67f;
@@ -203,14 +203,14 @@ bool ShelfMenuModelAdapter::ShouldReserveSpaceForSubmenuIndicator() const {
return false;
}
-// Custom FocusSearch used to navigate the launcher in the order items are in
+// Custom FocusSearch used to navigate the shelf in the order items are in
// the ViewModel.
-class LauncherFocusSearch : public views::FocusSearch {
+class ShelfFocusSearch : public views::FocusSearch {
public:
- explicit LauncherFocusSearch(views::ViewModel* view_model)
+ explicit ShelfFocusSearch(views::ViewModel* view_model)
: FocusSearch(NULL, true, true),
view_model_(view_model) {}
- virtual ~LauncherFocusSearch() {}
+ virtual ~ShelfFocusSearch() {}
// views::FocusSearch overrides:
virtual View* FindNextFocusableView(
@@ -239,7 +239,7 @@ class LauncherFocusSearch : public views::FocusSearch {
private:
views::ViewModel* view_model_;
- DISALLOW_COPY_AND_ASSIGN(LauncherFocusSearch);
+ DISALLOW_COPY_AND_ASSIGN(ShelfFocusSearch);
};
// AnimationDelegate used when inserting a new item. This steadily increases the
@@ -385,7 +385,7 @@ ShelfView::ShelfView(ShelfModel* model,
bounds_animator_.reset(new views::BoundsAnimator(this));
bounds_animator_->AddObserver(this);
set_context_menu_controller(this);
- focus_search_.reset(new LauncherFocusSearch(view_model_.get()));
+ focus_search_.reset(new ShelfFocusSearch(view_model_.get()));
tooltip_.reset(new ShelfTooltipManager(manager, this));
}
@@ -585,7 +585,7 @@ bool ShelfView::StartDrag(const std::string& app_id,
drag_and_drop_launcher_id_ =
delegate_->GetLauncherIDForAppID(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 launcher order accordingly. Note that items have
+ // 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.
@@ -716,7 +716,7 @@ void ShelfView::CalculateIdealBounds(IdealBounds* bounds) {
// 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).
+ // 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);
@@ -744,7 +744,7 @@ void ShelfView::CalculateIdealBounds(IdealBounds* bounds) {
return;
}
- // To address Fitt's law, we make the first launcher button include the
+ // 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) {
@@ -1060,7 +1060,7 @@ void ShelfView::ContinueDrag(const ui::LocatedEvent& event) {
if (target_index == current_index)
return;
- // Change the model, the LauncherItemMoved() callback will handle the
+ // Change the model, the ShelfItemMoved() callback will handle the
// |view_model_| update.
model_->Move(current_index, target_index);
bounds_animator_->StopAnimatingView(drag_view_);
@@ -1143,7 +1143,7 @@ bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) {
dragged_off_shelf_ = true;
if (RemovableByRipOff(current_index) == REMOVABLE) {
// Move the item to the front of the first panel item and hide it.
- // LauncherItemMoved() callback will handle the |view_model_| update and
+ // ShelfItemMoved() callback will handle the |view_model_| update and
// call AnimateToIdealBounds().
if (current_index != model_->FirstPanelIndex() - 1) {
model_->Move(current_index, model_->FirstPanelIndex() - 1);
@@ -1306,7 +1306,7 @@ void ShelfView::UpdateFirstButtonPadding() {
if (ash::switches::UseAlternateShelfLayout())
return;
- // Creates an empty border for first launcher button to make included leading
+ // 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) {
@@ -1557,7 +1557,7 @@ void ShelfView::ShelfItemRemoved(int model_index, LauncherID id) {
// When the overflow bubble is visible, the overflow range needs to be set
// before CalculateIdealBounds() gets called. Otherwise CalculateIdealBounds()
- // could trigger a LauncherItemChanged() by hiding the overflow bubble and
+ // could trigger a ShelfItemChanged() by hiding the overflow bubble and
// since the overflow bubble is not yet synced with the ShelfModel this
// could cause a crash.
if (overflow_bubble_ && overflow_bubble_->IsShowing()) {
@@ -1631,7 +1631,7 @@ void ShelfView::ShelfItemChanged(int model_index,
void ShelfView::ShelfItemMoved(int start_index, int target_index) {
view_model_->Move(start_index, target_index);
- // When cancelling a drag due to a launcher item being added, the currently
+ // When cancelling a drag due to a shelf item being added, the currently
// dragged item is moved back to its initial position. AnimateToIdealBounds
// will be called again when the new item is added to the |view_model_| but
// at this time the |view_model_| is inconsistent with the |model_|.
@@ -1874,7 +1874,7 @@ void ShelfView::ShowMenu(scoped_ptr<views::MenuModelAdapter> menu_model_adapter,
views::MenuItemView::TOPLEFT;
gfx::Rect anchor_point = gfx::Rect(click_point, gfx::Size());
- ShelfWidget* shelf = RootWindowController::ForLauncher(
+ ShelfWidget* shelf = RootWindowController::ForShelf(
GetWidget()->GetNativeView())->shelf();
if (!context_menu) {
// Application lists use a bubble.
@@ -1909,7 +1909,7 @@ void ShelfView::ShowMenu(scoped_ptr<views::MenuModelAdapter> menu_model_adapter,
break;
}
}
- // If this gets deleted while we are in the menu, the launcher will be gone
+ // If this gets deleted while we are in the menu, the shelf will be gone
// as well.
bool got_deleted = false;
got_deleted_ = &got_deleted;
@@ -2005,7 +2005,7 @@ bool ShelfView::ShouldShowTooltipForView(const views::View* view) const {
}
int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
- ShelfWidget* shelf = RootWindowController::ForLauncher(
+ ShelfWidget* shelf = RootWindowController::ForShelf(
GetWidget()->GetNativeView())->shelf();
ash::ShelfAlignment align = shelf->GetAlignment();
const gfx::Rect bounds = GetBoundsInScreen();
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc
index 47d1c80..15c37fe 100644
--- a/ash/shelf/shelf_view_unittest.cc
+++ b/ash/shelf/shelf_view_unittest.cc
@@ -8,11 +8,11 @@
#include <vector>
#include "ash/ash_switches.h"
-#include "ash/launcher/launcher.h"
#include "ash/launcher/launcher_types.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/overflow_bubble.h"
#include "ash/shelf/overflow_bubble_view.h"
+#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_button.h"
#include "ash/shelf/shelf_icon_observer.h"
#include "ash/shelf/shelf_item_delegate_manager.h"
@@ -23,8 +23,8 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
-#include "ash/test/launcher_test_api.h"
#include "ash/test/overflow_bubble_view_test_api.h"
+#include "ash/test/shelf_test_api.h"
#include "ash/test/shelf_view_test_api.h"
#include "ash/test/shell_test_api.h"
#include "ash/test/test_shelf_delegate.h"
@@ -56,16 +56,16 @@ namespace test {
class TestShelfIconObserver : public ShelfIconObserver {
public:
- explicit TestShelfIconObserver(Launcher* launcher)
- : launcher_(launcher),
+ explicit TestShelfIconObserver(Shelf* shelf)
+ : shelf_(shelf),
change_notified_(false) {
- if (launcher_)
- launcher_->AddIconObserver(this);
+ if (shelf_)
+ shelf_->AddIconObserver(this);
}
virtual ~TestShelfIconObserver() {
- if (launcher_)
- launcher_->RemoveIconObserver(this);
+ if (shelf_)
+ shelf_->RemoveIconObserver(this);
}
// ShelfIconObserver implementation.
@@ -77,7 +77,7 @@ class TestShelfIconObserver : public ShelfIconObserver {
void Reset() { change_notified_ = false; }
private:
- Launcher* launcher_;
+ Shelf* shelf_;
bool change_notified_;
DISALLOW_COPY_AND_ASSIGN(TestShelfIconObserver);
@@ -90,11 +90,11 @@ class ShelfViewIconObserverTest : public AshTestBase {
virtual void SetUp() OVERRIDE {
AshTestBase::SetUp();
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- observer_.reset(new TestShelfIconObserver(launcher));
+ Shelf* shelf = Shelf::ForPrimaryDisplay();
+ observer_.reset(new TestShelfIconObserver(shelf));
- shelf_view_test_.reset(new ShelfViewTestAPI(
- LauncherTestAPI(launcher).shelf_view()));
+ shelf_view_test_.reset(
+ new ShelfViewTestAPI(ShelfTestAPI(shelf).shelf_view()));
shelf_view_test_->SetAnimationDuration(1);
}
@@ -109,8 +109,8 @@ class ShelfViewIconObserverTest : public AshTestBase {
return shelf_view_test_.get();
}
- Launcher* LauncherForSecondaryDisplay() {
- return Launcher::ForWindow(Shell::GetAllRootWindows()[1]);
+ Shelf* ShelfForSecondaryDisplay() {
+ return Shelf::ForWindow(Shell::GetAllRootWindows()[1]);
}
private:
@@ -152,10 +152,10 @@ TEST_F(ShelfViewIconObserverTest, AddRemove) {
AddRemoveWithMultipleDisplays
#endif
// Make sure creating/deleting an window on one displays notifies a
-// launcher on external display as well as one on primary.
+// shelf on external display as well as one on primary.
TEST_F(ShelfViewIconObserverTest, MAYBE_AddRemoveWithMultipleDisplays) {
UpdateDisplay("400x400,400x400");
- TestShelfIconObserver second_observer(LauncherForSecondaryDisplay());
+ TestShelfIconObserver second_observer(ShelfForSecondaryDisplay());
TestShelfDelegate* shelf_delegate = TestShelfDelegate::instance();
ASSERT_TRUE(shelf_delegate);
@@ -184,13 +184,12 @@ TEST_F(ShelfViewIconObserverTest, MAYBE_AddRemoveWithMultipleDisplays) {
}
TEST_F(ShelfViewIconObserverTest, BoundsChanged) {
- ShelfWidget* shelf = Shell::GetPrimaryRootWindowController()->shelf();
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- gfx::Size shelf_size =
- shelf->GetWindowBoundsInScreen().size();
+ ShelfWidget* widget = Shell::GetPrimaryRootWindowController()->shelf();
+ Shelf* shelf = Shelf::ForPrimaryDisplay();
+ gfx::Size shelf_size = widget->GetWindowBoundsInScreen().size();
shelf_size.set_width(shelf_size.width() / 2);
ASSERT_GT(shelf_size.width(), 0);
- launcher->SetShelfViewBounds(gfx::Rect(shelf_size));
+ shelf->SetShelfViewBounds(gfx::Rect(shelf_size));
// No animation happens for ShelfView bounds change.
EXPECT_TRUE(observer()->change_notified());
observer()->Reset();
@@ -208,9 +207,9 @@ class TestShelfDelegateForShelfView : public ShelfDelegate {
virtual ~TestShelfDelegateForShelfView() {}
// ShelfDelegate overrides:
- virtual void OnLauncherCreated(Launcher* launcher) OVERRIDE {}
+ virtual void OnShelfCreated(Shelf* shelf) OVERRIDE {}
- virtual void OnLauncherDestroyed(Launcher* launcher) OVERRIDE {}
+ virtual void OnShelfDestroyed(Shelf* shelf) OVERRIDE {}
virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) OVERRIDE {
LauncherID id = 0;
@@ -267,8 +266,8 @@ class ShelfViewTest : public AshTestBase {
AshTestBase::SetUp();
test::ShellTestApi test_api(Shell::GetInstance());
model_ = test_api.shelf_model();
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- shelf_view_ = test::LauncherTestAPI(launcher).shelf_view();
+ Shelf* shelf = Shelf::ForPrimaryDisplay();
+ shelf_view_ = ShelfTestAPI(shelf).shelf_view();
// The bounds should be big enough for 4 buttons + overflow chevron.
shelf_view_->SetBounds(0, 0, 500,
@@ -280,7 +279,7 @@ class ShelfViewTest : public AshTestBase {
item_manager_ = Shell::GetInstance()->shelf_item_delegate_manager();
DCHECK(item_manager_);
- // Add browser shortcut launcher item at index 0 for test.
+ // Add browser shortcut shelf item at index 0 for test.
AddBrowserShortcut();
}
@@ -382,7 +381,7 @@ class ShelfViewTest : public AshTestBase {
ASSERT_EQ(map_index, id_map.size());
}
- void VerifyLauncherItemBoundsAreValid() {
+ void VerifyShelfItemBoundsAreValid() {
for (int i=0;i <= test_api_->GetLastVisibleIndex(); ++i) {
if (test_api_->GetButton(i)) {
gfx::Rect shelf_view_bounds = shelf_view_->GetLocalBounds();
@@ -434,14 +433,14 @@ class ShelfViewTest : public AshTestBase {
void SetupForDragTest(
std::vector<std::pair<LauncherID, views::View*> >* id_map) {
- // Initialize |id_map| with the automatically-created launcher buttons.
+ // Initialize |id_map| with the automatically-created shelf buttons.
for (size_t i = 0; i < model_->items().size(); ++i) {
internal::ShelfButton* button = test_api_->GetButton(i);
id_map->push_back(std::make_pair(model_->items()[i].id, button));
}
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(*id_map));
- // Add 5 app launcher buttons for testing.
+ // Add 5 app shelf buttons for testing.
for (int i = 0; i < 5; ++i) {
LauncherID id = AddAppShortcut();
// App Icon is located at index 0, and browser shortcut is located at
@@ -568,8 +567,7 @@ class ShelfViewTest : public AshTestBase {
test_api.SetShelfDelegate(NULL);
ShelfDelegate* delegate = new TestShelfDelegateForShelfView(model_);
test_api.SetShelfDelegate(delegate);
- test::LauncherTestAPI(
- Launcher::ForPrimaryDisplay()).SetShelfDelegate(delegate);
+ test::ShelfTestAPI(Shelf::ForPrimaryDisplay()).SetShelfDelegate(delegate);
test_api_->SetShelfDelegate(delegate);
}
@@ -956,7 +954,7 @@ TEST_F(ShelfViewTest, AddButtonQuickly) {
}
}
-// Check that model changes are handled correctly while a launcher icon is being
+// Check that model changes are handled correctly while a shelf icon is being
// dragged.
TEST_F(ShelfViewTest, ModelChangesWhileDragging) {
internal::ShelfButtonHost* button_host = shelf_view_;
@@ -1002,7 +1000,7 @@ TEST_F(ShelfViewTest, ModelChangesWhileDragging) {
internal::ShelfButtonHost::MOUSE,
false);
- // Adding a launcher item cancels the drag and respects the order.
+ // Adding a shelf item cancels the drag and respects the order.
dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3);
LauncherID new_id = AddAppShortcut();
id_map.insert(id_map.begin() + 6,
@@ -1012,7 +1010,7 @@ TEST_F(ShelfViewTest, ModelChangesWhileDragging) {
internal::ShelfButtonHost::MOUSE,
false);
- // Adding a launcher item at the end (i.e. a panel) canels drag and respects
+ // Adding a shelf item at the end (i.e. a panel) canels drag and respects
// the order.
dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3);
new_id = AddPanel();
@@ -1068,7 +1066,7 @@ TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) {
internal::ShelfButtonHost::MOUSE,
false);
- // Adding a launcher item cancels the drag and respects the order.
+ // Adding a shelf item cancels the drag and respects the order.
dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2);
LauncherID new_id = AddAppShortcut();
id_map.insert(id_map.begin() + 5,
@@ -1078,7 +1076,7 @@ TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) {
internal::ShelfButtonHost::MOUSE,
false);
- // Adding a launcher item at the end (i.e. a panel) canels drag and respects
+ // Adding a shelf item at the end (i.e. a panel) canels drag and respects
// the order.
dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2);
new_id = AddPanel();
@@ -1162,7 +1160,7 @@ TEST_F(ShelfViewTest, ClickOneDragAnother) {
}
// Confirm that item status changes are reflected in the buttons.
-TEST_F(ShelfViewTest, LauncherItemStatus) {
+TEST_F(ShelfViewTest, ShelfItemStatus) {
// All buttons should be visible.
ASSERT_EQ(test_api_->GetButtonCount(),
test_api_->GetLastVisibleIndex() + 1);
@@ -1182,12 +1180,12 @@ TEST_F(ShelfViewTest, LauncherItemStatus) {
}
TEST_F(ShelfViewLegacyShelfLayoutTest,
- LauncherItemPositionReflectedOnStateChanged) {
+ ShelfItemPositionReflectedOnStateChanged) {
// All buttons should be visible.
ASSERT_EQ(test_api_->GetButtonCount(),
test_api_->GetLastVisibleIndex() + 1);
- // Add 2 items to the launcher.
+ // Add 2 items to the shelf.
LauncherID item1_id = AddPlatformApp();
LauncherID item2_id = AddPlatformAppNoWait();
internal::ShelfButton* item1_button = GetButtonByID(item1_id);
@@ -1217,7 +1215,7 @@ TEST_F(ShelfViewLegacyShelfLayoutTest,
// Confirm that item status changes are reflected in the buttons
// for platform apps.
-TEST_F(ShelfViewTest, LauncherItemStatusPlatformApp) {
+TEST_F(ShelfViewTest, ShelfItemStatusPlatformApp) {
// All buttons should be visible.
ASSERT_EQ(test_api_->GetButtonCount(),
test_api_->GetLastVisibleIndex() + 1);
@@ -1236,24 +1234,24 @@ TEST_F(ShelfViewTest, LauncherItemStatusPlatformApp) {
ASSERT_EQ(internal::ShelfButton::STATE_ATTENTION, button->state());
}
-// Confirm that launcher item bounds are correctly updated on shelf changes.
-TEST_F(ShelfViewTest, LauncherItemBoundsCheck) {
- VerifyLauncherItemBoundsAreValid();
+// Confirm that shelf item bounds are correctly updated on shelf changes.
+TEST_F(ShelfViewTest, ShelfItemBoundsCheck) {
+ VerifyShelfItemBoundsAreValid();
shelf_view_->shelf_layout_manager()->SetAutoHideBehavior(
SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
test_api_->RunMessageLoopUntilAnimationsDone();
- VerifyLauncherItemBoundsAreValid();
+ VerifyShelfItemBoundsAreValid();
shelf_view_->shelf_layout_manager()->SetAutoHideBehavior(
SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
test_api_->RunMessageLoopUntilAnimationsDone();
- VerifyLauncherItemBoundsAreValid();
+ VerifyShelfItemBoundsAreValid();
}
TEST_F(ShelfViewTest, ShelfTooltipTest) {
ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1,
test_api_->GetButtonCount());
- // Prepare some items to the launcher.
+ // Prepare some items to the shelf.
LauncherID app_button_id = AddAppShortcut();
LauncherID platform_button_id = AddPlatformApp();
@@ -1295,14 +1293,14 @@ TEST_F(ShelfViewTest, ShelfTooltipTest) {
EXPECT_EQ(platform_button, GetTooltipAnchorView());
}
-// Verify a fix for crash caused by a tooltip update for a deleted launcher
+// Verify a fix for crash caused by a tooltip update for a deletedshelf
// button, see crbug.com/288838.
TEST_F(ShelfViewTest, RemovingItemClosesTooltip) {
internal::ShelfButtonHost* button_host = shelf_view_;
internal::ShelfTooltipManager* tooltip_manager =
shelf_view_->tooltip_manager();
- // Add an item to the launcher.
+ // Add an item to the shelf.
LauncherID app_button_id = AddAppShortcut();
internal::ShelfButton* app_button = GetButtonByID(app_button_id);
@@ -1327,7 +1325,7 @@ TEST_F(ShelfViewTest, ShelfAlignmentClosesTooltip) {
internal::ShelfTooltipManager* tooltip_manager =
shelf_view_->tooltip_manager();
- // Add an item to the launcher.
+ // Add an item to the shelf.
LauncherID app_button_id = AddAppShortcut();
internal::ShelfButton* app_button = GetButtonByID(app_button_id);
@@ -1621,10 +1619,9 @@ TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) {
return;
UpdateDisplay("800x600,800x600");
- Launcher* secondary_launcher =
- Launcher::ForWindow(Shell::GetAllRootWindows()[1]);
+ Shelf* secondary_shelf = Shelf::ForWindow(Shell::GetAllRootWindows()[1]);
internal::ShelfView* shelf_view_for_secondary =
- test::LauncherTestAPI(secondary_launcher).shelf_view();
+ ShelfTestAPI(secondary_shelf).shelf_view();
// The bounds should be big enough for 4 buttons + overflow chevron.
shelf_view_for_secondary->SetBounds(0, 0, 500,
@@ -1705,9 +1702,9 @@ TEST_F(ShelfViewTest, CheckRipOffFromLeftShelfAlignmentWithMultiMonitor) {
int browser_index = model_->GetItemIndexForType(TYPE_BROWSER_SHORTCUT);
EXPECT_GT(browser_index, 0);
- Launcher* secondary_launcher = Launcher::ForWindow(second_root);
+ Shelf* secondary_shelf = Shelf::ForWindow(second_root);
internal::ShelfView* shelf_view_for_secondary =
- test::LauncherTestAPI(secondary_launcher).shelf_view();
+ ShelfTestAPI(secondary_shelf).shelf_view();
ShelfViewTestAPI test_api_for_secondary_shelf_view(shelf_view_for_secondary);
internal::ShelfButton* button =
@@ -1744,8 +1741,8 @@ class ShelfViewVisibleBoundsTest : public ShelfViewTest,
void CheckAllItemsAreInBounds() {
gfx::Rect visible_bounds = shelf_view_->GetVisibleItemsBoundsInScreen();
- gfx::Rect launcher_bounds = shelf_view_->GetBoundsInScreen();
- EXPECT_TRUE(launcher_bounds.Contains(visible_bounds));
+ gfx::Rect shelf_bounds = shelf_view_->GetBoundsInScreen();
+ EXPECT_TRUE(shelf_bounds.Contains(visible_bounds));
for (int i = 0; i < test_api_->GetButtonCount(); ++i)
if (internal::ShelfButton* button = test_api_->GetButton(i))
EXPECT_TRUE(visible_bounds.Contains(button->GetBoundsInScreen()));
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc
index 960e70c..907ac9d 100644
--- a/ash/shelf/shelf_widget.cc
+++ b/ash/shelf/shelf_widget.cc
@@ -38,7 +38,7 @@
#include "ui/views/widget/widget_delegate.h"
namespace {
-// Size of black border at bottom (or side) of launcher.
+// Size of black border at bottom (or side) of shelf.
const int kNumBlackPixels = 3;
// Alpha to paint dimming image with.
const int kDimAlpha = 128;
@@ -85,7 +85,7 @@ class DimmerView : public views::View,
int get_dimming_alpha_for_test() { return alpha_; }
private:
- // This class monitors mouse events to see if it is on top of the launcher.
+ // This class monitors mouse events to see if it is on top of the shelf.
class DimmerEventFilter : public ui::EventHandler {
public:
explicit DimmerEventFilter(DimmerView* owner);
@@ -174,12 +174,12 @@ void DimmerView::ForceUndimming(bool force) {
void DimmerView::OnPaintBackground(gfx::Canvas* canvas) {
SkPaint paint;
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- gfx::ImageSkia launcher_background =
+ gfx::ImageSkia shelf_background =
*rb.GetImageNamed(IDR_AURA_LAUNCHER_DIMMING).ToImageSkia();
if (shelf_->GetAlignment() != ash::SHELF_ALIGNMENT_BOTTOM) {
- launcher_background = gfx::ImageSkiaOperations::CreateRotatedImage(
- launcher_background,
+ shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage(
+ shelf_background,
shelf_->shelf_layout_manager()->SelectValueForShelfAlignment(
SkBitmapOperations::ROTATION_90_CW,
SkBitmapOperations::ROTATION_90_CW,
@@ -187,12 +187,17 @@ void DimmerView::OnPaintBackground(gfx::Canvas* canvas) {
SkBitmapOperations::ROTATION_180_CW));
}
paint.setAlpha(alpha_);
- canvas->DrawImageInt(
- launcher_background,
- 0, 0, launcher_background.width(), launcher_background.height(),
- 0, 0, width(), height(),
- false,
- paint);
+ canvas->DrawImageInt(shelf_background,
+ 0,
+ 0,
+ shelf_background.width(),
+ shelf_background.height(),
+ 0,
+ 0,
+ width(),
+ height(),
+ false,
+ paint);
}
DimmerView::DimmerEventFilter::DimmerEventFilter(DimmerView* owner)
@@ -352,7 +357,7 @@ void ShelfWidget::DelegateView::SetDimmed(bool value) {
dimmer_->Init(params);
dimmer_->GetNativeWindow()->SetName("ShelfDimmer");
dimmer_->SetBounds(shelf_->GetWindowBoundsInScreen());
- // The launcher should not take focus when it is initially shown.
+ // The shelf should not take focus when it is initially shown.
dimmer_->set_focus_on_creation(false);
dimmer_view_ = new DimmerView(shelf_, disable_dimming_animations_for_test_);
dimmer_->SetContentsView(dimmer_view_);
@@ -379,11 +384,11 @@ void ShelfWidget::DelegateView::SetParentLayer(ui::Layer* layer) {
void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- gfx::ImageSkia launcher_background =
+ gfx::ImageSkia shelf_background =
*rb.GetImageSkiaNamed(IDR_AURA_LAUNCHER_BACKGROUND);
if (SHELF_ALIGNMENT_BOTTOM != shelf_->GetAlignment())
- launcher_background = gfx::ImageSkiaOperations::CreateRotatedImage(
- launcher_background,
+ shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage(
+ shelf_background,
shelf_->shelf_layout_manager()->SelectValueForShelfAlignment(
SkBitmapOperations::ROTATION_90_CW,
SkBitmapOperations::ROTATION_90_CW,
@@ -392,45 +397,59 @@ void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) {
const gfx::Rect dock_bounds(shelf_->shelf_layout_manager()->dock_bounds());
SkPaint paint;
paint.setAlpha(alpha_);
- canvas->DrawImageInt(
- launcher_background,
- 0, 0, launcher_background.width(), launcher_background.height(),
- (SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() &&
- dock_bounds.x() == 0 && dock_bounds.width() > 0) ?
- dock_bounds.width() : 0, 0,
- SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() ?
- width() - dock_bounds.width() : width(), height(),
- false,
- paint);
+ canvas->DrawImageInt(shelf_background,
+ 0,
+ 0,
+ shelf_background.width(),
+ shelf_background.height(),
+ (SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() &&
+ dock_bounds.x() == 0 && dock_bounds.width() > 0)
+ ? dock_bounds.width()
+ : 0,
+ 0,
+ SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment()
+ ? width() - dock_bounds.width()
+ : width(),
+ height(),
+ false,
+ paint);
if (SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() &&
dock_bounds.width() > 0) {
// The part of the shelf background that is in the corner below the docked
// windows close to the work area is an arched gradient that blends
// vertically oriented docked background and horizontal shelf.
- gfx::ImageSkia launcher_corner =
+ gfx::ImageSkia shelf_corner =
*rb.GetImageSkiaNamed(IDR_AURA_LAUNCHER_CORNER);
if (dock_bounds.x() == 0) {
- launcher_corner = gfx::ImageSkiaOperations::CreateRotatedImage(
- launcher_corner, SkBitmapOperations::ROTATION_90_CW);
+ shelf_corner = gfx::ImageSkiaOperations::CreateRotatedImage(
+ shelf_corner, SkBitmapOperations::ROTATION_90_CW);
}
canvas->DrawImageInt(
- launcher_corner,
- 0, 0, launcher_corner.width(), launcher_corner.height(),
+ shelf_corner,
+ 0,
+ 0,
+ shelf_corner.width(),
+ shelf_corner.height(),
dock_bounds.x() > 0 ? dock_bounds.x() : dock_bounds.width() - height(),
0,
- height(), height(),
+ height(),
+ height(),
false,
paint);
// The part of the shelf background that is just below the docked windows
// is drawn using the last (lowest) 1-pixel tall strip of the image asset.
// This avoids showing the border 3D shadow between the shelf and the dock.
- canvas->DrawImageInt(
- launcher_background,
- 0, launcher_background.height() - 1, launcher_background.width(), 1,
- dock_bounds.x() > 0 ? dock_bounds.x() + height() : 0, 0,
- dock_bounds.width() - height(), height(),
- false,
- paint);
+ canvas->DrawImageInt(shelf_background,
+ 0,
+ shelf_background.height() - 1,
+ shelf_background.width(),
+ 1,
+ dock_bounds.x() > 0 ? dock_bounds.x() + height() : 0,
+ 0,
+ dock_bounds.width() - height(),
+ height(),
+ false,
+ paint);
}
gfx::Rect black_rect =
shelf_->shelf_layout_manager()->SelectValueForShelfAlignment(
@@ -614,8 +633,8 @@ ShelfAlignment ShelfWidget::GetAlignment() const {
}
void ShelfWidget::SetAlignment(ShelfAlignment alignment) {
- if (launcher_)
- launcher_->SetAlignment(alignment);
+ if (shelf_)
+ shelf_->SetAlignment(alignment);
status_area_widget_->SetShelfAlignment(alignment);
delegate_view_->SchedulePaint();
}
@@ -624,8 +643,8 @@ void ShelfWidget::SetDimsShelf(bool dimming) {
delegate_view_->SetDimmed(dimming);
// Repaint all children, allowing updates to reflect dimmed state eg:
// status area background, app list button and overflow button.
- if (launcher_)
- launcher_->SchedulePaint();
+ if (shelf_)
+ shelf_->SchedulePaint();
status_area_widget_->GetContentsView()->SchedulePaint();
}
@@ -633,38 +652,37 @@ bool ShelfWidget::GetDimsShelf() const {
return delegate_view_->GetDimmed();
}
-void ShelfWidget::CreateLauncher() {
- if (launcher_)
+void ShelfWidget::CreateShelf() {
+ if (shelf_)
return;
Shell* shell = Shell::GetInstance();
// This needs to be called before shelf_model().
ShelfDelegate* shelf_delegate = shell->GetShelfDelegate();
if (!shelf_delegate)
- return; // Not ready to create Launcher
+ return; // Not ready to create Shelf.
- launcher_.reset(new Launcher(shell->shelf_model(),
- shell->GetShelfDelegate(),
- this));
+ shelf_.reset(
+ new Shelf(shell->shelf_model(), shell->GetShelfDelegate(), this));
SetFocusCycler(shell->focus_cycler());
// Inform the root window controller.
- internal::RootWindowController::ForWindow(window_container_)->
- OnLauncherCreated();
+ internal::RootWindowController::ForWindow(window_container_)
+ ->OnShelfCreated();
- launcher_->SetVisible(
+ shelf_->SetVisible(
shell->session_state_delegate()->IsActiveUserSessionStarted());
shelf_layout_manager_->LayoutShelf();
Show();
}
-bool ShelfWidget::IsLauncherVisible() const {
- return launcher_.get() && launcher_->IsVisible();
+bool ShelfWidget::IsShelfVisible() const {
+ return shelf_.get() && shelf_->IsVisible();
}
-void ShelfWidget::SetLauncherVisibility(bool visible) {
- if (launcher_)
- launcher_->SetVisible(visible);
+void ShelfWidget::SetShelfVisibility(bool visible) {
+ if (shelf_)
+ shelf_->SetVisible(visible);
}
void ShelfWidget::SetFocusCycler(internal::FocusCycler* focus_cycler) {
diff --git a/ash/shelf/shelf_widget.h b/ash/shelf/shelf_widget.h
index 6c9eeba..d2ff8b4 100644
--- a/ash/shelf/shelf_widget.h
+++ b/ash/shelf/shelf_widget.h
@@ -17,7 +17,7 @@ class Window;
}
namespace ash {
-class Launcher;
+class Shelf;
namespace internal {
class FocusCycler;
@@ -56,22 +56,22 @@ class ASH_EXPORT ShelfWidget : public views::Widget,
internal::ShelfLayoutManager* shelf_layout_manager() {
return shelf_layout_manager_;
}
- Launcher* launcher() const { return launcher_.get(); }
+ Shelf* shelf() const { return shelf_.get(); }
internal::StatusAreaWidget* status_area_widget() const {
return status_area_widget_;
}
- void CreateLauncher();
+ void CreateShelf();
- // Set visibility of the launcher component of the shelf.
- void SetLauncherVisibility(bool visible);
- bool IsLauncherVisible() const;
+ // Set visibility of the shelf.
+ void SetShelfVisibility(bool visible);
+ bool IsShelfVisible() const;
- // Sets the focus cycler. Also adds the launcher to the cycle.
+ // Sets the focus cycler. Also adds the shelf to the cycle.
void SetFocusCycler(internal::FocusCycler* focus_cycler);
internal::FocusCycler* GetFocusCycler();
- // Called by the activation delegate, before the launcher is activated
+ // Called by the activation delegate, before the shelf is activated
// when no other windows are visible.
void WillActivateAsFallback() { activating_as_fallback_ = true; }
@@ -105,7 +105,7 @@ class ASH_EXPORT ShelfWidget : public views::Widget,
class DelegateView;
internal::ShelfLayoutManager* shelf_layout_manager_;
- scoped_ptr<Launcher> launcher_;
+ scoped_ptr<Shelf> shelf_;
internal::StatusAreaWidget* status_area_widget_;
// delegate_view_ is attached to window_container_ and is cleaned up
diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc
index c4e9b87..9f36556 100644
--- a/ash/shelf/shelf_widget_unittest.cc
+++ b/ash/shelf/shelf_widget_unittest.cc
@@ -4,15 +4,15 @@
#include "ash/shelf/shelf_widget.h"
-#include "ash/launcher/launcher.h"
#include "ash/root_window_controller.h"
+#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_button.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_model.h"
#include "ash/shelf/shelf_view.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
-#include "ash/test/launcher_test_api.h"
+#include "ash/test/shelf_test_api.h"
#include "ash/test/shelf_view_test_api.h"
#include "ash/wm/window_util.h"
#include "ui/aura/root_window.h"
@@ -27,7 +27,7 @@ namespace ash {
namespace {
ShelfWidget* GetShelfWidget() {
- return Launcher::ForPrimaryDisplay()->shelf_widget();
+ return Shelf::ForPrimaryDisplay()->shelf_widget();
}
internal::ShelfLayoutManager* GetShelfLayoutManager() {
@@ -43,8 +43,8 @@ typedef test::AshTestBase ShelfWidgetTest;
// TODO(mtomasz): make this test work with the FocusController.
// crbug.com/285364.
TEST_F(ShelfWidgetTest, DISABLED_ActivateAsFallback) {
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- ShelfWidget* shelf_widget = launcher->shelf_widget();
+ Shelf* shelf = Shelf::ForPrimaryDisplay();
+ ShelfWidget* shelf_widget = shelf->shelf_widget();
EXPECT_FALSE(shelf_widget->CanActivate());
shelf_widget->WillActivateAsFallback();
@@ -64,9 +64,9 @@ void TestLauncherAlignment(aura::Window* root,
}
TEST_F(ShelfWidgetTest, TestAlignment) {
- Launcher* launcher = Launcher::ForPrimaryDisplay();
+ Shelf* shelf = Shelf::ForPrimaryDisplay();
UpdateDisplay("400x400");
- ASSERT_TRUE(launcher);
+ ASSERT_TRUE(shelf);
{
SCOPED_TRACE("Single Bottom");
TestLauncherAlignment(Shell::GetPrimaryRootWindow(),
@@ -128,11 +128,11 @@ TEST_F(ShelfWidgetTest, TestAlignment) {
}
}
-// Makes sure the launcher is initially sized correctly.
+// Makes sure the shelf is initially sized correctly.
TEST_F(ShelfWidgetTest, LauncherInitiallySized) {
ShelfWidget* shelf_widget = GetShelfWidget();
- Launcher* launcher = shelf_widget->launcher();
- ASSERT_TRUE(launcher);
+ Shelf* shelf = shelf_widget->shelf();
+ ASSERT_TRUE(shelf);
internal::ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager();
ASSERT_TRUE(shelf_layout_manager);
ASSERT_TRUE(shelf_widget->status_area_widget());
@@ -141,11 +141,11 @@ TEST_F(ShelfWidgetTest, LauncherInitiallySized) {
// Test only makes sense if the status is > 0, which it better be.
EXPECT_GT(status_width, 0);
EXPECT_EQ(status_width, shelf_widget->GetContentsView()->width() -
- test::LauncherTestAPI(launcher).shelf_view()->width());
+ test::ShelfTestAPI(shelf).shelf_view()->width());
}
// Verifies when the shell is deleted with a full screen window we don't crash.
-TEST_F(ShelfWidgetTest, DontReferenceLauncherAfterDeletion) {
+TEST_F(ShelfWidgetTest, DontReferenceShelfAfterDeletion) {
views::Widget* widget = new views::Widget;
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
params.bounds = gfx::Rect(0, 0, 200, 200);
@@ -156,38 +156,38 @@ TEST_F(ShelfWidgetTest, DontReferenceLauncherAfterDeletion) {
}
#if defined(OS_CHROMEOS)
-// Verifies launcher is created with correct size after user login and when its
+// Verifies shelf is created with correct size after user login and when its
// container and status widget has finished sizing.
// See http://crbug.com/252533
-TEST_F(ShelfWidgetTest, LauncherInitiallySizedAfterLogin) {
+TEST_F(ShelfWidgetTest, ShelfInitiallySizedAfterLogin) {
SetUserLoggedIn(false);
UpdateDisplay("300x200,400x300");
- ShelfWidget* shelf = NULL;
+ ShelfWidget* shelf_widget = NULL;
Shell::RootWindowControllerList controllers(
Shell::GetAllRootWindowControllers());
for (Shell::RootWindowControllerList::const_iterator i = controllers.begin();
i != controllers.end();
++i) {
- if (!(*i)->shelf()->launcher()) {
- shelf = (*i)->shelf();
+ if (!(*i)->shelf()->shelf()) {
+ shelf_widget = (*i)->shelf();
break;
}
}
- ASSERT_TRUE(shelf != NULL);
+ ASSERT_TRUE(shelf_widget != NULL);
SetUserLoggedIn(true);
- Shell::GetInstance()->CreateLauncher();
+ Shell::GetInstance()->CreateShelf();
- Launcher* launcher = shelf->launcher();
- ASSERT_TRUE(launcher != NULL);
+ Shelf* shelf = shelf_widget->shelf();
+ ASSERT_TRUE(shelf != NULL);
const int status_width =
- shelf->status_area_widget()->GetWindowBoundsInScreen().width();
+ shelf_widget->status_area_widget()->GetWindowBoundsInScreen().width();
EXPECT_GT(status_width, 0);
EXPECT_EQ(status_width,
- shelf->GetContentsView()->width() -
- test::LauncherTestAPI(launcher).shelf_view()->width());
+ shelf_widget->GetContentsView()->width() -
+ test::ShelfTestAPI(shelf).shelf_view()->width());
}
#endif
diff --git a/ash/shelf/shelf_window_watcher.cc b/ash/shelf/shelf_window_watcher.cc
index b4e65e25..f297315 100644
--- a/ash/shelf/shelf_window_watcher.cc
+++ b/ash/shelf/shelf_window_watcher.cc
@@ -22,7 +22,7 @@
namespace {
// Sets LauncherItem property by using the value of |details|.
-void SetLauncherItemDetailsForLauncherItem(
+void SetShelfItemDetailsForLauncherItem(
ash::LauncherItem* item,
const ash::LauncherItemDetails& details) {
item->type = details.type;
@@ -87,7 +87,7 @@ void ShelfWindowWatcher::AddLauncherItem(aura::Window* window) {
LauncherItem item;
LauncherID id = model_->next_id();
item.status = ash::wm::IsActiveWindow(window) ? STATUS_ACTIVE: STATUS_RUNNING;
- SetLauncherItemDetailsForLauncherItem(&item, *item_details);
+ SetShelfItemDetailsForLauncherItem(&item, *item_details);
SetLauncherIDForWindow(id, window);
scoped_ptr<ShelfItemDelegate> item_delegate(
new ShelfWindowWatcherItemDelegate(window));
@@ -190,7 +190,7 @@ void ShelfWindowWatcher::OnWindowPropertyChanged(aura::Window* window,
LauncherItem item = model_->items()[index];
const LauncherItemDetails* details =
GetLauncherItemDetailsForWindow(window);
- SetLauncherItemDetailsForLauncherItem(&item, *details);
+ SetShelfItemDetailsForLauncherItem(&item, *details);
model_->Set(index, item);
return;
}
diff --git a/ash/shelf/shelf_window_watcher_unittest.cc b/ash/shelf/shelf_window_watcher_unittest.cc
index 1217aae..3982c76 100644
--- a/ash/shelf/shelf_window_watcher_unittest.cc
+++ b/ash/shelf/shelf_window_watcher_unittest.cc
@@ -33,11 +33,11 @@ class ShelfWindowWatcherTest : public test::AshTestBase {
test::AshTestBase::TearDown();
}
- ash::LauncherID CreateLauncherItem(aura::Window* window) {
+ ash::LauncherID CreateShelfItem(aura::Window* window) {
LauncherID id = model_->next_id();
ash::LauncherItemDetails item_details;
item_details.type = TYPE_PLATFORM_APP;
- SetLauncherItemDetailsForWindow(window, item_details);
+ SetShelfItemDetailsForWindow(window, item_details);
return id;
}
@@ -59,26 +59,26 @@ TEST_F(ShelfWindowWatcherTest, CreateAndRemoveLauncherItem) {
scoped_ptr<aura::Window> w2(CreateTestWindowInShellWithId(0));
// Create a LauncherItem for w1.
- LauncherID id_w1 = CreateLauncherItem(w1.get());
+ LauncherID id_w1 = CreateShelfItem(w1.get());
EXPECT_EQ(2, model_->item_count());
int index_w1 = model_->ItemIndexByID(id_w1);
EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status);
// Create a LauncherItem for w2.
- LauncherID id_w2 = CreateLauncherItem(w2.get());
+ LauncherID id_w2 = CreateShelfItem(w2.get());
EXPECT_EQ(3, model_->item_count());
int index_w2 = model_->ItemIndexByID(id_w2);
EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w2].status);
// LauncherItem is removed when assoicated window is destroyed.
- ClearLauncherItemDetailsForWindow(w1.get());
+ ClearShelfItemDetailsForWindow(w1.get());
EXPECT_EQ(2, model_->item_count());
- ClearLauncherItemDetailsForWindow(w2.get());
+ ClearShelfItemDetailsForWindow(w2.get());
EXPECT_EQ(1, model_->item_count());
// Clears twice doesn't do anything.
- ClearLauncherItemDetailsForWindow(w2.get());
+ ClearShelfItemDetailsForWindow(w2.get());
EXPECT_EQ(1, model_->item_count());
}
@@ -90,13 +90,13 @@ TEST_F(ShelfWindowWatcherTest, ActivateWindow) {
scoped_ptr<aura::Window> w2(CreateTestWindowInShellWithId(0));
// Create a LauncherItem for w1.
- LauncherID id_w1 = CreateLauncherItem(w1.get());
+ LauncherID id_w1 = CreateShelfItem(w1.get());
EXPECT_EQ(2, model_->item_count());
int index_w1 = model_->ItemIndexByID(id_w1);
EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status);
// Create a LauncherItem for w2.
- LauncherID id_w2 = CreateLauncherItem(w2.get());
+ LauncherID id_w2 = CreateShelfItem(w2.get());
EXPECT_EQ(3, model_->item_count());
int index_w2 = model_->ItemIndexByID(id_w2);
EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status);
@@ -119,7 +119,7 @@ TEST_F(ShelfWindowWatcherTest, UpdateWindowProperty) {
scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
// Create a LauncherItem for |window|.
- LauncherID id = CreateLauncherItem(window.get());
+ LauncherID id = CreateShelfItem(window.get());
EXPECT_EQ(2, model_->item_count());
int index = model_->ItemIndexByID(id);
@@ -129,7 +129,7 @@ TEST_F(ShelfWindowWatcherTest, UpdateWindowProperty) {
LauncherItemDetails details;
details.type = TYPE_PLATFORM_APP;
- SetLauncherItemDetailsForWindow(window.get(), details);
+ SetShelfItemDetailsForWindow(window.get(), details);
// No new item is created after updating a launcher item.
EXPECT_EQ(2, model_->item_count());
// index and id are not changed after updating a launcher item.
@@ -145,7 +145,7 @@ TEST_F(ShelfWindowWatcherTest, MaximizeAndRestoreWindow) {
wm::WindowState* window_state = wm::GetWindowState(window.get());
// Create a LauncherItem for |window|.
- LauncherID id = CreateLauncherItem(window.get());
+ LauncherID id = CreateShelfItem(window.get());
EXPECT_EQ(2, model_->item_count());
int index = model_->ItemIndexByID(id);