Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(949)

Unified Diff: athena/wm/window_manager_impl.cc

Issue 478903002: athena: Add some tests for the existing wm functionalities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: athena/wm/window_manager_impl.cc
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc
index e3bb2b281d521222e130fcd69acf6e53204607fa..3dd9612467b06b42c2a23922e7f8a3189708965f 100644
--- a/athena/wm/window_manager_impl.cc
+++ b/athena/wm/window_manager_impl.cc
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "athena/wm/public/window_manager.h"
+#include "athena/wm/window_manager_impl.h"
#include <algorithm>
#include "athena/common/container_priorities.h"
-#include "athena/input/public/accelerator_manager.h"
#include "athena/screen/public/screen_manager.h"
#include "athena/wm/bezel_controller.h"
#include "athena/wm/public/window_manager_observer.h"
@@ -16,7 +15,6 @@
#include "athena/wm/window_list_provider_impl.h"
#include "athena/wm/window_overview_mode.h"
#include "base/logging.h"
-#include "base/observer_list.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/window.h"
#include "ui/wm/core/shadow_controller.h"
@@ -28,68 +26,7 @@
namespace athena {
namespace {
-class WindowManagerImpl : public WindowManager,
- public WindowOverviewModeDelegate,
- public aura::WindowObserver,
- public AcceleratorHandler,
- public TitleDragControllerDelegate {
- public:
- WindowManagerImpl();
- virtual ~WindowManagerImpl();
-
- void Layout();
-
- // WindowManager:
- virtual void ToggleOverview() OVERRIDE;
-
- virtual bool IsOverviewModeActive() OVERRIDE;
-
- private:
- enum Command {
- CMD_TOGGLE_OVERVIEW,
- };
-
- // Sets whether overview mode is active.
- void SetInOverview(bool active);
-
- void InstallAccelerators();
-
- // WindowManager:
- virtual void AddObserver(WindowManagerObserver* observer) OVERRIDE;
- virtual void RemoveObserver(WindowManagerObserver* observer) OVERRIDE;
-
- // WindowOverviewModeDelegate:
- virtual void OnSelectWindow(aura::Window* window) OVERRIDE;
- virtual void OnSplitViewMode(aura::Window* left,
- aura::Window* right) OVERRIDE;
-
- // aura::WindowObserver
- virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE;
- virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
-
- // AcceleratorHandler:
- virtual bool IsCommandEnabled(int command_id) const OVERRIDE;
- virtual bool OnAcceleratorFired(int command_id,
- const ui::Accelerator& accelerator) OVERRIDE;
-
- // TitleDragControllerDelegate:
- virtual aura::Window* GetWindowBehind(aura::Window* window) OVERRIDE;
- virtual void OnTitleDragStarted(aura::Window* window) OVERRIDE;
- virtual void OnTitleDragCompleted(aura::Window* window) OVERRIDE;
- virtual void OnTitleDragCanceled(aura::Window* window) OVERRIDE;
-
- scoped_ptr<aura::Window> container_;
- scoped_ptr<WindowListProvider> window_list_provider_;
- scoped_ptr<WindowOverviewMode> overview_;
- scoped_ptr<BezelController> bezel_controller_;
- scoped_ptr<SplitViewController> split_view_controller_;
- scoped_ptr<wm::WMState> wm_state_;
- scoped_ptr<TitleDragController> title_drag_controller_;
- scoped_ptr<wm::ShadowController> shadow_controller_;
- ObserverList<WindowManagerObserver> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl);
-};
+class WindowManagerImpl* instance = NULL;
class AthenaContainerLayoutManager : public aura::LayoutManager {
public:
@@ -110,7 +47,43 @@ class AthenaContainerLayoutManager : public aura::LayoutManager {
DISALLOW_COPY_AND_ASSIGN(AthenaContainerLayoutManager);
};
-class WindowManagerImpl* instance = NULL;
+AthenaContainerLayoutManager::AthenaContainerLayoutManager() {
+}
+
+AthenaContainerLayoutManager::~AthenaContainerLayoutManager() {
+}
+
+void AthenaContainerLayoutManager::OnWindowResized() {
+ instance->Layout();
+}
+
+void AthenaContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
+ instance->Layout();
+}
+
+void AthenaContainerLayoutManager::OnWillRemoveWindowFromLayout(
+ aura::Window* child) {
+}
+
+void AthenaContainerLayoutManager::OnWindowRemovedFromLayout(
+ aura::Window* child) {
+ instance->Layout();
+}
+
+void AthenaContainerLayoutManager::OnChildWindowVisibilityChanged(
+ aura::Window* child,
+ bool visible) {
+ instance->Layout();
+}
+
+void AthenaContainerLayoutManager::SetChildBounds(
+ aura::Window* child,
+ const gfx::Rect& requested_bounds) {
+ if (!requested_bounds.IsEmpty())
+ SetChildBoundsDirect(child, requested_bounds);
+}
+
+} // namespace
WindowManagerImpl::WindowManagerImpl() {
ScreenManager::ContainerParams params("DefaultContainer", CP_DEFAULT);
@@ -301,44 +274,6 @@ void WindowManagerImpl::OnTitleDragCanceled(aura::Window* window) {
next_window->SetTransform(gfx::Transform());
}
-AthenaContainerLayoutManager::AthenaContainerLayoutManager() {
-}
-
-AthenaContainerLayoutManager::~AthenaContainerLayoutManager() {
-}
-
-void AthenaContainerLayoutManager::OnWindowResized() {
- instance->Layout();
-}
-
-void AthenaContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
- instance->Layout();
-}
-
-void AthenaContainerLayoutManager::OnWillRemoveWindowFromLayout(
- aura::Window* child) {
-}
-
-void AthenaContainerLayoutManager::OnWindowRemovedFromLayout(
- aura::Window* child) {
- instance->Layout();
-}
-
-void AthenaContainerLayoutManager::OnChildWindowVisibilityChanged(
- aura::Window* child,
- bool visible) {
- instance->Layout();
-}
-
-void AthenaContainerLayoutManager::SetChildBounds(
- aura::Window* child,
- const gfx::Rect& requested_bounds) {
- if (!requested_bounds.IsEmpty())
- SetChildBoundsDirect(child, requested_bounds);
-}
-
-} // namespace
-
// static
WindowManager* WindowManager::Create() {
DCHECK(!instance);

Powered by Google App Engine
This is Rietveld 408576698