Put code in //services/window_manager in namespace window_manager
R=sky@chromium.org
Review URL: https://codereview.chromium.org/788453002
diff --git a/examples/window_manager/window_manager.cc b/examples/window_manager/window_manager.cc
index 50f5f27..9d583ff 100644
--- a/examples/window_manager/window_manager.cc
+++ b/examples/window_manager/window_manager.cc
@@ -252,19 +252,18 @@
View* view_;
};
-class WindowManager
- : public ApplicationDelegate,
- public DebugPanel::Delegate,
- public ViewManagerDelegate,
- public WindowManagerDelegate,
- public ui::EventHandler {
+class WindowManager : public ApplicationDelegate,
+ public DebugPanel::Delegate,
+ public ViewManagerDelegate,
+ public window_manager::WindowManagerDelegate,
+ public ui::EventHandler {
public:
WindowManager()
: shell_(nullptr),
window_manager_factory_(this),
launcher_ui_(NULL),
view_manager_(NULL),
- window_manager_app_(new WindowManagerApp(this, this)),
+ window_manager_app_(new window_manager::WindowManagerApp(this, this)),
app_(NULL) {}
virtual ~WindowManager() {
@@ -378,7 +377,7 @@
// analogous here.
window_manager_app_->InitFocus(
- scoped_ptr<mojo::FocusRules>(new mojo::BasicFocusRules(view)));
+ make_scoped_ptr(new window_manager::BasicFocusRules(view)));
}
virtual void OnViewManagerDisconnected(ViewManager* view_manager) override {
DCHECK_EQ(view_manager_, view_manager);
@@ -396,7 +395,8 @@
// Overridden from ui::EventHandler:
virtual void OnEvent(ui::Event* event) override {
- View* view = static_cast<ViewTarget*>(event->target())->view();
+ View* view =
+ static_cast<window_manager::ViewTarget*>(event->target())->view();
if (event->type() == ui::ET_MOUSE_PRESSED &&
!IsDescendantOfKeyboard(view)) {
view->SetFocus();
@@ -518,7 +518,7 @@
ViewManager* view_manager_;
scoped_ptr<RootLayoutManager> root_layout_manager_;
- scoped_ptr<WindowManagerApp> window_manager_app_;
+ scoped_ptr<window_manager::WindowManagerApp> window_manager_app_;
// Id of the view most content is added to. The keyboard is NOT added here.
Id content_view_id_;
diff --git a/examples/wm_flow/wm/frame_controller.cc b/examples/wm_flow/wm/frame_controller.cc
index 0b3725b..d835a77 100644
--- a/examples/wm_flow/wm/frame_controller.cc
+++ b/examples/wm_flow/wm/frame_controller.cc
@@ -99,7 +99,7 @@
mojo::Shell* shell,
mojo::View* view,
mojo::View** app_view,
- mojo::WindowManagerApp* window_manager_app)
+ window_manager::WindowManagerApp* window_manager_app)
: view_(view),
app_view_(mojo::View::Create(view->view_manager())),
frame_view_(new views::View),
diff --git a/examples/wm_flow/wm/frame_controller.h b/examples/wm_flow/wm/frame_controller.h
index b2c7a3a..467acde 100644
--- a/examples/wm_flow/wm/frame_controller.h
+++ b/examples/wm_flow/wm/frame_controller.h
@@ -14,7 +14,6 @@
class NativeWidgetViewManager;
class Shell;
class View;
-class WindowManagerApp;
}
namespace views {
@@ -22,6 +21,10 @@
class Widget;
}
+namespace window_manager {
+class WindowManagerApp;
+}
+
// FrameController encapsulates the window manager's frame additions to a window
// created by an application. It renders the content of the frame and responds
// to any events targeted at it.
@@ -30,7 +33,7 @@
FrameController(mojo::Shell* shell,
mojo::View* view,
mojo::View** app_view,
- mojo::WindowManagerApp* window_manager_app);
+ window_manager::WindowManagerApp* window_manager_app);
virtual ~FrameController();
void CloseWindow();
@@ -52,7 +55,7 @@
views::Widget* widget_;
bool maximized_;
gfx::Rect restored_bounds_;
- mojo::WindowManagerApp* window_manager_app_;
+ window_manager::WindowManagerApp* window_manager_app_;
scoped_ptr<FrameEventHandler> frame_event_handler_;
DISALLOW_COPY_AND_ASSIGN(FrameController);
diff --git a/examples/wm_flow/wm/wm.cc b/examples/wm_flow/wm/wm.cc
index d31f6ed..9e898c7 100644
--- a/examples/wm_flow/wm/wm.cc
+++ b/examples/wm_flow/wm/wm.cc
@@ -23,12 +23,12 @@
class SimpleWM : public mojo::ApplicationDelegate,
public mojo::ViewManagerDelegate,
- public mojo::WindowManagerDelegate,
+ public window_manager::WindowManagerDelegate,
public mojo::ViewObserver {
public:
SimpleWM()
: shell_(nullptr),
- window_manager_app_(new mojo::WindowManagerApp(this, this)),
+ window_manager_app_(new window_manager::WindowManagerApp(this, this)),
view_manager_(NULL),
root_(NULL),
window_container_(NULL),
@@ -65,8 +65,8 @@
root_->AddChild(window_container_);
window_container_->SetVisible(true);
- window_manager_app_->InitFocus(scoped_ptr<mojo::FocusRules>(
- new mojo::BasicFocusRules(window_container_)));
+ window_manager_app_->InitFocus(make_scoped_ptr(
+ new window_manager::BasicFocusRules(window_container_)));
}
virtual void OnViewManagerDisconnected(
mojo::ViewManager* view_manager) override {
@@ -130,7 +130,7 @@
scoped_ptr<mojo::ViewsInit> views_init_;
- scoped_ptr<mojo::WindowManagerApp> window_manager_app_;
+ scoped_ptr<window_manager::WindowManagerApp> window_manager_app_;
mojo::ViewManager* view_manager_;
mojo::View* root_;
diff --git a/services/window_manager/basic_focus_rules.cc b/services/window_manager/basic_focus_rules.cc
index b5dd91a..32cd0aa 100644
--- a/services/window_manager/basic_focus_rules.cc
+++ b/services/window_manager/basic_focus_rules.cc
@@ -7,19 +7,21 @@
#include "base/macros.h"
#include "mojo/services/public/cpp/view_manager/view.h"
-namespace mojo {
+using mojo::View;
-BasicFocusRules::BasicFocusRules(mojo::View* window_container)
+namespace window_manager {
+
+BasicFocusRules::BasicFocusRules(View* window_container)
: window_container_(window_container) {
}
BasicFocusRules::~BasicFocusRules() {}
-bool BasicFocusRules::SupportsChildActivation(mojo::View* view) const {
+bool BasicFocusRules::SupportsChildActivation(View* view) const {
return true;
}
-bool BasicFocusRules::IsToplevelView(mojo::View* view) const {
+bool BasicFocusRules::IsToplevelView(View* view) const {
if (!IsViewParentedToWindowContainer(view))
return false;
@@ -28,7 +30,7 @@
return SupportsChildActivation(view->parent());
}
-bool BasicFocusRules::CanActivateView(mojo::View* view) const {
+bool BasicFocusRules::CanActivateView(View* view) const {
if (!view)
return true;
@@ -55,7 +57,7 @@
return true;
}
-bool BasicFocusRules::CanFocusView(mojo::View* view) const {
+bool BasicFocusRules::CanFocusView(View* view) const {
// It is possible to focus a NULL window, it is equivalent to clearing focus.
if (!view)
return true;
@@ -68,7 +70,7 @@
return CanFocusViewImpl(view);
}
-mojo::View* BasicFocusRules::GetToplevelView(mojo::View* view) const {
+View* BasicFocusRules::GetToplevelView(View* view) const {
View* parent = view->parent();
View* child = view;
while (parent) {
@@ -82,7 +84,7 @@
return nullptr;
}
-mojo::View* BasicFocusRules::GetActivatableView(mojo::View* view) const {
+View* BasicFocusRules::GetActivatableView(View* view) const {
View* parent = view->parent();
View* child = view;
while (parent) {
@@ -99,7 +101,7 @@
return nullptr;
}
-mojo::View* BasicFocusRules::GetFocusableView(mojo::View* view) const {
+View* BasicFocusRules::GetFocusableView(View* view) const {
if (CanFocusView(view))
return view;
@@ -129,8 +131,7 @@
return view;
}
-mojo::View* BasicFocusRules::GetNextActivatableView(
- mojo::View* activatable) const {
+View* BasicFocusRules::GetNextActivatableView(View* activatable) const {
DCHECK(activatable);
// In the basic scenarios handled by BasicFocusRules, the pool of activatable
@@ -148,7 +149,7 @@
return nullptr;
}
-// TODO(erg): aura::Window::CanFocus() exists. mojo::View::CanFocus() does
+// TODO(erg): aura::Window::CanFocus() exists. View::CanFocus() does
// not. This is a hack that does everything that Window::CanFocus() currently
// does that doesn't require a delegate or an EventClient.
bool BasicFocusRules::CanFocusViewImpl(View* view) const {
@@ -163,7 +164,7 @@
return CanFocusViewImpl(view->parent());
}
-bool BasicFocusRules::IsViewParentedToWindowContainer(mojo::View* view) const {
+bool BasicFocusRules::IsViewParentedToWindowContainer(View* view) const {
return view->parent() == window_container_;
}
diff --git a/services/window_manager/basic_focus_rules.h b/services/window_manager/basic_focus_rules.h
index 6802cac..34482e1 100644
--- a/services/window_manager/basic_focus_rules.h
+++ b/services/window_manager/basic_focus_rules.h
@@ -8,8 +8,10 @@
#include "services/window_manager/focus_rules.h"
namespace mojo {
-
class View;
+}
+
+namespace window_manager {
// The focusing rules used inside a window manager.
//
@@ -32,16 +34,16 @@
mojo::View* GetNextActivatableView(mojo::View* activatable) const override;
private:
- bool CanFocusViewImpl(View* view) const;
+ bool CanFocusViewImpl(mojo::View* view) const;
// Tests to see if |view| is in |window_container_|.
- bool IsViewParentedToWindowContainer(View* view) const;
+ bool IsViewParentedToWindowContainer(mojo::View* view) const;
mojo::View* window_container_;
DISALLOW_COPY_AND_ASSIGN(BasicFocusRules);
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_BASIC_FOCUS_RULES_H_
diff --git a/services/window_manager/focus_controller.cc b/services/window_manager/focus_controller.cc
index 560c441..6951259 100644
--- a/services/window_manager/focus_controller.cc
+++ b/services/window_manager/focus_controller.cc
@@ -13,9 +13,11 @@
#include "services/window_manager/window_manager_app.h"
#include "ui/events/event.h"
-DECLARE_VIEW_PROPERTY_TYPE(mojo::FocusController*);
+DECLARE_VIEW_PROPERTY_TYPE(window_manager::FocusController*);
-namespace mojo {
+using mojo::View;
+
+namespace window_manager {
namespace {
DEFINE_VIEW_PROPERTY_KEY(FocusController*, kRootViewFocusController, nullptr);
@@ -198,7 +200,7 @@
// Allow for the window losing focus to be deleted during dispatch. If it is
// deleted pass null to observers instead of a deleted window.
- ViewTracker view_tracker;
+ mojo::ViewTracker view_tracker;
if (lost_focus)
view_tracker.Add(lost_focus);
if (focused_view_ && observer_manager_.IsObserving(focused_view_) &&
@@ -245,7 +247,7 @@
View* lost_activation = active_view_;
// Allow for the window losing activation to be deleted during dispatch. If
// it is deleted pass null to observers instead of a deleted window.
- ViewTracker view_tracker;
+ mojo::ViewTracker view_tracker;
if (lost_activation)
view_tracker.Add(lost_activation);
if (active_view_ && observer_manager_.IsObserving(active_view_) &&
@@ -317,4 +319,4 @@
root_view->GetLocalProperty(kRootViewFocusController) : nullptr;
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/focus_controller.h b/services/window_manager/focus_controller.h
index cfcf45b..b9bddb2 100644
--- a/services/window_manager/focus_controller.h
+++ b/services/window_manager/focus_controller.h
@@ -12,7 +12,7 @@
#include "mojo/services/public/cpp/view_manager/view_observer.h"
#include "ui/events/event_handler.h"
-namespace mojo {
+namespace window_manager {
class FocusControllerObserver;
class FocusRules;
@@ -21,8 +21,7 @@
// manager. Within the window manager, there can only be one focused and one
// active window at a time. When focus or activation changes, notifications are
// sent using the FocusControllerObserver interface.
-class FocusController : public ui::EventHandler,
- public ViewObserver {
+class FocusController : public ui::EventHandler, public mojo::ViewObserver {
public:
// |rules| cannot be null.
explicit FocusController(scoped_ptr<FocusRules> rules);
@@ -31,17 +30,17 @@
void AddObserver(FocusControllerObserver* observer);
void RemoveObserver(FocusControllerObserver* observer);
- void ActivateView(View* view);
- void DeactivateView(View* view);
- View* GetActiveView();
- View* GetActivatableView(View* view);
- View* GetToplevelView(View* view);
- bool CanActivateView(View* view) const;
+ void ActivateView(mojo::View* view);
+ void DeactivateView(mojo::View* view);
+ mojo::View* GetActiveView();
+ mojo::View* GetActivatableView(mojo::View* view);
+ mojo::View* GetToplevelView(mojo::View* view);
+ bool CanActivateView(mojo::View* view) const;
- void FocusView(View* view);
+ void FocusView(mojo::View* view);
- void ResetFocusWithinActiveView(View* view);
- View* GetFocusedView();
+ void ResetFocusWithinActiveView(mojo::View* view);
+ mojo::View* GetFocusedView();
// Overridden from ui::EventHandler:
void OnKeyEvent(ui::KeyEvent* event) override;
@@ -53,13 +52,13 @@
// Overridden from ViewObserver:
void OnTreeChanging(const TreeChangeParams& params) override;
void OnTreeChanged(const TreeChangeParams& params) override;
- void OnViewVisibilityChanged(View* view) override;
- void OnViewDestroying(View* view) override;
+ void OnViewVisibilityChanged(mojo::View* view) override;
+ void OnViewDestroying(mojo::View* view) override;
private:
// Internal implementation that sets the focused view, fires events etc.
// This function must be called with a valid focusable view.
- void SetFocusedView(View* view);
+ void SetFocusedView(mojo::View* view);
// Internal implementation that sets the active window, fires events etc.
// This function must be called with a valid |activatable_window|.
@@ -67,21 +66,20 @@
// request (e.g. FocusWindow or ActivateWindow). It may be null, e.g. if
// SetActiveWindow was not called by an external request. |activatable_window|
// refers to the actual window to be activated, which may be different.
- void SetActiveView(View* requested_view,
- View* activatable_view);
+ void SetActiveView(mojo::View* requested_view, mojo::View* activatable_view);
// Called when a window's disposition changed such that it and its hierarchy
// are no longer focusable/activatable. |next| is a valid window that is used
// as a starting point for finding a window to focus next based on rules.
- void ViewLostFocusFromDispositionChange(View* view, View* next);
+ void ViewLostFocusFromDispositionChange(mojo::View* view, mojo::View* next);
// Called when an attempt is made to focus or activate a window via an input
// event targeted at that window. Rules determine the best focusable window
// for the input window.
- void ViewFocusedFromInputEvent(View* view);
+ void ViewFocusedFromInputEvent(mojo::View* view);
- View* active_view_;
- View* focused_view_;
+ mojo::View* active_view_;
+ mojo::View* focused_view_;
bool updating_focus_;
bool updating_activation_;
@@ -90,15 +88,15 @@
ObserverList<FocusControllerObserver> focus_controller_observers_;
- ScopedObserver<View, ViewObserver> observer_manager_;
+ ScopedObserver<mojo::View, ViewObserver> observer_manager_;
DISALLOW_COPY_AND_ASSIGN(FocusController);
};
// Sets/Gets the focus controller for a root view.
-void SetFocusController(View* view, FocusController* focus_controller);
-FocusController* GetFocusController(View* view);
+void SetFocusController(mojo::View* view, FocusController* focus_controller);
+FocusController* GetFocusController(mojo::View* view);
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_FOCUS_CONTROLLER_H_
diff --git a/services/window_manager/focus_controller_observer.h b/services/window_manager/focus_controller_observer.h
index 658c3c9..ea0d57e 100644
--- a/services/window_manager/focus_controller_observer.h
+++ b/services/window_manager/focus_controller_observer.h
@@ -6,8 +6,10 @@
#define SERVICES_WINDOW_MANAGER_FOCUS_CONTROLLER_OBSERVER_H_
namespace mojo {
-
class View;
+}
+
+namespace window_manager {
class FocusControllerObserver {
public:
@@ -15,22 +17,23 @@
// (|active| is null in this case.) |old_active| refers to the
// previous active view or null if there was no previously active
// view.
- virtual void OnViewActivated(View* gained_active,
- View* lost_active) = 0;
+ virtual void OnViewActivated(mojo::View* gained_active,
+ mojo::View* lost_active) = 0;
// Called when focus moves from |lost_focus| to |gained_focus|.
- virtual void OnViewFocused(View* gained_focus, View* lost_focus) = 0;
+ virtual void OnViewFocused(mojo::View* gained_focus,
+ mojo::View* lost_focus) = 0;
// Called when during view activation the currently active view is
// selected for activation. This can happen when a view requested for
// activation cannot be activated because a system modal view is active.
- virtual void OnAttemptToReactivateView(View* request_active,
- View* actual_active) {}
+ virtual void OnAttemptToReactivateView(mojo::View* request_active,
+ mojo::View* actual_active) {}
protected:
virtual ~FocusControllerObserver() {}
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_FOCUS_CONTROLLER_OBSERVER_H_
diff --git a/services/window_manager/focus_controller_unittest.cc b/services/window_manager/focus_controller_unittest.cc
index 73dcbb1..13e841d 100644
--- a/services/window_manager/focus_controller_unittest.cc
+++ b/services/window_manager/focus_controller_unittest.cc
@@ -14,7 +14,9 @@
#include "ui/events/test/event_generator.h"
#include "ui/gfx/geometry/rect.h"
-namespace mojo {
+using mojo::View;
+
+namespace window_manager {
// Counts the number of events that occur.
class FocusNotificationObserver : public FocusControllerObserver {
@@ -105,7 +107,7 @@
}
private:
- mojo::FocusController* focus_controller_;
+ FocusController* focus_controller_;
// Not owned.
ViewDestroyer* destroyer_;
@@ -166,7 +168,7 @@
}
private:
- mojo::FocusController* focus_controller_;
+ FocusController* focus_controller_;
DISALLOW_COPY_AND_ASSIGN(ScopedFocusNotificationObserver);
};
@@ -204,7 +206,7 @@
}
}
- mojo::FocusController* focus_controller_;
+ FocusController* focus_controller_;
View* target_;
DISALLOW_COPY_AND_ASSIGN(ScopedFilteringFocusNotificationObserver);
@@ -1130,4 +1132,4 @@
// If a mouse event was handled, it should not activate a view.
FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent);
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/focus_rules.h b/services/window_manager/focus_rules.h
index 83fd1d5..e409cbb 100644
--- a/services/window_manager/focus_rules.h
+++ b/services/window_manager/focus_rules.h
@@ -8,7 +8,7 @@
#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/cpp/view_manager/view.h"
-namespace mojo {
+namespace window_manager {
// Implemented by an object that establishes the rules about what can be
// focused or activated.
@@ -17,25 +17,25 @@
virtual ~FocusRules() {}
// Returns true if the children of |window| can be activated.
- virtual bool SupportsChildActivation(View* window) const = 0;
+ virtual bool SupportsChildActivation(mojo::View* window) const = 0;
// Returns true if |view| is a toplevel view. Whether or not a view
// is considered toplevel is determined by a similar set of rules that
// govern activation and focus. Not all toplevel views are activatable,
// call CanActivateView() to determine if a view can be activated.
- virtual bool IsToplevelView(View* view) const = 0;
+ virtual bool IsToplevelView(mojo::View* view) const = 0;
// Returns true if |view| can be activated or focused.
- virtual bool CanActivateView(View* view) const = 0;
+ virtual bool CanActivateView(mojo::View* view) const = 0;
// For CanFocusView(), null is supported, because null is a valid focusable
// view (in the case of clearing focus).
- virtual bool CanFocusView(View* view) const = 0;
+ virtual bool CanFocusView(mojo::View* view) const = 0;
// Returns the toplevel view containing |view|. Not all toplevel views
// are activatable, call GetActivatableView() instead to return the
// activatable view, which might be in a different hierarchy.
// Will return null if |view| is not contained by a view considered to be
// a toplevel view.
- virtual View* GetToplevelView(View* view) const = 0;
+ virtual mojo::View* GetToplevelView(mojo::View* view) const = 0;
// Returns the activatable or focusable view given an attempt to activate or
// focus |view|. Some possible scenarios (not intended to be exhaustive):
// - |view| is a child of a non-focusable view and so focus must be set
@@ -45,8 +45,8 @@
// transient being activated instead.
// These methods may return null if they are unable to find an activatable
// or focusable view given |view|.
- virtual View* GetActivatableView(View* view) const = 0;
- virtual View* GetFocusableView(View* view) const = 0;
+ virtual mojo::View* GetActivatableView(mojo::View* view) const = 0;
+ virtual mojo::View* GetFocusableView(mojo::View* view) const = 0;
// Returns the next view to activate in the event that |ignore| is no longer
// activatable. This function is called when something is happening to
@@ -57,9 +57,9 @@
// - it is being destroyed.
// - it is being explicitly deactivated.
// |ignore| cannot be null.
- virtual View* GetNextActivatableView(View* ignore) const = 0;
+ virtual mojo::View* GetNextActivatableView(mojo::View* ignore) const = 0;
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_
diff --git a/services/window_manager/main.cc b/services/window_manager/main.cc
index be31d35..c25ab76 100644
--- a/services/window_manager/main.cc
+++ b/services/window_manager/main.cc
@@ -17,10 +17,13 @@
// core window manager tests) that do not want to provide their own
// ApplicationDelegate::Create().
-namespace mojo {
+using mojo::View;
+using mojo::ViewManager;
-class DefaultWindowManager : public ApplicationDelegate,
- public ViewManagerDelegate,
+namespace window_manager {
+
+class DefaultWindowManager : public mojo::ApplicationDelegate,
+ public mojo::ViewManagerDelegate,
public WindowManagerDelegate {
public:
DefaultWindowManager()
@@ -30,12 +33,13 @@
~DefaultWindowManager() override {}
private:
- // Overridden from ApplicationDelegate:
- void Initialize(ApplicationImpl* impl) override {
+ // Overridden from mojo::ApplicationDelegate:
+ void Initialize(mojo::ApplicationImpl* impl) override {
window_manager_app_->Initialize(impl);
- TracingImpl::Create(impl);
+ mojo::TracingImpl::Create(impl);
}
- bool ConfigureIncomingConnection(ApplicationConnection* connection) override {
+ bool ConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) override {
window_manager_app_->ConfigureIncomingConnection(connection);
return true;
}
@@ -43,16 +47,17 @@
// Overridden from ViewManagerDelegate:
void OnEmbed(ViewManager* view_manager,
View* root,
- ServiceProviderImpl* exported_services,
- scoped_ptr<ServiceProvider> imported_services) override {
+ mojo::ServiceProviderImpl* exported_services,
+ scoped_ptr<mojo::ServiceProvider> imported_services) override {
view_manager_ = view_manager;
root_ = root;
}
void OnViewManagerDisconnected(ViewManager* view_manager) override {}
// Overridden from WindowManagerDelegate:
- void Embed(const String& url,
- InterfaceRequest<ServiceProvider> service_provider) override {
+ void Embed(
+ const mojo::String& url,
+ mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) override {
View* view = View::Create(view_manager_);
root_->AddChild(view);
view->SetVisible(true);
@@ -68,9 +73,10 @@
MOJO_DISALLOW_COPY_AND_ASSIGN(DefaultWindowManager);
};
-} // namespace mojo
+} // namespace window_manager
MojoResult MojoMain(MojoHandle shell_handle) {
- mojo::ApplicationRunnerChromium runner(new mojo::DefaultWindowManager);
+ mojo::ApplicationRunnerChromium runner(
+ new window_manager::DefaultWindowManager);
return runner.Run(shell_handle);
}
diff --git a/services/window_manager/native_viewport_event_dispatcher_impl.cc b/services/window_manager/native_viewport_event_dispatcher_impl.cc
index f99ce2d..1d96584 100644
--- a/services/window_manager/native_viewport_event_dispatcher_impl.cc
+++ b/services/window_manager/native_viewport_event_dispatcher_impl.cc
@@ -8,7 +8,7 @@
#include "services/window_manager/view_event_dispatcher.h"
#include "services/window_manager/window_manager_app.h"
-namespace mojo {
+namespace window_manager {
NativeViewportEventDispatcherImpl::NativeViewportEventDispatcherImpl(
WindowManagerApp* app)
@@ -32,4 +32,4 @@
callback.Run();
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/native_viewport_event_dispatcher_impl.h b/services/window_manager/native_viewport_event_dispatcher_impl.h
index 14ff44d..e47022f 100644
--- a/services/window_manager/native_viewport_event_dispatcher_impl.h
+++ b/services/window_manager/native_viewport_event_dispatcher_impl.h
@@ -9,13 +9,13 @@
#include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h"
#include "ui/events/event_source.h"
-namespace mojo {
+namespace window_manager {
class WindowManagerApp;
class NativeViewportEventDispatcherImpl
: public ui::EventSource,
- public InterfaceImpl<NativeViewportEventDispatcher> {
+ public mojo::InterfaceImpl<mojo::NativeViewportEventDispatcher> {
public:
explicit NativeViewportEventDispatcherImpl(WindowManagerApp* app);
~NativeViewportEventDispatcherImpl() override;
@@ -33,6 +33,6 @@
DISALLOW_COPY_AND_ASSIGN(NativeViewportEventDispatcherImpl);
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_NATIVE_VIEWPORT_EVENT_DISPATCHER_IMPL_H_
diff --git a/services/window_manager/view_event_dispatcher.cc b/services/window_manager/view_event_dispatcher.cc
index 5699328..f7f43d7 100644
--- a/services/window_manager/view_event_dispatcher.cc
+++ b/services/window_manager/view_event_dispatcher.cc
@@ -7,7 +7,7 @@
#include "mojo/services/public/cpp/view_manager/view.h"
#include "services/window_manager/view_target.h"
-namespace mojo {
+namespace window_manager {
ViewEventDispatcher::ViewEventDispatcher()
: event_dispatch_target_(nullptr),
@@ -55,4 +55,4 @@
return ui::EventDispatchDetails();
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/view_event_dispatcher.h b/services/window_manager/view_event_dispatcher.h
index 93bbee0..399939e 100644
--- a/services/window_manager/view_event_dispatcher.h
+++ b/services/window_manager/view_event_dispatcher.h
@@ -9,7 +9,7 @@
#include "ui/events/event_processor.h"
#include "ui/events/event_target.h"
-namespace mojo {
+namespace window_manager {
class ViewTarget;
@@ -42,6 +42,6 @@
DISALLOW_COPY_AND_ASSIGN(ViewEventDispatcher);
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_VIEW_EVENT_DISPATCHER_H_
diff --git a/services/window_manager/view_target.cc b/services/window_manager/view_target.cc
index 9c735d0..25c5615 100644
--- a/services/window_manager/view_target.cc
+++ b/services/window_manager/view_target.cc
@@ -16,7 +16,7 @@
#include "ui/gfx/point3_f.h"
#include "ui/gfx/transform.h"
-namespace mojo {
+namespace window_manager {
namespace {
@@ -28,7 +28,7 @@
}
// static
-ViewTarget* ViewTarget::TargetFromView(View* view) {
+ViewTarget* ViewTarget::TargetFromView(mojo::View* view) {
if (!view)
return nullptr;
@@ -59,7 +59,7 @@
std::vector<ViewTarget*> ViewTarget::GetChildren() {
std::vector<ViewTarget*> targets;
- for (View* child : view_->children())
+ for (mojo::View* child : view_->children())
targets.push_back(TargetFromView(child));
return targets;
}
@@ -133,7 +133,7 @@
event->ConvertLocationToTarget(this, static_cast<ViewTarget*>(target));
}
-ViewTarget::ViewTarget(View* view_to_wrap) : view_(view_to_wrap) {
+ViewTarget::ViewTarget(mojo::View* view_to_wrap) : view_(view_to_wrap) {
DCHECK(view_->GetLocalProperty(kViewTargetKey) == nullptr);
view_->SetLocalProperty(kViewTargetKey, this);
}
@@ -164,4 +164,4 @@
return v == ancestor;
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/view_target.h b/services/window_manager/view_target.h
index a788dea..a04cf66 100644
--- a/services/window_manager/view_target.h
+++ b/services/window_manager/view_target.h
@@ -18,9 +18,12 @@
}
namespace mojo {
+class View;
+}
+
+namespace window_manager {
class TestView;
-class View;
class ViewTargeter;
class WindowManagerApp;
@@ -36,7 +39,7 @@
// Returns the ViewTarget for a View. ViewTargets are owned by the |view|
// passed in, and are created on demand.
- static ViewTarget* TargetFromView(View* view);
+ static ViewTarget* TargetFromView(mojo::View* view);
// Converts |point| from |source|'s coordinates to |target|'s. If |source| is
// NULL, the function returns without modifying |point|. |target| cannot be
@@ -45,7 +48,7 @@
const ViewTarget* target,
gfx::Point* point);
- View* view() { return view_; }
+ mojo::View* view() { return view_; }
// TODO(erg): Make this const once we've removed aura from the tree and it's
// feasible to change all callers of the EventTargeter interface to pass and
@@ -75,7 +78,7 @@
private:
friend class TestView;
- explicit ViewTarget(View* view_to_wrap);
+ explicit ViewTarget(mojo::View* view_to_wrap);
bool ConvertPointForAncestor(const ViewTarget* ancestor,
gfx::Point* point) const;
@@ -85,13 +88,13 @@
gfx::Vector2d* offset) const;
// The mojo::View that we dispatch to.
- View* view_;
+ mojo::View* view_;
scoped_ptr<ViewTargeter> targeter_;
DISALLOW_COPY_AND_ASSIGN(ViewTarget);
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_VIEW_TARGET_H_
diff --git a/services/window_manager/view_target_unittest.cc b/services/window_manager/view_target_unittest.cc
index 05f8e92..6962a3a 100644
--- a/services/window_manager/view_target_unittest.cc
+++ b/services/window_manager/view_target_unittest.cc
@@ -11,7 +11,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/rect.h"
-namespace mojo {
+namespace window_manager {
using ViewTargetTest = testing::Test;
@@ -78,4 +78,4 @@
EXPECT_EQ(point2_in_t3_coords, point2_in_t1_coords);
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/view_targeter.cc b/services/window_manager/view_targeter.cc
index e176b38..ab822ff 100644
--- a/services/window_manager/view_targeter.cc
+++ b/services/window_manager/view_targeter.cc
@@ -7,7 +7,7 @@
#include "services/window_manager/focus_controller.h"
#include "services/window_manager/view_target.h"
-namespace mojo {
+namespace window_manager {
ViewTargeter::ViewTargeter() {}
@@ -72,7 +72,7 @@
ViewTarget* ViewTargeter::FindTargetForKeyEvent(ViewTarget* view_target,
const ui::KeyEvent& key) {
FocusController* focus_controller = GetFocusController(view_target->view());
- View* focused_view = focus_controller->GetFocusedView();
+ mojo::View* focused_view = focus_controller->GetFocusedView();
if (focused_view)
return ViewTarget::TargetFromView(focused_view);
@@ -94,4 +94,4 @@
return nullptr;
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/view_targeter.h b/services/window_manager/view_targeter.h
index 2ccf3e2..3a01e57 100644
--- a/services/window_manager/view_targeter.h
+++ b/services/window_manager/view_targeter.h
@@ -7,7 +7,7 @@
#include "ui/events/event_targeter.h"
-namespace mojo {
+namespace window_manager {
class ViewTarget;
@@ -39,6 +39,6 @@
DISALLOW_COPY_AND_ASSIGN(ViewTargeter);
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_VIEW_TARGETER_H_
diff --git a/services/window_manager/view_targeter_unittest.cc b/services/window_manager/view_targeter_unittest.cc
index ee2bbb8..a55ef75 100644
--- a/services/window_manager/view_targeter_unittest.cc
+++ b/services/window_manager/view_targeter_unittest.cc
@@ -11,7 +11,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/test/test_event_handler.h"
-namespace mojo {
+namespace window_manager {
class ViewTargeterTest : public testing::Test {
public:
@@ -80,8 +80,7 @@
ui::test::TestEventHandler two_handler;
two.target()->AddPreTargetHandler(&two_handler);
- FocusController focus_controller(scoped_ptr<mojo::FocusRules>(
- new mojo::BasicFocusRules(&root)));
+ FocusController focus_controller(make_scoped_ptr(new BasicFocusRules(&root)));
SetFocusController(&root, &focus_controller);
// Focus |one|. Then test that it receives a key event.
@@ -103,4 +102,4 @@
one.target()->RemovePreTargetHandler(&one_handler);
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/window_manager_api_unittest.cc b/services/window_manager/window_manager_api_unittest.cc
index 84215cd..0d99bbd 100644
--- a/services/window_manager/window_manager_api_unittest.cc
+++ b/services/window_manager/window_manager_api_unittest.cc
@@ -20,14 +20,18 @@
#include "shell/shell_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace mojo {
+using mojo::ApplicationImpl;
+using mojo::Id;
+using mojo::View;
+
+namespace window_manager {
namespace {
const char kTestServiceURL[] = "mojo:test_url";
void EmptyResultCallback(bool result) {}
-class TestWindowManagerClient : public WindowManagerClient {
+class TestWindowManagerClient : public mojo::WindowManagerClient {
public:
typedef base::Callback<void(Id, Id)>
TwoNodeCallback;
@@ -44,7 +48,7 @@
}
private:
- // Overridden from WindowManagerClient:
+ // Overridden from mojo::WindowManagerClient:
void OnCaptureChanged(Id old_capture_node_id,
Id new_capture_node_id) override {}
void OnFocusChanged(Id old_focused_node_id, Id new_focused_node_id) override {
@@ -64,9 +68,9 @@
DISALLOW_COPY_AND_ASSIGN(TestWindowManagerClient);
};
-class TestApplicationLoader : public ApplicationLoader,
- public ApplicationDelegate,
- public ViewManagerDelegate {
+class TestApplicationLoader : public mojo::ApplicationLoader,
+ public mojo::ApplicationDelegate,
+ public mojo::ViewManagerDelegate {
public:
typedef base::Callback<void(View*)> RootAddedCallback;
@@ -75,43 +79,44 @@
~TestApplicationLoader() override {}
private:
- // Overridden from ApplicationLoader:
- void Load(ApplicationManager* application_manager,
+ // Overridden from mojo::ApplicationLoader:
+ void Load(mojo::ApplicationManager* application_manager,
const GURL& url,
- ScopedMessagePipeHandle shell_handle,
+ mojo::ScopedMessagePipeHandle shell_handle,
LoadCallback callback) override {
ASSERT_TRUE(shell_handle.is_valid());
scoped_ptr<ApplicationImpl> app(
new ApplicationImpl(this, shell_handle.Pass()));
apps_.push_back(app.release());
}
- void OnApplicationError(ApplicationManager* application_manager,
+ void OnApplicationError(mojo::ApplicationManager* application_manager,
const GURL& url) override {}
- // Overridden from ApplicationDelegate:
+ // Overridden from mojo::ApplicationDelegate:
void Initialize(ApplicationImpl* app) override {
view_manager_client_factory_.reset(
- new ViewManagerClientFactory(app->shell(), this));
+ new mojo::ViewManagerClientFactory(app->shell(), this));
}
- bool ConfigureIncomingConnection(ApplicationConnection* connection) override {
+ bool ConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) override {
connection->AddService(view_manager_client_factory_.get());
return true;
}
- // Overridden from ViewManagerDelegate:
- void OnEmbed(ViewManager* view_manager,
+ // Overridden from mojo::ViewManagerDelegate:
+ void OnEmbed(mojo::ViewManager* view_manager,
View* root,
- ServiceProviderImpl* exported_services,
- scoped_ptr<ServiceProvider> imported_services) override {
+ mojo::ServiceProviderImpl* exported_services,
+ scoped_ptr<mojo::ServiceProvider> imported_services) override {
root_added_callback_.Run(root);
}
- void OnViewManagerDisconnected(ViewManager* view_manager) override {}
+ void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override {}
RootAddedCallback root_added_callback_;
ScopedVector<ApplicationImpl> apps_;
- scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_;
+ scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
DISALLOW_COPY_AND_ASSIGN(TestApplicationLoader);
};
@@ -161,10 +166,10 @@
Id OpenWindowWithURL(const std::string& url) {
base::RunLoop run_loop;
- ServiceProviderPtr sp;
- BindToProxy(new ServiceProviderImpl, &sp);
+ mojo::ServiceProviderPtr sp;
+ BindToProxy(new mojo::ServiceProviderImpl, &sp);
window_manager_->Embed(
- url, MakeRequest<ServiceProvider>(sp.PassMessagePipe()));
+ url, mojo::MakeRequest<mojo::ServiceProvider>(sp.PassMessagePipe()));
run_loop.Run();
return WaitForEmbed();
}
@@ -173,18 +178,19 @@
return window_manager_client_.get();
}
- WindowManagerPtr window_manager_;
+ mojo::WindowManagerPtr window_manager_;
private:
// Overridden from testing::Test:
void SetUp() override {
- test_helper_.reset(new shell::ShellTestHelper);
+ test_helper_.reset(new mojo::shell::ShellTestHelper);
test_helper_->Init();
test_helper_->AddCustomMapping(GURL("mojo:window_manager"),
GURL("mojo:core_window_manager"));
test_helper_->SetLoaderForURL(
- scoped_ptr<ApplicationLoader>(new TestApplicationLoader(base::Bind(
- &WindowManagerApiTest::OnRootAdded, base::Unretained(this)))),
+ scoped_ptr<mojo::ApplicationLoader>(
+ new TestApplicationLoader(base::Bind(
+ &WindowManagerApiTest::OnRootAdded, base::Unretained(this)))),
GURL(kTestServiceURL));
ConnectToWindowManager2();
}
@@ -236,7 +242,7 @@
run_loop->Quit();
}
- scoped_ptr<shell::ShellTestHelper> test_helper_;
+ scoped_ptr<mojo::shell::ShellTestHelper> test_helper_;
scoped_ptr<TestWindowManagerClient> window_manager_client_;
TestApplicationLoader::RootAddedCallback root_added_callback_;
@@ -261,4 +267,4 @@
EXPECT_EQ(ids.second, second_window);
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/window_manager_app.cc b/services/window_manager/window_manager_app.cc
index 44fd89a..d866d69 100644
--- a/services/window_manager/window_manager_app.cc
+++ b/services/window_manager/window_manager_app.cc
@@ -21,7 +21,13 @@
#include "services/window_manager/window_manager_delegate.h"
#include "ui/base/hit_test.h"
-namespace mojo {
+using mojo::ApplicationConnection;
+using mojo::Id;
+using mojo::ServiceProvider;
+using mojo::View;
+using mojo::WindowManager;
+
+namespace window_manager {
namespace {
@@ -34,8 +40,8 @@
// Used for calls to Embed() that occur before we've connected to the
// ViewManager.
struct WindowManagerApp::PendingEmbed {
- String url;
- InterfaceRequest<mojo::ServiceProvider> service_provider;
+ mojo::String url;
+ mojo::InterfaceRequest<ServiceProvider> service_provider;
};
////////////////////////////////////////////////////////////////////////////////
@@ -91,8 +97,8 @@
return view_manager_ && root_;
}
-void WindowManagerApp::InitFocus(scoped_ptr<mojo::FocusRules> rules) {
- focus_controller_.reset(new mojo::FocusController(rules.Pass()));
+void WindowManagerApp::InitFocus(scoped_ptr<FocusRules> rules) {
+ focus_controller_.reset(new FocusController(rules.Pass()));
focus_controller_->AddObserver(this);
DCHECK(root_);
@@ -100,8 +106,8 @@
}
void WindowManagerApp::Embed(
- const String& url,
- InterfaceRequest<ServiceProvider> service_provider) {
+ const mojo::String& url,
+ mojo::InterfaceRequest<ServiceProvider> service_provider) {
if (view_manager_) {
window_manager_delegate_->Embed(url, service_provider.Pass());
return;
@@ -115,7 +121,7 @@
////////////////////////////////////////////////////////////////////////////////
// WindowManagerApp, ApplicationDelegate implementation:
-void WindowManagerApp::Initialize(ApplicationImpl* impl) {
+void WindowManagerApp::Initialize(mojo::ApplicationImpl* impl) {
shell_ = impl->shell();
LaunchViewManager(impl);
}
@@ -129,15 +135,15 @@
////////////////////////////////////////////////////////////////////////////////
// WindowManagerApp, ViewManagerDelegate implementation:
-void WindowManagerApp::OnEmbed(ViewManager* view_manager,
+void WindowManagerApp::OnEmbed(mojo::ViewManager* view_manager,
View* root,
- ServiceProviderImpl* exported_services,
+ mojo::ServiceProviderImpl* exported_services,
scoped_ptr<ServiceProvider> imported_services) {
DCHECK(!view_manager_ && !root_);
view_manager_ = view_manager;
root_ = root;
- view_event_dispatcher_.reset(new ViewEventDispatcher());
+ view_event_dispatcher_.reset(new ViewEventDispatcher);
RegisterSubtree(root_);
@@ -157,7 +163,7 @@
}
void WindowManagerApp::OnViewManagerDisconnected(
- ViewManager* view_manager) {
+ mojo::ViewManager* view_manager) {
DCHECK_EQ(view_manager_, view_manager);
if (wrapped_view_manager_delegate_)
wrapped_view_manager_delegate_->OnViewManagerDisconnected(view_manager);
@@ -214,7 +220,7 @@
focus_controller_->OnEvent(event);
window_manager_client_->DispatchInputEventToView(view->id(),
- Event::From(*event));
+ mojo::Event::From(*event));
}
////////////////////////////////////////////////////////////////////////////////
@@ -279,28 +285,30 @@
registered_view_id_set_.erase(it);
}
-void WindowManagerApp::DispatchInputEventToView(View* view, EventPtr event) {
+void WindowManagerApp::DispatchInputEventToView(View* view,
+ mojo::EventPtr event) {
window_manager_client_->DispatchInputEventToView(view->id(), event.Pass());
}
void WindowManagerApp::SetViewportSize(const gfx::Size& size) {
- window_manager_client_->SetViewportSize(Size::From(size));
+ window_manager_client_->SetViewportSize(mojo::Size::From(size));
}
-void WindowManagerApp::LaunchViewManager(ApplicationImpl* app) {
+void WindowManagerApp::LaunchViewManager(mojo::ApplicationImpl* app) {
// TODO(sky): figure out logic if this connection goes away.
view_manager_client_factory_.reset(
- new ViewManagerClientFactory(shell_, this));
+ new mojo::ViewManagerClientFactory(shell_, this));
- MessagePipe pipe;
+ mojo::MessagePipe pipe;
ApplicationConnection* view_manager_app =
app->ConnectToApplication("mojo:view_manager");
ServiceProvider* view_manager_service_provider =
view_manager_app->GetServiceProvider();
- view_manager_service_provider->ConnectToService(ViewManagerService::Name_,
- pipe.handle1.Pass());
- view_manager_client_ = ViewManagerClientFactory::WeakBindViewManagerToPipe(
- pipe.handle0.Pass(), shell_, this).Pass();
+ view_manager_service_provider->ConnectToService(
+ mojo::ViewManagerService::Name_, pipe.handle1.Pass());
+ view_manager_client_ =
+ mojo::ViewManagerClientFactory::WeakBindViewManagerToPipe(
+ pipe.handle0.Pass(), shell_, this).Pass();
view_manager_app->AddService(&native_viewport_event_dispatcher_factory_);
view_manager_app->AddService(
@@ -309,19 +317,20 @@
view_manager_app->ConnectToService(&window_manager_client_);
}
-void WindowManagerApp::Create(ApplicationConnection* connection,
- InterfaceRequest<WindowManagerInternal> request) {
+void WindowManagerApp::Create(
+ ApplicationConnection* connection,
+ mojo::InterfaceRequest<WindowManagerInternal> request) {
if (wm_internal_binding_.get()) {
VLOG(1) <<
"WindowManager allows only one WindowManagerInternal connection.";
return;
}
wm_internal_binding_.reset(
- new Binding<WindowManagerInternal>(this, request.Pass()));
+ new mojo::Binding<WindowManagerInternal>(this, request.Pass()));
}
void WindowManagerApp::Create(ApplicationConnection* connection,
- InterfaceRequest<WindowManager> request) {
+ mojo::InterfaceRequest<WindowManager> request) {
WindowManagerImpl* wm = new WindowManagerImpl(this, false);
wm->Bind(request.PassMessagePipe());
// WindowManagerImpl is deleted when the connection has an error, or from our
@@ -330,11 +339,11 @@
void WindowManagerApp::CreateWindowManagerForViewManagerClient(
uint16_t connection_id,
- ScopedMessagePipeHandle window_manager_pipe) {
+ mojo::ScopedMessagePipeHandle window_manager_pipe) {
WindowManagerImpl* wm = new WindowManagerImpl(this, true);
wm->Bind(window_manager_pipe.Pass());
// WindowManagerImpl is deleted when the connection has an error, or from our
// destructor.
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/window_manager_app.h b/services/window_manager/window_manager_app.h
index 77e886b..e17acf9 100644
--- a/services/window_manager/window_manager_app.h
+++ b/services/window_manager/window_manager_app.h
@@ -28,14 +28,14 @@
class Size;
}
-namespace mojo {
+namespace window_manager {
class FocusController;
class FocusRules;
+class ViewEventDispatcher;
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
@@ -45,20 +45,21 @@
// delegate interfaces exposed by the view manager, this object provides the
// canonical implementation of said interfaces but will call out to the wrapped
// instances.
-class WindowManagerApp : public ApplicationDelegate,
- public ViewManagerDelegate,
- public ViewObserver,
- public ui::EventHandler,
- public FocusControllerObserver,
- public InterfaceFactory<WindowManager>,
- public InterfaceFactory<WindowManagerInternal>,
- public WindowManagerInternal {
+class WindowManagerApp
+ : public mojo::ApplicationDelegate,
+ public mojo::ViewManagerDelegate,
+ public mojo::ViewObserver,
+ public ui::EventHandler,
+ public FocusControllerObserver,
+ public mojo::InterfaceFactory<mojo::WindowManager>,
+ public mojo::InterfaceFactory<mojo::WindowManagerInternal>,
+ public mojo::WindowManagerInternal {
public:
WindowManagerApp(ViewManagerDelegate* view_manager_delegate,
WindowManagerDelegate* window_manager_delegate);
~WindowManagerApp() override;
- mojo::ViewEventDispatcher* event_dispatcher() {
+ ViewEventDispatcher* event_dispatcher() {
return view_event_dispatcher_.get();
}
@@ -67,11 +68,11 @@
void RemoveConnection(WindowManagerImpl* connection);
// These are canonical implementations of the window manager API methods.
- void SetCapture(Id view);
- void FocusWindow(Id view);
- void ActivateWindow(Id view);
+ void SetCapture(mojo::Id view);
+ void FocusWindow(mojo::Id view);
+ void ActivateWindow(mojo::Id view);
- void DispatchInputEventToView(View* view, EventPtr event);
+ void DispatchInputEventToView(mojo::View* view, mojo::EventPtr event);
void SetViewportSize(const gfx::Size& size);
bool IsReady() const;
@@ -83,17 +84,18 @@
// WindowManagerImpl::Embed() forwards to this. If connected to ViewManager
// then forwards to delegate, otherwise waits for connection to establish then
// forwards.
- void Embed(const String& url,
- InterfaceRequest<ServiceProvider> service_provider);
+ void Embed(const mojo::String& url,
+ mojo::InterfaceRequest<mojo::ServiceProvider> service_provider);
// Overridden from ApplicationDelegate:
- void Initialize(ApplicationImpl* impl) override;
- bool ConfigureIncomingConnection(ApplicationConnection* connection) override;
+ void Initialize(mojo::ApplicationImpl* impl) override;
+ bool ConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) override;
private:
// TODO(sky): rename this. Connections is ambiguous.
typedef std::set<WindowManagerImpl*> Connections;
- typedef std::set<Id> RegisteredViewIdSet;
+ typedef std::set<mojo::Id> RegisteredViewIdSet;
struct PendingEmbed;
class WindowManagerInternalImpl;
@@ -102,80 +104,82 @@
// 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);
+ void RegisterSubtree(mojo::View* view);
// Recursively invokes Unregister() for |view| and all its descendants.
- void UnregisterSubtree(View* view);
+ void UnregisterSubtree(mojo::View* view);
// Deletes the ViewTarget associated with the hierarchy beneath |id|,
// and removes from the registry.
- void Unregister(View* view);
+ void Unregister(mojo::View* view);
// Overridden from ViewManagerDelegate:
- void OnEmbed(ViewManager* view_manager,
- View* root,
- ServiceProviderImpl* exported_services,
- scoped_ptr<ServiceProvider> imported_services) override;
- void OnViewManagerDisconnected(ViewManager* view_manager) override;
+ void OnEmbed(mojo::ViewManager* view_manager,
+ mojo::View* root,
+ mojo::ServiceProviderImpl* exported_services,
+ scoped_ptr<mojo::ServiceProvider> imported_services) override;
+ void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override;
// Overridden from ViewObserver:
void OnTreeChanged(const ViewObserver::TreeChangeParams& params) override;
- void OnViewDestroying(View* view) override;
+ void OnViewDestroying(mojo::View* view) override;
// Overridden from ui::EventHandler:
void OnEvent(ui::Event* event) override;
// Overridden from mojo::FocusControllerObserver:
- void OnViewFocused(View* gained_focus, View* lost_focus) override;
- void OnViewActivated(View* gained_active, View* lost_active) override;
+ void OnViewFocused(mojo::View* gained_focus, mojo::View* lost_focus) override;
+ void OnViewActivated(mojo::View* gained_active,
+ mojo::View* lost_active) override;
// Creates the connection to the ViewManager.
- void LaunchViewManager(ApplicationImpl* app);
+ void LaunchViewManager(mojo::ApplicationImpl* app);
// InterfaceFactory<WindowManagerInternal>:
- void Create(ApplicationConnection* connection,
- InterfaceRequest<WindowManagerInternal> request) override;
+ void Create(
+ mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<mojo::WindowManagerInternal> request) override;
// InterfaceFactory<WindowManager>:
- void Create(ApplicationConnection* connection,
- InterfaceRequest<WindowManager> request) override;
+ void Create(mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<mojo::WindowManager> request) override;
// WindowManagerInternal:
void CreateWindowManagerForViewManagerClient(
uint16_t connection_id,
- ScopedMessagePipeHandle window_manager_pipe) override;
+ mojo::ScopedMessagePipeHandle window_manager_pipe) override;
- Shell* shell_;
+ mojo::Shell* shell_;
- InterfaceFactoryImplWithContext<NativeViewportEventDispatcherImpl,
- WindowManagerApp>
+ mojo::InterfaceFactoryImplWithContext<NativeViewportEventDispatcherImpl,
+ WindowManagerApp>
native_viewport_event_dispatcher_factory_;
ViewManagerDelegate* wrapped_view_manager_delegate_;
WindowManagerDelegate* window_manager_delegate_;
- ViewManager* view_manager_;
- scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_;
- View* root_;
+ mojo::ViewManager* view_manager_;
+ scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
+ mojo::View* root_;
- scoped_ptr<mojo::FocusController> focus_controller_;
+ scoped_ptr<FocusController> focus_controller_;
Connections connections_;
RegisteredViewIdSet registered_view_id_set_;
- WindowManagerInternalClientPtr window_manager_client_;
+ mojo::WindowManagerInternalClientPtr window_manager_client_;
ScopedVector<PendingEmbed> pending_embeds_;
- scoped_ptr<ViewManagerClient> view_manager_client_;
+ scoped_ptr<mojo::ViewManagerClient> view_manager_client_;
scoped_ptr<ViewEventDispatcher> view_event_dispatcher_;
- scoped_ptr<Binding<WindowManagerInternal>> wm_internal_binding_;
+ scoped_ptr<mojo::Binding<WindowManagerInternal>> wm_internal_binding_;
DISALLOW_COPY_AND_ASSIGN(WindowManagerApp);
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_
diff --git a/services/window_manager/window_manager_delegate.h b/services/window_manager/window_manager_delegate.h
index c02bed9..94b9f71 100644
--- a/services/window_manager/window_manager_delegate.h
+++ b/services/window_manager/window_manager_delegate.h
@@ -8,13 +8,14 @@
#include "mojo/public/cpp/bindings/string.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
-namespace mojo {
+namespace window_manager {
class WindowManagerDelegate {
public:
// See WindowManager::Embed() for details.
- virtual void Embed(const String& url,
- InterfaceRequest<ServiceProvider> service_provider) = 0;
+ virtual void Embed(
+ const mojo::String& url,
+ mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) = 0;
protected:
virtual ~WindowManagerDelegate() {}
diff --git a/services/window_manager/window_manager_impl.cc b/services/window_manager/window_manager_impl.cc
index e751917..28c858d 100644
--- a/services/window_manager/window_manager_impl.cc
+++ b/services/window_manager/window_manager_impl.cc
@@ -6,7 +6,10 @@
#include "services/window_manager/window_manager_app.h"
-namespace mojo {
+using mojo::Callback;
+using mojo::Id;
+
+namespace window_manager {
WindowManagerImpl::WindowManagerImpl(WindowManagerApp* window_manager,
bool from_vm)
@@ -19,7 +22,8 @@
window_manager_->RemoveConnection(this);
}
-void WindowManagerImpl::Bind(ScopedMessagePipeHandle window_manager_pipe) {
+void WindowManagerImpl::Bind(
+ mojo::ScopedMessagePipeHandle window_manager_pipe) {
binding_.Bind(window_manager_pipe.Pass());
}
@@ -36,8 +40,8 @@
}
void WindowManagerImpl::Embed(
- const String& url,
- InterfaceRequest<ServiceProvider> service_provider) {
+ const mojo::String& url,
+ mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) {
window_manager_->Embed(url, service_provider.Pass());
}
@@ -78,4 +82,4 @@
delete this;
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/window_manager_impl.h b/services/window_manager/window_manager_impl.h
index 0446ae1..3c5849e 100644
--- a/services/window_manager/window_manager_impl.h
+++ b/services/window_manager/window_manager_impl.h
@@ -12,11 +12,12 @@
#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h"
-namespace mojo {
+namespace window_manager {
class WindowManagerApp;
-class WindowManagerImpl : public WindowManager, public ErrorHandler {
+class WindowManagerImpl : public mojo::WindowManager,
+ public mojo::ErrorHandler {
public:
// See description above |from_vm_| for details on |from_vm|.
// WindowManagerImpl deletes itself on connection errors. WindowManagerApp
@@ -24,28 +25,29 @@
WindowManagerImpl(WindowManagerApp* window_manager, bool from_vm);
~WindowManagerImpl() override;
- void Bind(ScopedMessagePipeHandle window_manager_pipe);
+ void Bind(mojo::ScopedMessagePipeHandle window_manager_pipe);
- void NotifyViewFocused(Id new_focused_id, Id old_focused_id);
- void NotifyWindowActivated(Id new_active_id, Id old_active_id);
+ void NotifyViewFocused(mojo::Id new_focused_id, mojo::Id old_focused_id);
+ void NotifyWindowActivated(mojo::Id new_active_id, mojo::Id old_active_id);
private:
- WindowManagerClient* client() {
+ mojo::WindowManagerClient* client() {
DCHECK(from_vm_);
return binding_.client();
}
- // WindowManager:
- void Embed(const String& url,
- InterfaceRequest<ServiceProvider> service_provider) override;
+ // mojo::WindowManager:
+ void Embed(
+ const mojo::String& url,
+ mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) override;
void SetCapture(uint32_t view_id,
- const Callback<void(bool)>& callback) override;
+ const mojo::Callback<void(bool)>& callback) override;
void FocusWindow(uint32_t view_id,
- const Callback<void(bool)>& callback) override;
+ const mojo::Callback<void(bool)>& callback) override;
void ActivateWindow(uint32_t view_id,
- const Callback<void(bool)>& callback) override;
+ const mojo::Callback<void(bool)>& callback) override;
- // ErrorHandler:
+ // mojo::ErrorHandler:
void OnConnectionError() override;
WindowManagerApp* window_manager_;
@@ -55,11 +57,11 @@
// that don't originate from the view manager do not have clients.
const bool from_vm_;
- Binding<WindowManager> binding_;
+ mojo::Binding<mojo::WindowManager> binding_;
DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl);
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_
diff --git a/services/window_manager/window_manager_test_util.cc b/services/window_manager/window_manager_test_util.cc
index ac4db27..3f0a50b 100644
--- a/services/window_manager/window_manager_test_util.cc
+++ b/services/window_manager/window_manager_test_util.cc
@@ -8,11 +8,11 @@
#include "mojo/converters/geometry/geometry_type_converters.h"
#include "ui/gfx/geometry/rect.h"
-namespace mojo {
+namespace window_manager {
TestView::TestView(int id, const gfx::Rect& rect)
: target_(new ViewTarget(this)) {
- ViewPrivate(this).set_id(id);
+ mojo::ViewPrivate(this).set_id(id);
mojo::Rect mojo_rect = *mojo::Rect::From(rect);
SetBounds(mojo_rect);
@@ -32,8 +32,8 @@
}
// static
-TestView* TestView::Build(int id, const gfx::Rect& rect, View* parent) {
+TestView* TestView::Build(int id, const gfx::Rect& rect, mojo::View* parent) {
return new TestView(id, rect, parent);
}
-} // namespace mojo
+} // namespace window_manager
diff --git a/services/window_manager/window_manager_test_util.h b/services/window_manager/window_manager_test_util.h
index 8d40d76..e029d9d 100644
--- a/services/window_manager/window_manager_test_util.h
+++ b/services/window_manager/window_manager_test_util.h
@@ -15,14 +15,14 @@
class Rect;
}
-namespace mojo {
+namespace window_manager {
// A wrapper around View so we can instantiate these directly without a
// ViewManager.
-class TestView : public View {
+class TestView : public mojo::View {
public:
TestView(int id, const gfx::Rect& rect);
- TestView(int id, const gfx::Rect& rect, View* parent);
+ TestView(int id, const gfx::Rect& rect, mojo::View* parent);
~TestView();
// Builds a child view as a pointer. The caller is responsible for making
@@ -38,6 +38,6 @@
DISALLOW_COPY_AND_ASSIGN(TestView);
};
-} // namespace mojo
+} // namespace window_manager
#endif // SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_TEST_UTIL_H_
diff --git a/services/window_manager/window_manager_unittests.cc b/services/window_manager/window_manager_unittests.cc
index dd05b45..51fd967 100644
--- a/services/window_manager/window_manager_unittests.cc
+++ b/services/window_manager/window_manager_unittests.cc
@@ -11,7 +11,7 @@
#include "ui/gfx/x/x11_connection.h"
#endif
-namespace mojo {
+namespace window_manager {
class WindowManagerTestSuite : public base::TestSuite {
public:
@@ -33,10 +33,10 @@
DISALLOW_COPY_AND_ASSIGN(WindowManagerTestSuite);
};
-} // namespace mojo
+} // namespace window_manager
int main(int argc, char** argv) {
- mojo::WindowManagerTestSuite test_suite(argc, argv);
+ window_manager::WindowManagerTestSuite test_suite(argc, argv);
return base::LaunchUnitTests(
argc, argv, base::Bind(&TestSuite::Run, base::Unretained(&test_suite)));
diff --git a/sky/tools/debugger/debugger.cc b/sky/tools/debugger/debugger.cc
index 4b1a6a5..de93197 100644
--- a/sky/tools/debugger/debugger.cc
+++ b/sky/tools/debugger/debugger.cc
@@ -10,7 +10,7 @@
namespace debugger {
SkyDebugger::SkyDebugger()
- : window_manager_app_(new mojo::WindowManagerApp(this, nullptr)),
+ : window_manager_app_(new window_manager::WindowManagerApp(this, nullptr)),
view_manager_(nullptr),
root_(nullptr),
content_(nullptr),
@@ -62,7 +62,7 @@
content_->SetVisible(true);
window_manager_app_->InitFocus(
- scoped_ptr<mojo::FocusRules>(new mojo::BasicFocusRules(content_)));
+ make_scoped_ptr(new window_manager::BasicFocusRules(content_)));
if (!pending_url_.empty())
NavigateToURL(pending_url_);
diff --git a/sky/tools/debugger/debugger.h b/sky/tools/debugger/debugger.h
index 82e3b9f..43c47c3 100644
--- a/sky/tools/debugger/debugger.h
+++ b/sky/tools/debugger/debugger.h
@@ -62,7 +62,7 @@
void Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<Debugger> request) override;
- scoped_ptr<mojo::WindowManagerApp> window_manager_app_;
+ scoped_ptr<window_manager::WindowManagerApp> window_manager_app_;
mojo::ViewManager* view_manager_;
mojo::View* root_;
diff --git a/sky/tools/tester/tester.cc b/sky/tools/tester/tester.cc
index 38edb5e..d3d6927 100644
--- a/sky/tools/tester/tester.cc
+++ b/sky/tools/tester/tester.cc
@@ -33,12 +33,12 @@
class SkyTester : public mojo::ApplicationDelegate,
public mojo::ViewManagerDelegate,
- public mojo::WindowManagerDelegate,
+ public window_manager::WindowManagerDelegate,
public mojo::ViewObserver,
public TestRunnerClient {
public:
SkyTester()
- : window_manager_app_(new mojo::WindowManagerApp(this, this)),
+ : window_manager_app_(new window_manager::WindowManagerApp(this, this)),
view_manager_(NULL),
root_(NULL),
content_(NULL),
@@ -81,7 +81,7 @@
ScheduleRun();
}
- // Overridden from WindowManagerDelegate:
+ // Overridden from window_manager::WindowManagerDelegate:
virtual void Embed(
const mojo::String& url,
mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) override {
@@ -125,7 +125,7 @@
window_manager_app_->DispatchInputEventToView(content_, event.Pass());
}
- scoped_ptr<mojo::WindowManagerApp> window_manager_app_;
+ scoped_ptr<window_manager::WindowManagerApp> window_manager_app_;
std::string url_from_args_;