Commit ef80e430 authored by oshima@chromium.org's avatar oshima@chromium.org

Cleanup enums for shelf

- move enums from ShelfLayoutManager to shelf_types.h
- remove redundant VisibilityState
- added SHELF_ prefix to these state.

BUG=151417
TEST=none

Review URL: https://chromiumcodereview.appspot.com/11316323

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171024 0039d316-1c4b-4281-b951-d872f2087c98
parent 5bb6f3c5
...@@ -151,6 +151,7 @@ ...@@ -151,6 +151,7 @@
'shell.h', 'shell.h',
'shell_delegate.h', 'shell_delegate.h',
'shell_factory.h', 'shell_factory.h',
'shelf_types.h',
'shell_window_ids.h', 'shell_window_ids.h',
'system/audio/audio_observer.h', 'system/audio/audio_observer.h',
'system/audio/tray_volume.cc', 'system/audio/tray_volume.cc',
...@@ -353,7 +354,6 @@ ...@@ -353,7 +354,6 @@
'wm/session_state_observer.h', 'wm/session_state_observer.h',
'wm/shelf_layout_manager.cc', 'wm/shelf_layout_manager.cc',
'wm/shelf_layout_manager.h', 'wm/shelf_layout_manager.h',
'wm/shelf_types.h',
'wm/stacking_controller.cc', 'wm/stacking_controller.cc',
'wm/stacking_controller.h', 'wm/stacking_controller.h',
'wm/status_area_layout_manager.cc', 'wm/status_area_layout_manager.cc',
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/launcher/background_animator.h" #include "ash/launcher/background_animator.h"
#include "ash/launcher/launcher_types.h" #include "ash/launcher/launcher_types.h"
#include "ash/wm/shelf_types.h" #include "ash/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "ui/gfx/size.h" #include "ui/gfx/size.h"
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#include "ash/launcher/launcher_alignment_menu.h" #include "ash/launcher/launcher_alignment_menu.h"
#include "ash/shelf_types.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/shelf_types.h"
#include "grit/ash_strings.h" #include "grit/ash_strings.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define ASH_LAUNCHER_LAUNCHER_BUTTON_HOST_H_ #define ASH_LAUNCHER_LAUNCHER_BUTTON_HOST_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/wm/shelf_types.h" #include "ash/shelf_types.h"
#include "base/string16.h" #include "base/string16.h"
namespace ui { namespace ui {
......
...@@ -322,16 +322,16 @@ void LauncherTooltipManager::WillDeleteShelf() { ...@@ -322,16 +322,16 @@ void LauncherTooltipManager::WillDeleteShelf() {
} }
void LauncherTooltipManager::WillChangeVisibilityState( void LauncherTooltipManager::WillChangeVisibilityState(
ShelfLayoutManager::VisibilityState new_state) { ShelfVisibilityState new_state) {
if (new_state == ShelfLayoutManager::HIDDEN) { if (new_state == SHELF_HIDDEN) {
StopTimer(); StopTimer();
Close(); Close();
} }
} }
void LauncherTooltipManager::OnAutoHideStateChanged( void LauncherTooltipManager::OnAutoHideStateChanged(
ShelfLayoutManager::AutoHideState new_state) { ShelfAutoHideState new_state) {
if (new_state == ShelfLayoutManager::AUTO_HIDE_HIDDEN) { if (new_state == SHELF_AUTO_HIDE_HIDDEN) {
StopTimer(); StopTimer();
// AutoHide state change happens during an event filter, so immediate close // AutoHide state change happens during an event filter, so immediate close
// may cause a crash in the HandleMouseEvent() after the filter. So we just // may cause a crash in the HandleMouseEvent() after the filter. So we just
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#define ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_ #define ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shelf_types.h"
#include "ash/wm/session_state_observer.h" #include "ash/wm/session_state_observer.h"
#include "ash/wm/shelf_layout_manager.h" #include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/string16.h" #include "base/string16.h"
#include "ui/base/events/event_handler.h" #include "ui/base/events/event_handler.h"
...@@ -84,9 +84,8 @@ protected: ...@@ -84,9 +84,8 @@ protected:
// ShelfLayoutManager::Observer overrides: // ShelfLayoutManager::Observer overrides:
virtual void WillDeleteShelf() OVERRIDE; virtual void WillDeleteShelf() OVERRIDE;
virtual void WillChangeVisibilityState( virtual void WillChangeVisibilityState(
ShelfLayoutManager::VisibilityState new_state) OVERRIDE; ShelfVisibilityState new_state) OVERRIDE;
virtual void OnAutoHideStateChanged( virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) OVERRIDE;
ShelfLayoutManager::AutoHideState new_state) OVERRIDE;
private: private:
class LauncherTooltipBubble; class LauncherTooltipBubble;
......
...@@ -110,7 +110,7 @@ TEST_F(LauncherTooltipManagerTest, HideWhenShelfIsHidden) { ...@@ -110,7 +110,7 @@ TEST_F(LauncherTooltipManagerTest, HideWhenShelfIsHidden) {
// Once the shelf is hidden, the tooltip should be invisible. // Once the shelf is hidden, the tooltip should be invisible.
ASSERT_EQ( ASSERT_EQ(
internal::ShelfLayoutManager::HIDDEN, SHELF_HIDDEN,
Shell::GetPrimaryRootWindowController()->shelf()->visibility_state()); Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
EXPECT_FALSE(TooltipIsVisible()); EXPECT_FALSE(TooltipIsVisible());
...@@ -131,8 +131,7 @@ TEST_F(LauncherTooltipManagerTest, HideWhenShelfIsAutoHide) { ...@@ -131,8 +131,7 @@ TEST_F(LauncherTooltipManagerTest, HideWhenShelfIsAutoHide) {
Shell::GetPrimaryRootWindowController()->shelf(); Shell::GetPrimaryRootWindowController()->shelf();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
shelf->UpdateAutoHideState(); shelf->UpdateAutoHideState();
ASSERT_EQ(internal::ShelfLayoutManager::AUTO_HIDE_HIDDEN, ASSERT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
shelf->auto_hide_state());
// Tooltip visibility change for auto hide may take time. // Tooltip visibility change for auto hide may take time.
EXPECT_TRUE(TooltipIsVisible()); EXPECT_TRUE(TooltipIsVisible());
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#include "ash/launcher/launcher_button_host.h" #include "ash/launcher/launcher_button_host.h"
#include "ash/launcher/launcher_model_observer.h" #include "ash/launcher/launcher_model_observer.h"
#include "ash/shelf_types.h"
#include "ash/wm/gestures/shelf_gesture_handler.h" #include "ash/wm/gestures/shelf_gesture_handler.h"
#include "ash/wm/shelf_types.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "ui/views/animation/bounds_animator_observer.h" #include "ui/views/animation/bounds_animator_observer.h"
#include "ui/views/context_menu_controller.h" #include "ui/views/context_menu_controller.h"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef ASH_LAUNCHER_OVERFLOW_BUBBLE_H_ #ifndef ASH_LAUNCHER_OVERFLOW_BUBBLE_H_
#define ASH_LAUNCHER_OVERFLOW_BUBBLE_H_ #define ASH_LAUNCHER_OVERFLOW_BUBBLE_H_
#include "ash/wm/shelf_types.h" #include "ash/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "ui/views/widget/widget_observer.h" #include "ui/views/widget/widget_observer.h"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef ASH_LAUNCHER_OVERFLOW_BUTTON_H_ #ifndef ASH_LAUNCHER_OVERFLOW_BUTTON_H_
#define ASH_LAUNCHER_OVERFLOW_BUTTON_H_ #define ASH_LAUNCHER_OVERFLOW_BUTTON_H_
#include "ash/wm/shelf_types.h" #include "ash/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "ui/views/controls/button/custom_button.h" #include "ui/views/controls/button/custom_button.h"
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "ash/display/display_controller.h" #include "ash/display/display_controller.h"
#include "ash/display/display_manager.h" #include "ash/display/display_manager.h"
#include "ash/focus_cycler.h" #include "ash/focus_cycler.h"
#include "ash/shelf_types.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_delegate.h" #include "ash/shell_delegate.h"
#include "ash/shell_factory.h" #include "ash/shell_factory.h"
...@@ -25,7 +26,6 @@ ...@@ -25,7 +26,6 @@
#include "ash/wm/root_window_layout_manager.h" #include "ash/wm/root_window_layout_manager.h"
#include "ash/wm/screen_dimmer.h" #include "ash/wm/screen_dimmer.h"
#include "ash/wm/shelf_layout_manager.h" #include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/shelf_types.h"
#include "ash/wm/status_area_layout_manager.h" #include "ash/wm/status_area_layout_manager.h"
#include "ash/wm/system_background_controller.h" #include "ash/wm/system_background_controller.h"
#include "ash/wm/system_modal_container_layout_manager.h" #include "ash/wm/system_modal_container_layout_manager.h"
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#define ASH_ROOT_WINDOW_CONTROLLER_H_ #define ASH_ROOT_WINDOW_CONTROLLER_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shelf_types.h"
#include "ash/system/user/login_status.h" #include "ash/system/user/login_status.h"
#include "ash/wm/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_WM_SHELF_TYPES_H_ #ifndef ASH_SHELF_TYPES_H_
#define ASH_WM_SHELF_TYPES_H_ #define ASH_SHELF_TYPES_H_
namespace ash { namespace ash {
...@@ -21,6 +21,22 @@ enum ShelfAutoHideBehavior { ...@@ -21,6 +21,22 @@ enum ShelfAutoHideBehavior {
SHELF_AUTO_HIDE_BEHAVIOR_NEVER, SHELF_AUTO_HIDE_BEHAVIOR_NEVER,
}; };
enum ShelfVisibilityState {
// Always visible.
SHELF_VISIBLE,
// A couple of pixels are reserved at the bottom for the shelf.
SHELF_AUTO_HIDE,
// Nothing is shown. Used for fullscreen windows.
SHELF_HIDDEN,
};
enum ShelfAutoHideState {
SHELF_AUTO_HIDE_SHOWN,
SHELF_AUTO_HIDE_HIDDEN,
};
} // namespace ash } // namespace ash
#endif // ASH_WM_SHELF_TYPES_H_ #endif // ASH_SHELF_TYPES_H_
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#include <vector> #include <vector>
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shelf_types.h"
#include "ash/system/user/login_status.h" #include "ash/system/user/login_status.h"
#include "ash/wm/cursor_manager.h" #include "ash/wm/cursor_manager.h"
#include "ash/wm/shelf_types.h"
#include "ash/wm/system_modal_container_event_filter_delegate.h" #include "ash/wm/system_modal_container_event_filter_delegate.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "ash/launcher/launcher.h" #include "ash/launcher/launcher.h"
#include "ash/root_window_controller.h" #include "ash/root_window_controller.h"
#include "ash/shelf_types.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/shelf_types.h"
#include "grit/ash_strings.h" #include "grit/ash_strings.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define ASH_WM_SHELL_CONTEXT_MENU_H_ #define ASH_WM_SHELL_CONTEXT_MENU_H_
#include "ash/launcher/launcher_alignment_menu.h" #include "ash/launcher/launcher_alignment_menu.h"
#include "ash/wm/shelf_types.h" #include "ash/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "ui/base/models/simple_menu_model.h" #include "ui/base/models/simple_menu_model.h"
......
...@@ -318,19 +318,19 @@ TEST_F(ShellTest, FullscreenWindowHidesShelf) { ...@@ -318,19 +318,19 @@ TEST_F(ShellTest, FullscreenWindowHidesShelf) {
// Shelf defaults to visible. // Shelf defaults to visible.
EXPECT_EQ( EXPECT_EQ(
internal::ShelfLayoutManager::VISIBLE, SHELF_VISIBLE,
Shell::GetPrimaryRootWindowController()->shelf()->visibility_state()); Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
// Fullscreen window hides it. // Fullscreen window hides it.
widget->SetFullscreen(true); widget->SetFullscreen(true);
EXPECT_EQ( EXPECT_EQ(
internal::ShelfLayoutManager::HIDDEN, SHELF_HIDDEN,
Shell::GetPrimaryRootWindowController()->shelf()->visibility_state()); Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
// Restoring the window restores it. // Restoring the window restores it.
widget->Restore(); widget->Restore();
EXPECT_EQ( EXPECT_EQ(
internal::ShelfLayoutManager::VISIBLE, SHELF_VISIBLE,
Shell::GetPrimaryRootWindowController()->shelf()->visibility_state()); Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
// Clean up. // Clean up.
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/launcher/background_animator.h" #include "ash/launcher/background_animator.h"
#include "ash/shelf_types.h"
#include "ash/system/user/login_status.h" #include "ash/system/user/login_status.h"
#include "ash/wm/shelf_types.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace ash { namespace ash {
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#define ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ #define ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shelf_types.h"
#include "ash/wm/gestures/shelf_gesture_handler.h" #include "ash/wm/gestures/shelf_gesture_handler.h"
#include "ash/wm/shelf_types.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#include "ui/views/accessible_pane_view.h" #include "ui/views/accessible_pane_view.h"
#include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_delegate.h"
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#define ASH_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shelf_types.h"
#include "ash/system/user/login_status.h" #include "ash/system/user/login_status.h"
#include "ash/wm/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/launcher/background_animator.h" #include "ash/launcher/background_animator.h"
#include "ash/shelf_types.h"
#include "ash/system/tray/tray_views.h" #include "ash/system/tray/tray_views.h"
#include "ash/wm/shelf_types.h"
#include "ui/views/bubble/tray_bubble_view.h" #include "ui/views/bubble/tray_bubble_view.h"
namespace ash { namespace ash {
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
#include "ash/system/tray/tray_item_view.h" #include "ash/system/tray/tray_item_view.h"
#include "ash/shelf_types.h"
#include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_item.h" #include "ash/system/tray/system_tray_item.h"
#include "ash/wm/shelf_types.h"
#include "ui/base/animation/slide_animation.h" #include "ui/base/animation/slide_animation.h"
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/wm/shelf_types.h" #include "ash/shelf_types.h"
#include "ui/gfx/font.h" #include "ui/gfx/font.h"
#include "ui/gfx/size.h" #include "ui/gfx/size.h"
#include "ui/views/controls/button/custom_button.h" #include "ui/views/controls/button/custom_button.h"
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
#include "ash/wm/gestures/shelf_gesture_handler.h" #include "ash/wm/gestures/shelf_gesture_handler.h"
#include "ash/root_window_controller.h" #include "ash/root_window_controller.h"
#include "ash/shelf_types.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_delegate.h" #include "ash/shell_delegate.h"
#include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget.h"
#include "ash/wm/gestures/tray_gesture_handler.h" #include "ash/wm/gestures/tray_gesture_handler.h"
#include "ash/wm/shelf_layout_manager.h" #include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/shelf_types.h"
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
......
This diff is collapsed.
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/launcher/launcher.h" #include "ash/launcher/launcher.h"
#include "ash/shelf_types.h"
#include "ash/shell_observer.h" #include "ash/shell_observer.h"
#include "ash/wm/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/observer_list.h" #include "base/observer_list.h"
...@@ -45,32 +45,16 @@ class ASH_EXPORT ShelfLayoutManager : ...@@ -45,32 +45,16 @@ class ASH_EXPORT ShelfLayoutManager :
public ash::ShellObserver, public ash::ShellObserver,
public views::corewm::ActivationChangeShim { public views::corewm::ActivationChangeShim {
public: public:
enum VisibilityState {
// Completely visible.
VISIBLE,
// A couple of pixels are reserved at the bottom for the shelf.
AUTO_HIDE,
// Nothing is shown. Used for fullscreen windows.
HIDDEN,
};
enum AutoHideState {
AUTO_HIDE_SHOWN,
AUTO_HIDE_HIDDEN,
};
class ASH_EXPORT Observer { class ASH_EXPORT Observer {
public: public:
// Called when the target ShelfLayoutManager will be deleted. // Called when the target ShelfLayoutManager will be deleted.
virtual void WillDeleteShelf() {} virtual void WillDeleteShelf() {}
// Called when the visibility change is scheduled. // Called when the visibility change is scheduled.
virtual void WillChangeVisibilityState(VisibilityState new_state) {} virtual void WillChangeVisibilityState(ShelfVisibilityState new_state) {}
// Called when the auto hide state is changed. // Called when the auto hide state is changed.
virtual void OnAutoHideStateChanged(AutoHideState new_state) {} virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) {}
}; };
// We reserve a small area at the bottom of the workspace area to ensure that // We reserve a small area at the bottom of the workspace area to ensure that
...@@ -129,8 +113,10 @@ class ASH_EXPORT ShelfLayoutManager : ...@@ -129,8 +113,10 @@ class ASH_EXPORT ShelfLayoutManager :
// Invoked by the shelf/launcher when the auto-hide state may have changed. // Invoked by the shelf/launcher when the auto-hide state may have changed.
void UpdateAutoHideState(); void UpdateAutoHideState();
VisibilityState visibility_state() const { return state_.visibility_state; } ShelfVisibilityState visibility_state() const {
AutoHideState auto_hide_state() const { return state_.auto_hide_state; } return state_.visibility_state;
}
ShelfAutoHideState auto_hide_state() const { return state_.auto_hide_state; }
// Sets whether any windows overlap the shelf. If a window overlaps the shelf // Sets whether any windows overlap the shelf. If a window overlaps the shelf
// the shelf renders slightly differently. // the shelf renders slightly differently.
...@@ -186,27 +172,28 @@ class ASH_EXPORT ShelfLayoutManager : ...@@ -186,27 +172,28 @@ class ASH_EXPORT ShelfLayoutManager :
}; };
struct State { struct State {
State() : visibility_state(VISIBLE), State() : visibility_state(SHELF_VISIBLE),
auto_hide_state(AUTO_HIDE_HIDDEN), auto_hide_state(SHELF_AUTO_HIDE_HIDDEN),
is_screen_locked(false) {} is_screen_locked(false) {}
// Returns true if the two states are considered equal. As // Returns true if the two states are considered equal. As
// |auto_hide_state| only matters if |visibility_state| is |AUTO_HIDE|, // |auto_hide_state| only matters if |visibility_state| is
// Equals() ignores the |auto_hide_state| as appropriate. // |SHELF_AUTO_HIDE|, Equals() ignores the |auto_hide_state| as
// appropriate.
bool Equals(const State& other) const { bool Equals(const State& other) const {
return other.visibility_state == visibility_state && return other.visibility_state == visibility_state &&
(visibility_state != AUTO_HIDE || (visibility_state != SHELF_AUTO_HIDE ||
other.auto_hide_state == auto_hide_state) && other.auto_hide_state == auto_hide_state) &&
other.is_screen_locked == is_screen_locked; other.is_screen_locked == is_screen_locked;
} }
VisibilityState visibility_state; ShelfVisibilityState visibility_state;
AutoHideState auto_hide_state; ShelfAutoHideState auto_hide_state;
bool is_screen_locked; bool is_screen_locked;
}; };
// Sets the visibility of the shelf to |state|. // Sets the visibility of the shelf to |state|.
void SetState(VisibilityState visibility_state); void SetState(ShelfVisibilityState visibility_state);
// Stops any animations. // Stops any animations.
void StopAnimating(); void StopAnimating();
...@@ -236,7 +223,8 @@ class ASH_EXPORT ShelfLayoutManager : ...@@ -236,7 +223,8 @@ class ASH_EXPORT ShelfLayoutManager :
// Returns the AutoHideState. This value is determined from the launcher and // Returns the AutoHideState. This value is determined from the launcher and
// tray. // tray.
AutoHideState CalculateAutoHideState(VisibilityState visibility_state) const; ShelfAutoHideState CalculateAutoHideState(
ShelfVisibilityState visibility_state) const;
// Updates the hit test bounds override for launcher and status area. // Updates the hit test bounds override for launcher and status area.
void UpdateHitTestBounds(); void UpdateHitTestBounds();
...@@ -299,7 +287,7 @@ class ASH_EXPORT ShelfLayoutManager : ...@@ -299,7 +287,7 @@ class ASH_EXPORT ShelfLayoutManager :
float gesture_drag_amount_; float gesture_drag_amount_;
// Manage the auto-hide state during the gesture. // Manage the auto-hide state during the gesture.
AutoHideState gesture_drag_auto_hide_state_; ShelfAutoHideState gesture_drag_auto_hide_state_;
// Used to delay updating shelf background. // Used to delay updating shelf background.
UpdateShelfObserver* update_shelf_observer_; UpdateShelfObserver* update_shelf_observer_;
......
This diff is collapsed.
...@@ -486,25 +486,25 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) { ...@@ -486,25 +486,25 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
w1->Show(); w1->Show();
wm::ActivateWindow(w1.get()); wm::ActivateWindow(w1.get());
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
// Maximize the window. // Maximize the window.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
// Restore. // Restore.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
// Fullscreen. // Fullscreen.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
// Normal. // Normal.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
EXPECT_FALSE(GetWindowOverlapsShelf()); EXPECT_FALSE(GetWindowOverlapsShelf());
...@@ -518,12 +518,12 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) { ...@@ -518,12 +518,12 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
// Maximize again. // Maximize again.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
// Minimize. // Minimize.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
// Since the restore from minimize will restore to the pre-minimize // Since the restore from minimize will restore to the pre-minimize
// state (tested elsewhere), we abandon the current size and restore // state (tested elsewhere), we abandon the current size and restore
...@@ -536,7 +536,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) { ...@@ -536,7 +536,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
// Restore. // Restore.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
// Create another window, maximized. // Create another window, maximized.
...@@ -546,14 +546,14 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) { ...@@ -546,14 +546,14 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
w2->Show(); w2->Show();
wm::ActivateWindow(w2.get()); wm::ActivateWindow(w2.get());
EXPECT_EQ(1, active_index()); EXPECT_EQ(1, active_index());
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
// Switch to w1. // Switch to w1.
wm::ActivateWindow(w1.get()); wm::ActivateWindow(w1.get());
EXPECT_EQ(0, active_index()); EXPECT_EQ(0, active_index());
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent( EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(
w2->parent()).ToString(), w2->parent()).ToString(),
...@@ -562,8 +562,8 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) { ...@@ -562,8 +562,8 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
// Switch to w2. // Switch to w2.
wm::ActivateWindow(w2.get()); wm::ActivateWindow(w2.get());
EXPECT_EQ(1, active_index()); EXPECT_EQ(1, active_index());
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w2.get()).ToString(), EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w2.get()).ToString(),
w2->bounds().ToString()); w2->bounds().ToString());
...@@ -721,26 +721,26 @@ TEST_F(WorkspaceManagerTest, GetWindowStateWithUnmanagedFullscreenWindow) { ...@@ -721,26 +721,26 @@ TEST_F(WorkspaceManagerTest, GetWindowStateWithUnmanagedFullscreenWindow) {
ASSERT_EQ("1 M1 active=1", StateString()); ASSERT_EQ("1 M1 active=1", StateString());
EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState()); EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState());
w2->Hide(); w2->Hide();
ASSERT_EQ("1 P=M1 active=0", StateString()); ASSERT_EQ("1 P=M1 active=0", StateString());
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
w2->Show(); w2->Show();
ASSERT_EQ("1 P=M1 active=0", StateString()); ASSERT_EQ("1 P=M1 active=0", StateString());
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState()); EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState());
wm::ActivateWindow(w2.get()); wm::ActivateWindow(w2.get());
ASSERT_EQ("1 M1 active=1", StateString()); ASSERT_EQ("1 M1 active=1", StateString());
EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState()); EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState());
w2.reset(); w2.reset();
ASSERT_EQ("1 active=0", StateString()); ASSERT_EQ("1 active=0", StateString());
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState()); EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState());
} }
...@@ -766,21 +766,21 @@ TEST_F(WorkspaceManagerTest, ...@@ -766,21 +766,21 @@ TEST_F(WorkspaceManagerTest,
// Even though auto-hide behavior is NEVER full-screen windows cause the shelf // Even though auto-hide behavior is NEVER full-screen windows cause the shelf
// to hide. // to hide.
EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN,
manager_->GetWindowState()); manager_->GetWindowState());
w2->Hide(); w2->Hide();
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
w2->Show(); w2->Show();
wm::ActivateWindow(w2.get()); wm::ActivateWindow(w2.get());
EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN,
manager_->GetWindowState()); manager_->GetWindowState());
w2.reset(); w2.reset();
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
} }
// Verifies a window marked as persisting across all workspaces ends up in its // Verifies a window marked as persisting across all workspaces ends up in its
...@@ -812,7 +812,7 @@ TEST_F(WorkspaceManagerTest, MinimizeResetsVisibility) { ...@@ -812,7 +812,7 @@ TEST_F(WorkspaceManagerTest, MinimizeResetsVisibility) {
wm::ActivateWindow(w1.get()); wm::ActivateWindow(w1.get());
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
EXPECT_EQ(ShelfLayoutManager::VISIBLE, EXPECT_EQ(SHELF_VISIBLE,
shelf_layout_manager()->visibility_state()); shelf_layout_manager()->visibility_state());
EXPECT_FALSE(Launcher::ForPrimaryDisplay()->paints_background()); EXPECT_FALSE(Launcher::ForPrimaryDisplay()->paints_background());
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "ash/launcher/launcher_delegate.h" #include "ash/launcher/launcher_delegate.h"
#include "ash/launcher/launcher_types.h" #include "ash/launcher/launcher_types.h"
#include "ash/wm/shelf_types.h" #include "ash/shelf_types.h"
#include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_prefs.h"
class BrowserLauncherItemControllerTest; class BrowserLauncherItemControllerTest;
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "ash/launcher/launcher_model_observer.h" #include "ash/launcher/launcher_model_observer.h"
#include "ash/launcher/launcher_types.h" #include "ash/launcher/launcher_types.h"
#include "ash/shelf_types.h"
#include "ash/shell_observer.h" #include "ash/shell_observer.h"
#include "ash/wm/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include "ash/launcher/launcher_delegate.h" #include "ash/launcher/launcher_delegate.h"
#include "ash/launcher/launcher_model_observer.h" #include "ash/launcher/launcher_model_observer.h"
#include "ash/launcher/launcher_types.h" #include "ash/launcher/launcher_types.h"
#include "ash/shelf_types.h"
#include "ash/shell_observer.h" #include "ash/shell_observer.h"
#include "ash/wm/shelf_types.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment