Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / athena / wm / split_view_controller.h
index f556b55..a0fbe16 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "athena/athena_export.h"
 #include "athena/util/drag_handle.h"
-#include "athena/wm/bezel_controller.h"
+#include "athena/wm/public/window_list_provider_observer.h"
 #include "athena/wm/public/window_manager_observer.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
@@ -29,27 +29,29 @@ class Widget;
 }
 
 namespace athena {
-class WindowListProvider;
+class SplitViewControllerTest;
+class WindowListProviderImpl;
 
 // Responsible for entering split view mode, exiting from split view mode, and
 // laying out the windows in split view mode.
 class ATHENA_EXPORT SplitViewController
-    : public BezelController::ScrollDelegate,
-      public DragHandleScrollDelegate,
-      public WindowManagerObserver {
+    : public DragHandleScrollDelegate,
+      public WindowManagerObserver,
+      public WindowListProviderObserver {
  public:
   SplitViewController(aura::Window* container,
-                      WindowListProvider* window_list_provider);
+                      WindowListProviderImpl* window_list_provider);
 
-  virtual ~SplitViewController();
+  ~SplitViewController() override;
 
   bool CanActivateSplitViewMode() const;
   bool IsSplitViewModeActive() const;
 
   // Activates split-view mode with |left| and |right| windows. If |left| and/or
-  // |right| is NULL, then the first window in the window-list (which is neither
+  // |right| is nullptr, then the first window in the window-list (which is
+  // neither
   // |left| nor |right|) is selected instead. |to_activate| indicates which of
-  // |left| or |right| should be activated. If |to_activate| is NULL, the
+  // |left| or |right| should be activated. If |to_activate| is nullptr, the
   // currently active window is kept active if it is one of the split-view
   // windows.
   void ActivateSplitMode(aura::Window* left,
@@ -74,9 +76,11 @@ class ATHENA_EXPORT SplitViewController
   aura::Window* right_window() { return right_window_; }
 
  private:
+  friend class SplitViewControllerTest;
+
   enum State {
     // Split View mode is not active. |left_window_| and |right_window| are
-    // NULL.
+    // nullptr.
     INACTIVE,
     // Two windows |left_window_| and |right_window| are shown side by side and
     // there is a horizontal scroll in progress which is dragging the divider
@@ -107,33 +111,36 @@ class ATHENA_EXPORT SplitViewController
   // active and the divider is not being dragged.
   int GetDefaultDividerPosition();
 
-  // BezelController::ScrollDelegate:
-  virtual void BezelScrollBegin(BezelController::Bezel bezel,
-                                float delta) OVERRIDE;
-  virtual void BezelScrollEnd() OVERRIDE;
-  virtual void BezelScrollUpdate(float delta) OVERRIDE;
-  virtual bool BezelCanScroll() OVERRIDE;
+  // Access to constants in anonymous namespace for testing purposes.
+  float GetMaxDistanceFromMiddleForTest() const;
+  float GetMinFlingVelocityForTest() const;
 
   // DragHandleScrollDelegate:
-  virtual void HandleScrollBegin(float delta) OVERRIDE;
-  virtual void HandleScrollEnd() OVERRIDE;
-  virtual void HandleScrollUpdate(float delta) OVERRIDE;
+  void HandleScrollBegin(float delta) override;
+  void HandleScrollEnd(float velocity) override;
+  void HandleScrollUpdate(float delta) override;
 
   // WindowManagerObserver:
-  virtual void OnOverviewModeEnter() OVERRIDE;
-  virtual void OnOverviewModeExit() OVERRIDE;
-  virtual void OnSplitViewModeEnter() OVERRIDE;
-  virtual void OnSplitViewModeExit() OVERRIDE;
+  void OnOverviewModeEnter() override;
+  void OnOverviewModeExit() override;
+  void OnSplitViewModeEnter() override;
+  void OnSplitViewModeExit() override;
+
+  // WindowListProviderObserver:
+  void OnWindowStackingChangedInList() override {}
+  void OnWindowAddedToList(aura::Window* added_window) override;
+  void OnWindowRemovedFromList(aura::Window* removed_window,
+                               int index) override;
 
   State state_;
 
   aura::Window* container_;
 
   // Provider of the list of windows to cycle through. Not owned.
-  WindowListProvider* window_list_provider_;
+  WindowListProviderImpl* window_list_provider_;
 
   // Windows for the left and right activities shown in SCROLLING and ACTIVE
-  // states. In INACTIVE state these are NULL.
+  // states. In INACTIVE state these are nullptr.
   aura::Window* left_window_;
   aura::Window* right_window_;