summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-07 03:53:33 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-07 03:53:33 +0000
commit7841e11729ccad81685e9a43bd4f1fe817c6ece6 (patch)
tree1d468a88789838bcf86a8690fbc1aa85ed125a11 /ash
parent21cb28a3306ee9b5103089c961e837ac1cb88a0f (diff)
downloadchromium_src-7841e11729ccad81685e9a43bd4f1fe817c6ece6.zip
chromium_src-7841e11729ccad81685e9a43bd4f1fe817c6ece6.tar.gz
chromium_src-7841e11729ccad81685e9a43bd4f1fe817c6ece6.tar.bz2
ash: Extract Observer out of ShelfLayoutManager.
- Moves it into its own header file. - Add virtual destructor. - Moves it out of internal namespace. BUG=223936 TEST=Nope, this is just a simple clean up, no functionality intended. R=jamescook@chromium.org,sadrul@chromium.org Review URL: https://chromiumcodereview.appspot.com/14562008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash.gyp1
-rw-r--r--ash/launcher/launcher_tooltip_manager.h7
-rw-r--r--ash/shelf/shelf_layout_manager.cc20
-rw-r--r--ash/shelf/shelf_layout_manager.h25
-rw-r--r--ash/shelf/shelf_layout_manager_observer.h32
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc3
-rw-r--r--ash/wm/panels/panel_layout_manager.cc3
-rw-r--r--ash/wm/panels/panel_layout_manager.h7
8 files changed, 60 insertions, 38 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 533ff26..14ab367 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -171,6 +171,7 @@
'shelf/background_animator.h',
'shelf/shelf_layout_manager.cc',
'shelf/shelf_layout_manager.h',
+ 'shelf/shelf_layout_manager_observer.h',
'shelf/shelf_types.h',
'shelf/shelf_widget.cc',
'shelf/shelf_widget.h',
diff --git a/ash/launcher/launcher_tooltip_manager.h b/ash/launcher/launcher_tooltip_manager.h
index a880713..b4cd20b 100644
--- a/ash/launcher/launcher_tooltip_manager.h
+++ b/ash/launcher/launcher_tooltip_manager.h
@@ -6,7 +6,7 @@
#define ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_
#include "ash/ash_export.h"
-#include "ash/shelf/shelf_layout_manager.h"
+#include "ash/shelf/shelf_layout_manager_observer.h"
#include "ash/shelf/shelf_types.h"
#include "base/basictypes.h"
#include "base/string16.h"
@@ -32,11 +32,12 @@ class LauncherViewTest;
namespace internal {
class LauncherView;
+class ShelfLayoutManager;
// LauncherTooltipManager manages the tooltip balloon poping up on launcher
// items.
class ASH_EXPORT LauncherTooltipManager : public ui::EventHandler,
- public ShelfLayoutManager::Observer {
+ public ShelfLayoutManagerObserver {
public:
LauncherTooltipManager(ShelfLayoutManager* shelf_layout_manager,
LauncherView* launcher_view);
@@ -79,7 +80,7 @@ protected:
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE;
- // ShelfLayoutManager::Observer overrides:
+ // ShelfLayoutManagerObserver overrides:
virtual void WillDeleteShelf() OVERRIDE;
virtual void WillChangeVisibilityState(
ShelfVisibilityState new_state) OVERRIDE;
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 4cb6af1..5eb491a 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -13,6 +13,7 @@
#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/session_state_delegate.h"
+#include "ash/shelf/shelf_layout_manager_observer.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
@@ -181,7 +182,7 @@ ShelfLayoutManager::~ShelfLayoutManager() {
if (update_shelf_observer_)
update_shelf_observer_->Detach();
- FOR_EACH_OBSERVER(Observer, observers_, WillDeleteShelf());
+ FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf());
Shell::GetInstance()->RemoveShellObserver(this);
aura::client::GetActivationClient(root_window_)->RemoveObserver(this);
}
@@ -191,9 +192,9 @@ void ShelfLayoutManager::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) {
return;
auto_hide_behavior_ = behavior;
UpdateVisibilityState();
- FOR_EACH_OBSERVER(Observer, observers_,
+ FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
OnAutoHideStateChanged(state_.auto_hide_state));
- FOR_EACH_OBSERVER(Observer, observers_,
+ FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
OnAutoHideBehaviorChanged(auto_hide_behavior_));
}
@@ -325,7 +326,7 @@ void ShelfLayoutManager::UpdateAutoHideState() {
if (auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) {
// Hides happen immediately.
SetState(state_.visibility_state);
- FOR_EACH_OBSERVER(Observer, observers_,
+ FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
OnAutoHideStateChanged(auto_hide_state));
} else {
auto_hide_timer_.Stop();
@@ -333,8 +334,9 @@ void ShelfLayoutManager::UpdateAutoHideState() {
FROM_HERE,
base::TimeDelta::FromMilliseconds(kAutoHideDelayMS),
this, &ShelfLayoutManager::UpdateAutoHideStateNow);
- FOR_EACH_OBSERVER(Observer, observers_, OnAutoHideStateChanged(
- CalculateAutoHideState(state_.visibility_state)));
+ FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
+ OnAutoHideStateChanged(
+ CalculateAutoHideState(state_.visibility_state)));
}
} else {
auto_hide_timer_.Stop();
@@ -346,11 +348,11 @@ void ShelfLayoutManager::SetWindowOverlapsShelf(bool value) {
UpdateShelfBackground(BackgroundAnimator::CHANGE_ANIMATE);
}
-void ShelfLayoutManager::AddObserver(Observer* observer) {
+void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) {
observers_.AddObserver(observer);
}
-void ShelfLayoutManager::RemoveObserver(Observer* observer) {
+void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) {
observers_.RemoveObserver(observer);
}
@@ -549,7 +551,7 @@ void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) {
if (state_.Equals(state))
return; // Nothing changed.
- FOR_EACH_OBSERVER(Observer, observers_,
+ FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
WillChangeVisibilityState(visibility_state));
if (state.visibility_state == SHELF_AUTO_HIDE) {
diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h
index ea86f15..d074e65 100644
--- a/ash/shelf/shelf_layout_manager.h
+++ b/ash/shelf/shelf_layout_manager.h
@@ -33,6 +33,7 @@ class GestureEvent;
namespace ash {
class ScreenAsh;
+class ShelfLayoutManagerObserver;
class ShelfWidget;
namespace internal {
@@ -54,24 +55,6 @@ class ASH_EXPORT ShelfLayoutManager :
public keyboard::KeyboardControllerObserver {
public:
- // TODO(rharrison): Move this observer out of ash::internal::
- // namespace. Tracked in crosbug.com/223936
- class ASH_EXPORT Observer {
- public:
- // Called when the target ShelfLayoutManager will be deleted.
- virtual void WillDeleteShelf() {}
-
- // Called when the visibility change is scheduled.
- virtual void WillChangeVisibilityState(ShelfVisibilityState new_state) {}
-
- // Called when the auto hide state is changed.
- virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) {}
-
- // Called when the auto hide behavior is changed.
- virtual void OnAutoHideBehaviorChanged(
- ShelfAutoHideBehavior new_behavior) {}
- };
-
// We reserve a small area on the edge of the workspace area to ensure that
// the resize handle at the edge of the window can be hit.
static const int kWorkspaceAreaVisibleInset;
@@ -140,8 +123,8 @@ class ASH_EXPORT ShelfLayoutManager :
void SetWindowOverlapsShelf(bool value);
bool window_overlaps_shelf() const { return window_overlaps_shelf_; }
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
+ void AddObserver(ShelfLayoutManagerObserver* observer);
+ void RemoveObserver(ShelfLayoutManagerObserver* observer);
// Gesture dragging related functions:
void StartGestureDrag(const ui::GestureEvent& gesture);
@@ -327,7 +310,7 @@ class ASH_EXPORT ShelfLayoutManager :
// trigger showing the launcher.
scoped_ptr<AutoHideEventFilter> event_filter_;
- ObserverList<Observer> observers_;
+ ObserverList<ShelfLayoutManagerObserver> observers_;
// The shelf reacts to gesture-drags, and can be set to auto-hide for certain
// gestures. Some shelf behaviour (e.g. visibility state, background color
diff --git a/ash/shelf/shelf_layout_manager_observer.h b/ash/shelf/shelf_layout_manager_observer.h
new file mode 100644
index 0000000..120238b
--- /dev/null
+++ b/ash/shelf/shelf_layout_manager_observer.h
@@ -0,0 +1,32 @@
+// 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_LAYOUT_MANAGER_OBSERVER_H_
+#define ASH_SHELF_SHELF_LAYOUT_MANAGER_OBSERVER_H_
+
+#include "ash/ash_export.h"
+#include "ash/shelf/shelf_types.h"
+
+namespace ash {
+
+class ASH_EXPORT ShelfLayoutManagerObserver {
+ public:
+ virtual ~ShelfLayoutManagerObserver() {}
+
+ // Called when the target ShelfLayoutManager will be deleted.
+ virtual void WillDeleteShelf() {}
+
+ // Called when the visibility change is scheduled.
+ virtual void WillChangeVisibilityState(ShelfVisibilityState new_state) {}
+
+ // Called when the auto hide state is changed.
+ virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) {}
+
+ // Called when the auto hide behavior is changed.
+ virtual void OnAutoHideBehaviorChanged(ShelfAutoHideBehavior new_behavior) {}
+};
+
+} // namespace ash
+
+#endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_OBSERVER_H_
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index 10cf1d0..4cf3a60 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -14,6 +14,7 @@
#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/session_state_delegate.h"
+#include "ash/shelf/shelf_layout_manager_observer.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
@@ -143,7 +144,7 @@ class ShelfDragCallback {
DISALLOW_COPY_AND_ASSIGN(ShelfDragCallback);
};
-class ShelfLayoutObserverTest : public ShelfLayoutManager::Observer {
+class ShelfLayoutObserverTest : public ShelfLayoutManagerObserver {
public:
ShelfLayoutObserverTest()
: changed_auto_hide_state_(false) {
diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc
index d28b77c..c4ccd11 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -9,6 +9,7 @@
#include "ash/launcher/launcher.h"
#include "ash/screen_ash.h"
+#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_types.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
@@ -463,7 +464,7 @@ void PanelLayoutManager::OnWindowActivated(aura::Window* gained_active,
}
////////////////////////////////////////////////////////////////////////////////
-// PanelLayoutManager, ShelfLayoutManager::Observer implementation:
+// PanelLayoutManager, ShelfLayoutManagerObserver implementation:
void PanelLayoutManager::WillChangeVisibilityState(
ShelfVisibilityState new_state) {
diff --git a/ash/wm/panels/panel_layout_manager.h b/ash/wm/panels/panel_layout_manager.h
index 7407bd9..fd0bc5c 100644
--- a/ash/wm/panels/panel_layout_manager.h
+++ b/ash/wm/panels/panel_layout_manager.h
@@ -9,7 +9,7 @@
#include "ash/ash_export.h"
#include "ash/launcher/launcher_icon_observer.h"
-#include "ash/shelf/shelf_layout_manager.h"
+#include "ash/shelf/shelf_layout_manager_observer.h"
#include "ash/shell_observer.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -38,6 +38,7 @@ class Launcher;
namespace internal {
class PanelCalloutWidget;
+class ShelfLayoutManager;
// PanelLayoutManager is responsible for organizing panels within the
// workspace. It is associated with a specific container window (i.e.
@@ -55,7 +56,7 @@ class ASH_EXPORT PanelLayoutManager
public aura::WindowObserver,
public aura::client::ActivationChangeObserver,
public keyboard::KeyboardControllerObserver,
- public ShelfLayoutManager::Observer {
+ public ShelfLayoutManagerObserver {
public:
explicit PanelLayoutManager(aura::Window* panel_container);
virtual ~PanelLayoutManager();
@@ -98,7 +99,7 @@ class ASH_EXPORT PanelLayoutManager
virtual void OnWindowActivated(aura::Window* gained_active,
aura::Window* lost_active) OVERRIDE;
- // Overridden from ShelfLayoutManager::Observer
+ // Overridden from ShelfLayoutManagerObserver
virtual void WillChangeVisibilityState(
ShelfVisibilityState new_state) OVERRIDE;