Index: mojo/services/window_manager/window_manager_app.h |
diff --git a/mojo/services/window_manager/window_manager_app.h b/mojo/services/window_manager/window_manager_app.h |
index ed80892c95fe5005d9c7e0f7b7bf16c0db554103..7ec966a100b0112e97fc78ff84bbdf4091d57c6d 100644 |
--- a/mojo/services/window_manager/window_manager_app.h |
+++ b/mojo/services/window_manager/window_manager_app.h |
@@ -9,7 +9,6 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/scoped_vector.h" |
-#include "mojo/aura/window_tree_host_mojo.h" |
#include "mojo/public/cpp/application/application_delegate.h" |
#include "mojo/public/cpp/application/interface_factory_impl.h" |
#include "mojo/public/cpp/bindings/string.h" |
@@ -18,32 +17,24 @@ |
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
#include "mojo/services/public/cpp/view_manager/view_observer.h" |
#include "mojo/services/public/interfaces/window_manager/window_manager_internal.mojom.h" |
+#include "mojo/services/window_manager/focus_controller_observer.h" |
#include "mojo/services/window_manager/native_viewport_event_dispatcher_impl.h" |
+#include "mojo/services/window_manager/view_target.h" |
#include "mojo/services/window_manager/window_manager_impl.h" |
-#include "ui/aura/client/focus_change_observer.h" |
#include "ui/events/event_handler.h" |
-#include "ui/wm/public/activation_change_observer.h" |
-namespace aura { |
-namespace client { |
-class ActivationClient; |
-class FocusClient; |
-} |
-class Window; |
-} |
- |
-namespace wm { |
-class FocusRules; |
-class ScopedCaptureClient; |
+namespace gfx { |
+class Size; |
} |
namespace mojo { |
-class AuraInit; |
-class DummyDelegate; |
+class FocusController; |
+class FocusRules; |
class WindowManagerClient; |
class WindowManagerDelegate; |
class WindowManagerImpl; |
+class ViewEventDispatcher; |
// Implements core window manager functionality that could conceivably be shared |
// across multiple window managers implementing superficially different user |
@@ -53,23 +44,23 @@ class WindowManagerImpl; |
// delegate interfaces exposed by the view manager, this object provides the |
// canonical implementation of said interfaces but will call out to the wrapped |
// instances. |
-// This object maintains an aura::WindowTreeHost containing a hierarchy of |
-// aura::Windows. Window manager functionality (e.g. focus, activation, |
-// modality, etc.) are implemented using aura core window manager components. |
class WindowManagerApp : public ApplicationDelegate, |
public ViewManagerDelegate, |
public ViewObserver, |
public ui::EventHandler, |
- public aura::client::FocusChangeObserver, |
- public aura::client::ActivationChangeObserver, |
+ public FocusControllerObserver, |
public InterfaceFactory<WindowManagerInternal> { |
public: |
WindowManagerApp(ViewManagerDelegate* view_manager_delegate, |
WindowManagerDelegate* window_manager_delegate); |
~WindowManagerApp() override; |
- static View* GetViewForWindow(aura::Window* window); |
- aura::Window* GetWindowForViewId(Id view); |
+ static View* GetViewForViewTarget(ViewTarget* view); |
+ ViewTarget* GetViewTargetForViewId(Id view); |
+ |
+ mojo::ViewEventDispatcher* event_dispatcher() { |
+ return view_event_dispatcher_.get(); |
+ } |
// Register/deregister new connections to the window manager service. |
void AddConnection(WindowManagerImpl* connection); |
@@ -80,15 +71,13 @@ class WindowManagerApp : public ApplicationDelegate, |
void FocusWindow(Id view); |
void ActivateWindow(Id view); |
- void SetViewportSize(const gfx::Size&); |
+ void SetViewportSize(const gfx::Size& size); |
bool IsReady() const; |
- // A client of this object will use this accessor to gain access to the |
- // aura::Window hierarchy and attach event handlers. |
- WindowTreeHostMojo* host() { return window_tree_host_.get(); } |
+ FocusController* focus_controller() { return focus_controller_.get(); } |
- void InitFocus(wm::FocusRules* rules); |
+ void InitFocus(mojo::FocusRules* rules); |
// WindowManagerImpl::Embed() forwards to this. If connected to ViewManager |
// then forwards to delegate, otherwise waits for connection to establish then |
@@ -103,11 +92,24 @@ class WindowManagerApp : public ApplicationDelegate, |
private: |
// TODO(sky): rename this. Connections is ambiguous. |
typedef std::set<WindowManagerImpl*> Connections; |
- typedef std::map<Id, aura::Window*> ViewIdToWindowMap; |
+ typedef std::map<Id, ViewTarget*> ViewIdToViewTargetMap; |
struct PendingEmbed; |
class WindowManagerInternalImpl; |
+ // Creates an ViewTarget for every view in the hierarchy beneath |view|, |
+ // and adds to the registry so that it can be retrieved later via |
+ // GetViewTargetForViewId(). |
+ // TODO(beng): perhaps View should have a property bag. |
+ void RegisterSubtree(View* view, ViewTarget* parent); |
+ |
+ // Recursively invokes Unregister() for |view| and all its descendants. |
+ void UnregisterSubtree(View* view); |
+ |
+ // Deletes the ViewTarget associated with the hierarchy beneath |id|, |
+ // and removes from the registry. |
+ void Unregister(View* view); |
+ |
// Overridden from ViewManagerDelegate: |
void OnEmbed(ViewManager* view_manager, |
View* root, |
@@ -125,24 +127,9 @@ class WindowManagerApp : public ApplicationDelegate, |
// Overridden from ui::EventHandler: |
void OnEvent(ui::Event* event) override; |
- // Overridden from aura::client::FocusChangeObserver: |
- void OnWindowFocused(aura::Window* gained_focus, |
- aura::Window* lost_focus) override; |
- |
- // Overridden from aura::client::ActivationChangeObserver: |
- void OnWindowActivated(aura::Window* gained_active, |
- aura::Window* lost_active) override; |
- |
- // Creates an aura::Window for every view in the hierarchy beneath |view|, |
- // and adds to the registry so that it can be retrieved later via |
- // GetWindowForViewId(). |
- // TODO(beng): perhaps View should have a property bag. |
- void RegisterSubtree(View* view, aura::Window* parent); |
- // Recursively invokes Unregister() for |view| and all its descendants. |
- void UnregisterSubtree(View* view); |
- // Deletes the aura::Windows associated with the hierarchy beneath |id|, |
- // and removes from the registry. |
- void Unregister(View* view); |
+ // Overridden from mojo::FocusControllerObserver: |
+ void OnViewFocused(View* gained_focus, View* lost_focus) override; |
+ void OnViewActivated(View* gained_active, View* lost_active) override; |
// Creates the connection to the ViewManager. |
void LaunchViewManager(ApplicationImpl* app); |
@@ -167,17 +154,10 @@ class WindowManagerApp : public ApplicationDelegate, |
scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; |
View* root_; |
- scoped_ptr<AuraInit> aura_init_; |
- scoped_ptr<WindowTreeHostMojo> window_tree_host_; |
- |
- scoped_ptr<wm::ScopedCaptureClient> capture_client_; |
- scoped_ptr<aura::client::FocusClient> focus_client_; |
- aura::client::ActivationClient* activation_client_; |
+ scoped_ptr<mojo::FocusController> focus_controller_; |
Connections connections_; |
- ViewIdToWindowMap view_id_to_window_map_; |
- |
- scoped_ptr<DummyDelegate> dummy_delegate_; |
+ ViewIdToViewTargetMap view_id_to_view_target_map_; |
WindowManagerInternalClientPtr window_manager_client_; |
@@ -185,6 +165,8 @@ class WindowManagerApp : public ApplicationDelegate, |
scoped_ptr<ViewManagerClient> view_manager_client_; |
+ scoped_ptr<ViewEventDispatcher> view_event_dispatcher_; |
+ |
DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); |
}; |