diff options
Diffstat (limited to 'components/mus')
128 files changed, 724 insertions, 723 deletions
diff --git a/components/mus/BUILD.gn b/components/mus/BUILD.gn index 956f8ff..d0deea3 100644 --- a/components/mus/BUILD.gn +++ b/components/mus/BUILD.gn @@ -61,8 +61,6 @@ source_set("lib") { "gesture_manager.cc", "gesture_manager.h", "gesture_manager_delegate.h", - "mus_app.cc", - "mus_app.h", "server_view.cc", "server_view.h", "server_view_delegate.h", @@ -74,6 +72,8 @@ source_set("lib") { "view_coordinate_conversions.h", "view_locator.cc", "view_locator.h", + "view_manager_app.cc", + "view_manager_app.h", "view_tree_host_connection.cc", "view_tree_host_connection.h", "view_tree_host_delegate.h", diff --git a/components/mus/access_policy.h b/components/mus/access_policy.h index 7537d30..ca9f5bb 100644 --- a/components/mus/access_policy.h +++ b/components/mus/access_policy.h @@ -6,9 +6,9 @@ #define COMPONENTS_MUS_ACCESS_POLICY_H_ #include "components/mus/ids.h" -#include "components/mus/public/interfaces/mus_constants.mojom.h" +#include "components/mus/public/interfaces/view_manager_constants.mojom.h" -namespace mus { +namespace view_manager { class ServerView; @@ -54,6 +54,6 @@ class AccessPolicy { const ServerView* focused) = 0; }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_ACCESS_POLICY_H_ diff --git a/components/mus/access_policy_delegate.h b/components/mus/access_policy_delegate.h index 146a5b6..af4a50d 100644 --- a/components/mus/access_policy_delegate.h +++ b/components/mus/access_policy_delegate.h @@ -10,7 +10,7 @@ #include "base/containers/hash_tables.h" #include "components/mus/ids.h" -namespace mus { +namespace view_manager { class ServerView; @@ -35,6 +35,6 @@ class AccessPolicyDelegate { virtual ~AccessPolicyDelegate() {} }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_ACCESS_POLICY_DELEGATE_H_ diff --git a/components/mus/android_loader.cc b/components/mus/android_loader.cc index 06b7869..721be71 100644 --- a/components/mus/android_loader.cc +++ b/components/mus/android_loader.cc @@ -4,10 +4,10 @@ #include "components/mus/android_loader.h" -#include "components/mus/mus_app.h" +#include "components/mus/view_manager_app.h" #include "mojo/application/public/cpp/application_impl.h" -namespace mus { +namespace view_manager { AndroidLoader::AndroidLoader() {} AndroidLoader::~AndroidLoader() {} @@ -16,8 +16,8 @@ void AndroidLoader::Load( const GURL& url, mojo::InterfaceRequest<mojo::Application> application_request) { DCHECK(application_request.is_pending()); - app_.reset(new mojo::ApplicationImpl(new MandolineUIServicesApp, + app_.reset(new mojo::ApplicationImpl(new ViewManagerApp, application_request.Pass())); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/android_loader.h b/components/mus/android_loader.h index 476c573..8ae30f5 100644 --- a/components/mus/android_loader.h +++ b/components/mus/android_loader.h @@ -11,7 +11,7 @@ namespace mojo { class ApplicationImpl; } -namespace mus { +namespace view_manager { class AndroidLoader : public mojo::shell::ApplicationLoader { public: @@ -29,6 +29,6 @@ class AndroidLoader : public mojo::shell::ApplicationLoader { DISALLOW_COPY_AND_ASSIGN(AndroidLoader); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_ANDROID_LOADER_H_ diff --git a/components/mus/client_connection.cc b/components/mus/client_connection.cc index a785084..cf13eed 100644 --- a/components/mus/client_connection.cc +++ b/components/mus/client_connection.cc @@ -7,7 +7,7 @@ #include "components/mus/connection_manager.h" #include "components/mus/view_tree_impl.h" -namespace mus { +namespace view_manager { ClientConnection::ClientConnection(scoped_ptr<ViewTreeImpl> service, mojo::ViewTreeClient* client) @@ -30,4 +30,4 @@ DefaultClientConnection::DefaultClientConnection( DefaultClientConnection::~DefaultClientConnection() {} -} // namespace mus +} // namespace view_manager diff --git a/components/mus/client_connection.h b/components/mus/client_connection.h index 6954141..dd09c21 100644 --- a/components/mus/client_connection.h +++ b/components/mus/client_connection.h @@ -9,7 +9,7 @@ #include "components/mus/public/interfaces/view_tree.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" -namespace mus { +namespace view_manager { class ConnectionManager; class ViewTreeImpl; @@ -52,6 +52,6 @@ class DefaultClientConnection : public ClientConnection { DISALLOW_COPY_AND_ASSIGN(DefaultClientConnection); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_CLIENT_CONNECTION_H_ diff --git a/components/mus/connection_manager.cc b/components/mus/connection_manager.cc index 8186ac2..0bd6602 100644 --- a/components/mus/connection_manager.cc +++ b/components/mus/connection_manager.cc @@ -20,7 +20,9 @@ #include "mojo/converters/surfaces/surfaces_type_converters.h" #include "ui/gfx/geometry/size_conversions.h" -namespace mus { +using mojo::ConnectionSpecificId; + +namespace view_manager { ConnectionManager::ScopedChange::ScopedChange( ViewTreeImpl* connection, @@ -38,7 +40,7 @@ ConnectionManager::ScopedChange::~ScopedChange() { ConnectionManager::ConnectionManager( ConnectionManagerDelegate* delegate, - const scoped_refptr<SurfacesState>& surfaces_state) + const scoped_refptr<surfaces::SurfacesState>& surfaces_state) : delegate_(delegate), surfaces_state_(surfaces_state), next_connection_id_(1), @@ -127,7 +129,7 @@ void ConnectionManager::OnHostConnectionClosed( delegate_->OnNoMoreRootConnections(); } -void ConnectionManager::EmbedAtView(ConnectionSpecificId creator_id, +void ConnectionManager::EmbedAtView(mojo::ConnectionSpecificId creator_id, const ViewId& view_id, uint32_t policy_bitmask, mojo::URLRequestPtr request) { @@ -142,10 +144,11 @@ void ConnectionManager::EmbedAtView(ConnectionSpecificId creator_id, OnConnectionMessagedClient(client_connection->service()->id()); } -ViewTreeImpl* ConnectionManager::EmbedAtView(ConnectionSpecificId creator_id, - const ViewId& view_id, - uint32_t policy_bitmask, - mojo::ViewTreeClientPtr client) { +ViewTreeImpl* ConnectionManager::EmbedAtView( + mojo::ConnectionSpecificId creator_id, + const ViewId& view_id, + uint32_t policy_bitmask, + mojo::ViewTreeClientPtr client) { mojo::ViewTreePtr service_ptr; ClientConnection* client_connection = delegate_->CreateClientConnectionForEmbedAtView( @@ -332,7 +335,7 @@ ConnectionManager::UpdateViewTreeFromCompositorFrame( return ConvertToCompositorFrame(input, this); } -SurfacesState* ConnectionManager::GetSurfacesState() { +surfaces::SurfacesState* ConnectionManager::GetSurfacesState() { return surfaces_state_.get(); } @@ -461,4 +464,4 @@ bool ConnectionManager::ConvertSurfaceDrawQuad( return true; } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/connection_manager.h b/components/mus/connection_manager.h index 673ec12..3aadfc1 100644 --- a/components/mus/connection_manager.h +++ b/components/mus/connection_manager.h @@ -23,7 +23,7 @@ #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" -namespace mus { +namespace view_manager { class ClientConnection; class ConnectionManagerDelegate; @@ -46,32 +46,33 @@ class ConnectionManager : public ServerViewDelegate, bool is_delete_view); ~ScopedChange(); - ConnectionSpecificId connection_id() const { return connection_id_; } + mojo::ConnectionSpecificId connection_id() const { return connection_id_; } bool is_delete_view() const { return is_delete_view_; } // Marks the connection with the specified id as having seen a message. - void MarkConnectionAsMessaged(ConnectionSpecificId connection_id) { + void MarkConnectionAsMessaged(mojo::ConnectionSpecificId connection_id) { message_ids_.insert(connection_id); } // Returns true if MarkConnectionAsMessaged(connection_id) was invoked. - bool DidMessageConnection(ConnectionSpecificId connection_id) const { + bool DidMessageConnection(mojo::ConnectionSpecificId connection_id) const { return message_ids_.count(connection_id) > 0; } private: ConnectionManager* connection_manager_; - const ConnectionSpecificId connection_id_; + const mojo::ConnectionSpecificId connection_id_; const bool is_delete_view_; // See description of MarkConnectionAsMessaged/DidMessageConnection. - std::set<ConnectionSpecificId> message_ids_; + std::set<mojo::ConnectionSpecificId> message_ids_; DISALLOW_COPY_AND_ASSIGN(ScopedChange); }; - ConnectionManager(ConnectionManagerDelegate* delegate, - const scoped_refptr<SurfacesState>& surfaces_state); + ConnectionManager( + ConnectionManagerDelegate* delegate, + const scoped_refptr<surfaces::SurfacesState>& surfaces_state); ~ConnectionManager() override; // Adds a ViewTreeHost. @@ -82,7 +83,7 @@ class ConnectionManager : public ServerViewDelegate, ServerView* CreateServerView(const ViewId& id); // Returns the id for the next ViewTreeImpl. - ConnectionSpecificId GetAndAdvanceNextConnectionId(); + mojo::ConnectionSpecificId GetAndAdvanceNextConnectionId(); // Returns the id for the next ViewTreeHostImpl. uint16_t GetAndAdvanceNextHostId(); @@ -96,17 +97,17 @@ class ConnectionManager : public ServerViewDelegate, // See description of ViewTree::Embed() for details. This assumes // |transport_view_id| is valid. - void EmbedAtView(ConnectionSpecificId creator_id, + void EmbedAtView(mojo::ConnectionSpecificId creator_id, const ViewId& view_id, uint32_t policy_bitmask, mojo::URLRequestPtr request); - ViewTreeImpl* EmbedAtView(ConnectionSpecificId creator_id, + ViewTreeImpl* EmbedAtView(mojo::ConnectionSpecificId creator_id, const ViewId& view_id, uint32_t policy_bitmask, mojo::ViewTreeClientPtr client); // Returns the connection by id. - ViewTreeImpl* GetConnection(ConnectionSpecificId connection_id); + ViewTreeImpl* GetConnection(mojo::ConnectionSpecificId connection_id); // Returns the View identified by |id|. ServerView* GetView(const ViewId& id); @@ -129,10 +130,10 @@ class ConnectionManager : public ServerViewDelegate, // Invoked when a connection messages a client about the change. This is used // to avoid sending ServerChangeIdAdvanced() unnecessarily. - void OnConnectionMessagedClient(ConnectionSpecificId id); + void OnConnectionMessagedClient(mojo::ConnectionSpecificId id); // Returns true if OnConnectionMessagedClient() was invoked for id. - bool DidConnectionMessageClient(ConnectionSpecificId id) const; + bool DidConnectionMessageClient(mojo::ConnectionSpecificId id) const; // Returns the metrics of the viewport where the provided |view| is displayed. mojo::ViewportMetricsPtr GetViewportMetricsForView(const ServerView* view); @@ -176,7 +177,7 @@ class ConnectionManager : public ServerViewDelegate, void ProcessViewDeleted(const ViewId& view); private: - using ConnectionMap = std::map<ConnectionSpecificId, ClientConnection*>; + using ConnectionMap = std::map<mojo::ConnectionSpecificId, ClientConnection*>; using HostConnectionMap = std::map<ViewTreeHostImpl*, ViewTreeHostConnection*>; @@ -192,7 +193,7 @@ class ConnectionManager : public ServerViewDelegate, void FinishChange(); // Returns true if the specified connection originated the current change. - bool IsChangeSource(ConnectionSpecificId connection_id) const { + bool IsChangeSource(mojo::ConnectionSpecificId connection_id) const { return current_change_ && current_change_->connection_id() == connection_id; } @@ -202,7 +203,7 @@ class ConnectionManager : public ServerViewDelegate, // Overridden from ServerViewDelegate: scoped_ptr<cc::CompositorFrame> UpdateViewTreeFromCompositorFrame( const mojo::CompositorFramePtr& input) override; - SurfacesState* GetSurfacesState() override; + surfaces::SurfacesState* GetSurfacesState() override; void OnScheduleViewPaint(const ServerView* view) override; const ServerView* GetRootView(const ServerView* view) const override; @@ -237,10 +238,10 @@ class ConnectionManager : public ServerViewDelegate, ConnectionManagerDelegate* delegate_; // State for rendering into a Surface. - scoped_refptr<SurfacesState> surfaces_state_; + scoped_refptr<surfaces::SurfacesState> surfaces_state_; // ID to use for next ViewTreeImpl. - ConnectionSpecificId next_connection_id_; + mojo::ConnectionSpecificId next_connection_id_; // ID to use for next ViewTreeHostImpl. uint16_t next_host_id_; @@ -260,6 +261,6 @@ class ConnectionManager : public ServerViewDelegate, DISALLOW_COPY_AND_ASSIGN(ConnectionManager); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_CONNECTION_MANAGER_H_ diff --git a/components/mus/connection_manager_delegate.h b/components/mus/connection_manager_delegate.h index 8d7a025..8a17146 100644 --- a/components/mus/connection_manager_delegate.h +++ b/components/mus/connection_manager_delegate.h @@ -11,12 +11,15 @@ #include "components/mus/public/interfaces/view_tree.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" -namespace mus { +namespace mojo { +class ViewTree; +} + +namespace view_manager { class ClientConnection; class ConnectionManager; struct ViewId; -class ViewTree; class ConnectionManagerDelegate { public: @@ -27,14 +30,14 @@ class ConnectionManagerDelegate { virtual ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, mojo::InterfaceRequest<mojo::ViewTree> tree_request, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, mojo::URLRequestPtr request, const ViewId& root_id, uint32_t policy_bitmask) = 0; virtual ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, mojo::InterfaceRequest<mojo::ViewTree> tree_request, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask, mojo::ViewTreeClientPtr client) = 0; @@ -43,6 +46,6 @@ class ConnectionManagerDelegate { virtual ~ConnectionManagerDelegate() {} }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_CONNECTION_MANAGER_DELEGATE_H_ diff --git a/components/mus/default_access_policy.cc b/components/mus/default_access_policy.cc index f5ffd78d..c7ff733 100644 --- a/components/mus/default_access_policy.cc +++ b/components/mus/default_access_policy.cc @@ -7,10 +7,11 @@ #include "components/mus/access_policy_delegate.h" #include "components/mus/server_view.h" -namespace mus { +namespace view_manager { -DefaultAccessPolicy::DefaultAccessPolicy(ConnectionSpecificId connection_id, - AccessPolicyDelegate* delegate) +DefaultAccessPolicy::DefaultAccessPolicy( + mojo::ConnectionSpecificId connection_id, + AccessPolicyDelegate* delegate) : connection_id_(connection_id), delegate_(delegate) {} DefaultAccessPolicy::~DefaultAccessPolicy() {} @@ -143,4 +144,4 @@ bool DefaultAccessPolicy::IsDescendantOfEmbedRoot( return delegate_->IsDescendantOfEmbedRoot(view); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/default_access_policy.h b/components/mus/default_access_policy.h index 7ee9b88..2cf28e0 100644 --- a/components/mus/default_access_policy.h +++ b/components/mus/default_access_policy.h @@ -8,14 +8,14 @@ #include "base/basictypes.h" #include "components/mus/access_policy.h" -namespace mus { +namespace view_manager { class AccessPolicyDelegate; // AccessPolicy for all connections, except the window manager. class DefaultAccessPolicy : public AccessPolicy { public: - DefaultAccessPolicy(ConnectionSpecificId connection_id, + DefaultAccessPolicy(mojo::ConnectionSpecificId connection_id, AccessPolicyDelegate* delegate); ~DefaultAccessPolicy() override; @@ -46,12 +46,12 @@ class DefaultAccessPolicy : public AccessPolicy { bool WasCreatedByThisConnection(const ServerView* view) const; bool IsDescendantOfEmbedRoot(const ServerView* view) const; - const ConnectionSpecificId connection_id_; + const mojo::ConnectionSpecificId connection_id_; AccessPolicyDelegate* delegate_; DISALLOW_COPY_AND_ASSIGN(DefaultAccessPolicy); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_DEFAULT_ACCESS_POLICY_H_ diff --git a/components/mus/display_manager.cc b/components/mus/display_manager.cc index 195d5a1..e98a090 100644 --- a/components/mus/display_manager.cc +++ b/components/mus/display_manager.cc @@ -44,7 +44,7 @@ using mojo::Rect; using mojo::Size; -namespace mus { +namespace view_manager { namespace { void DrawViewTree(cc::RenderPass* pass, @@ -90,8 +90,8 @@ DisplayManagerFactory* DisplayManager::factory_ = nullptr; DisplayManager* DisplayManager::Create( bool is_headless, mojo::ApplicationImpl* app_impl, - const scoped_refptr<GpuState>& gpu_state, - const scoped_refptr<SurfacesState>& surfaces_state) { + const scoped_refptr<gles2::GpuState>& gpu_state, + const scoped_refptr<surfaces::SurfacesState>& surfaces_state) { if (factory_) { return factory_->CreateDisplayManager(is_headless, app_impl, gpu_state, surfaces_state); @@ -103,8 +103,8 @@ DisplayManager* DisplayManager::Create( DefaultDisplayManager::DefaultDisplayManager( bool is_headless, mojo::ApplicationImpl* app_impl, - const scoped_refptr<GpuState>& gpu_state, - const scoped_refptr<SurfacesState>& surfaces_state) + const scoped_refptr<gles2::GpuState>& gpu_state, + const scoped_refptr<surfaces::SurfacesState>& surfaces_state) : is_headless_(is_headless), app_impl_(app_impl), gpu_state_(gpu_state), @@ -321,12 +321,12 @@ void DefaultDisplayManager::OnAcceleratedWidgetAvailable( gfx::AcceleratedWidget widget, float device_pixel_ratio) { if (widget != gfx::kNullAcceleratedWidget) { - top_level_display_client_.reset( - new TopLevelDisplayClient(widget, gpu_state_, surfaces_state_)); + top_level_display_client_.reset(new surfaces::TopLevelDisplayClient( + widget, gpu_state_, surfaces_state_)); } UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); } void DefaultDisplayManager::OnActivationChanged(bool active) {} -} // namespace mus +} // namespace view_manager diff --git a/components/mus/display_manager.h b/components/mus/display_manager.h index 4173f36..3f2dc78 100644 --- a/components/mus/display_manager.h +++ b/components/mus/display_manager.h @@ -31,18 +31,21 @@ namespace mojo { class ApplicationImpl; } // namespace mojo +namespace surfaces { +class SurfacesScheduler; +class SurfacesState; +} // namespace surfaces + namespace ui { class PlatformWindow; struct TextInputState; } // namespace ui -namespace mus { +namespace view_manager { class DisplayManagerFactory; class EventDispatcher; class ServerView; -class SurfacesScheduler; -class SurfacesState; // DisplayManager is used to connect the root ServerView to a display. class DisplayManager { @@ -52,8 +55,8 @@ class DisplayManager { static DisplayManager* Create( bool is_headless, mojo::ApplicationImpl* app_impl, - const scoped_refptr<GpuState>& gpu_state, - const scoped_refptr<SurfacesState>& surfaces_state); + const scoped_refptr<gles2::GpuState>& gpu_state, + const scoped_refptr<surfaces::SurfacesState>& surfaces_state); virtual void Init(DisplayManagerDelegate* delegate) = 0; @@ -86,10 +89,11 @@ class DisplayManager { class DefaultDisplayManager : public DisplayManager, public ui::PlatformWindowDelegate { public: - DefaultDisplayManager(bool is_headless, - mojo::ApplicationImpl* app_impl, - const scoped_refptr<GpuState>& gpu_state, - const scoped_refptr<SurfacesState>& surfaces_state); + DefaultDisplayManager( + bool is_headless, + mojo::ApplicationImpl* app_impl, + const scoped_refptr<gles2::GpuState>& gpu_state, + const scoped_refptr<surfaces::SurfacesState>& surfaces_state); ~DefaultDisplayManager() override; // DisplayManager: @@ -121,8 +125,8 @@ class DefaultDisplayManager : public DisplayManager, bool is_headless_; mojo::ApplicationImpl* app_impl_; - scoped_refptr<GpuState> gpu_state_; - scoped_refptr<SurfacesState> surfaces_state_; + scoped_refptr<gles2::GpuState> gpu_state_; + scoped_refptr<surfaces::SurfacesState> surfaces_state_; DisplayManagerDelegate* delegate_; mojo::ViewportMetrics metrics_; @@ -130,7 +134,7 @@ class DefaultDisplayManager : public DisplayManager, base::Timer draw_timer_; bool frame_pending_; - scoped_ptr<TopLevelDisplayClient> top_level_display_client_; + scoped_ptr<surfaces::TopLevelDisplayClient> top_level_display_client_; scoped_ptr<ui::PlatformWindow> platform_window_; base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; @@ -138,6 +142,6 @@ class DefaultDisplayManager : public DisplayManager, DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_DISPLAY_MANAGER_H_ diff --git a/components/mus/display_manager_delegate.h b/components/mus/display_manager_delegate.h index c5bdc5b..c6108ff 100644 --- a/components/mus/display_manager_delegate.h +++ b/components/mus/display_manager_delegate.h @@ -7,7 +7,7 @@ #include "components/mus/public/interfaces/view_tree.mojom.h" -namespace mus { +namespace view_manager { class ServerView; @@ -34,6 +34,6 @@ class DisplayManagerDelegate { virtual ~DisplayManagerDelegate() {} }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_DISPLAY_MANAGER_DELEGATE_H_ diff --git a/components/mus/display_manager_factory.h b/components/mus/display_manager_factory.h index e59424f..58b0ee0 100644 --- a/components/mus/display_manager_factory.h +++ b/components/mus/display_manager_factory.h @@ -8,11 +8,11 @@ #include "components/mus/gles2/gpu_state.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h" -namespace mus { +namespace mojo { class ApplicationImpl; -} // namespace mus +} // namespace mojo -namespace mus { +namespace view_manager { class DisplayManager; @@ -23,10 +23,10 @@ class DisplayManagerFactory { virtual DisplayManager* CreateDisplayManager( bool is_headless, mojo::ApplicationImpl* app_impl, - const scoped_refptr<GpuState>& gpu_state, - const scoped_refptr<SurfacesState>& surfaces_state) = 0; + const scoped_refptr<gles2::GpuState>& gpu_state, + const scoped_refptr<surfaces::SurfacesState>& surfaces_state) = 0; }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_DISPLAY_MANAGER_FACTORY_H_ diff --git a/components/mus/event_dispatcher.cc b/components/mus/event_dispatcher.cc index c505f2f..9796267 100644 --- a/components/mus/event_dispatcher.cc +++ b/components/mus/event_dispatcher.cc @@ -11,7 +11,7 @@ #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point_f.h" -namespace mus { +namespace view_manager { EventDispatcher::EventDispatcher(ViewTreeHostImpl* view_tree_host) : view_tree_host_(view_tree_host) {} @@ -93,4 +93,4 @@ ServerView* EventDispatcher::FindEventTarget(mojo::Event* event) { return focused_view; } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/event_dispatcher.h b/components/mus/event_dispatcher.h index 0bb5200..a30b459 100644 --- a/components/mus/event_dispatcher.h +++ b/components/mus/event_dispatcher.h @@ -12,7 +12,7 @@ #include "ui/mojo/events/input_events.mojom.h" #include "ui/mojo/events/input_key_codes.mojom.h" -namespace mus { +namespace view_manager { class ServerView; class ViewTreeHostImpl; @@ -65,6 +65,6 @@ class EventDispatcher { DISALLOW_COPY_AND_ASSIGN(EventDispatcher); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_EVENT_DISPATCHER_H_ diff --git a/components/mus/focus_controller.cc b/components/mus/focus_controller.cc index f2b56fc1..af19112 100644 --- a/components/mus/focus_controller.cc +++ b/components/mus/focus_controller.cc @@ -8,7 +8,7 @@ #include "components/mus/server_view.h" #include "components/mus/server_view_drawn_tracker.h" -namespace mus { +namespace view_manager { FocusController::FocusController(FocusControllerDelegate* delegate) : delegate_(delegate) {} @@ -48,4 +48,4 @@ void FocusController::OnDrawnStateChanged(ServerView* ancestor, SetFocusedViewImpl(ancestor, CHANGE_SOURCE_DRAWN_STATE_CHANGED); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/focus_controller.h b/components/mus/focus_controller.h index c732a94..12d2d41 100644 --- a/components/mus/focus_controller.h +++ b/components/mus/focus_controller.h @@ -8,7 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "components/mus/server_view_drawn_tracker_observer.h" -namespace mus { +namespace view_manager { class FocusControllerDelegate; class ServerView; @@ -47,6 +47,6 @@ class FocusController : public ServerViewDrawnTrackerObserver { DISALLOW_COPY_AND_ASSIGN(FocusController); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_FOCUS_CONTROLLER_H_ diff --git a/components/mus/focus_controller_delegate.h b/components/mus/focus_controller_delegate.h index 60556e2..a5be3c6 100644 --- a/components/mus/focus_controller_delegate.h +++ b/components/mus/focus_controller_delegate.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_MUS_FOCUS_CONTROLLER_DELEGATE_H_ #define COMPONENTS_MUS_FOCUS_CONTROLLER_DELEGATE_H_ -namespace mus { +namespace view_manager { class ServerView; @@ -18,6 +18,6 @@ class FocusControllerDelegate { ~FocusControllerDelegate() {} }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_FOCUS_CONTROLLER_DELEGATE_H_ diff --git a/components/mus/focus_controller_unittest.cc b/components/mus/focus_controller_unittest.cc index 162bcea..cff4055 100644 --- a/components/mus/focus_controller_unittest.cc +++ b/components/mus/focus_controller_unittest.cc @@ -9,7 +9,7 @@ #include "components/mus/test_server_view_delegate.h" #include "testing/gtest/include/gtest/gtest.h" -namespace mus { +namespace view_manager { namespace { class TestFocusControllerDelegate : public FocusControllerDelegate { @@ -104,4 +104,4 @@ TEST(FocusControllerTest, Basic) { focus_delegate.ClearAll(); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/gesture_manager.cc b/components/mus/gesture_manager.cc index 0b35c9a..f83cefb 100644 --- a/components/mus/gesture_manager.cc +++ b/components/mus/gesture_manager.cc @@ -14,7 +14,7 @@ #include "ui/gfx/geometry/point_f.h" #include "ui/mojo/events/input_events.mojom.h" -namespace mus { +namespace view_manager { using Views = std::vector<const ServerView*>; @@ -36,7 +36,7 @@ Views GetTouchTargets(const ServerView* deepest) { Views result; const ServerView* view = deepest; while (view) { - if (view->properties().count(kViewManagerKeyWantsTouchEvents)) { + if (view->properties().count(mojo::kViewManagerKeyWantsTouchEvents)) { if (!result.empty() && result.back()->id().connection_id == view->id().connection_id) { result.pop_back(); @@ -693,4 +693,4 @@ void GestureManager::ScheduleDelete(Pointer* pointer) { } } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/gesture_manager.h b/components/mus/gesture_manager.h index 2eac355..373e8f8 100644 --- a/components/mus/gesture_manager.h +++ b/components/mus/gesture_manager.h @@ -15,7 +15,7 @@ namespace mojo { class Event; } -namespace mus { +namespace view_manager { class GestureManagerDelegate; class GestureManagerTest; @@ -183,6 +183,6 @@ class GestureManager { DISALLOW_COPY_AND_ASSIGN(GestureManager); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_GESTURE_MANAGER_H_ diff --git a/components/mus/gesture_manager_delegate.h b/components/mus/gesture_manager_delegate.h index d6a47a34..d26b2dc 100644 --- a/components/mus/gesture_manager_delegate.h +++ b/components/mus/gesture_manager_delegate.h @@ -10,7 +10,7 @@ #include "components/mus/public/cpp/types.h" #include "ui/mojo/events/input_events.mojom.h" -namespace mus { +namespace view_manager { class GestureManagerDelegate { public: @@ -26,6 +26,6 @@ class GestureManagerDelegate { virtual ~GestureManagerDelegate() {} }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_GESTURE_MANAGER_DELEGATE_H_ diff --git a/components/mus/gesture_manager_unittest.cc b/components/mus/gesture_manager_unittest.cc index 25b1cad0..2f2ed62 100644 --- a/components/mus/gesture_manager_unittest.cc +++ b/components/mus/gesture_manager_unittest.cc @@ -13,14 +13,14 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/mojo/events/input_events.mojom.h" -namespace mus { +namespace view_manager { namespace { const uint32_t kInvalidGestureId = GestureManager::kInvalidGestureId; void MarkAsRespondsToTouch(ServerView* view) { std::vector<uint8_t> empty_vector; - view->SetProperty(kViewManagerKeyWantsTouchEvents, &empty_vector); + view->SetProperty(mojo::kViewManagerKeyWantsTouchEvents, &empty_vector); } std::set<uint32_t> SetWith(uint32_t v1) { @@ -465,4 +465,4 @@ TEST_F(GestureManagerTest, SingleViewSingleGestureCancel) { gesture_delegate_.GetAndClearDescriptions()); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/gles2/command_buffer_driver.cc b/components/mus/gles2/command_buffer_driver.cc index 97f88bd..350f512 100644 --- a/components/mus/gles2/command_buffer_driver.cc +++ b/components/mus/gles2/command_buffer_driver.cc @@ -32,7 +32,7 @@ #include "ui/gl/gl_image_shared_memory.h" #include "ui/gl/gl_surface.h" -namespace mus { +namespace gles2 { CommandBufferDriver::Client::~Client() {} @@ -131,7 +131,7 @@ bool CommandBufferDriver::DoInitialize( const size_t kSize = sizeof(gpu::CommandBufferSharedState); scoped_ptr<gpu::BufferBacking> backing( - MojoBufferBacking::Create(shared_state.Pass(), kSize)); + gles2::MojoBufferBacking::Create(shared_state.Pass(), kSize)); if (!backing) return false; @@ -167,7 +167,7 @@ void CommandBufferDriver::RegisterTransferBuffer( // Take ownership of the memory and map it into this process. // This validates the size. scoped_ptr<gpu::BufferBacking> backing( - MojoBufferBacking::Create(transfer_buffer.Pass(), size)); + gles2::MojoBufferBacking::Create(transfer_buffer.Pass(), size)); if (!backing) { DVLOG(0) << "Failed to map shared memory."; return; @@ -302,4 +302,4 @@ void CommandBufferDriver::DestroyDecoder() { } } -} // namespace mus +} // namespace gles2 diff --git a/components/mus/gles2/command_buffer_driver.h b/components/mus/gles2/command_buffer_driver.h index 4a19d11..09c4c70 100644 --- a/components/mus/gles2/command_buffer_driver.h +++ b/components/mus/gles2/command_buffer_driver.h @@ -28,7 +28,7 @@ class GLContext; class GLSurface; } -namespace mus { +namespace gles2 { class GpuState; @@ -94,6 +94,6 @@ class CommandBufferDriver { DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ diff --git a/components/mus/gles2/command_buffer_impl.cc b/components/mus/gles2/command_buffer_impl.cc index 7944f4c0..2cc4ca7 100644 --- a/components/mus/gles2/command_buffer_impl.cc +++ b/components/mus/gles2/command_buffer_impl.cc @@ -11,14 +11,11 @@ #include "components/mus/gles2/gpu_state.h" #include "gpu/command_buffer/service/sync_point_manager.h" -namespace mus { - +namespace gles2 { namespace { - void RunCallback(const mojo::Callback<void()>& callback) { callback.Run(); } - } // namespace class CommandBufferImpl::CommandBufferDriverClientImpl @@ -170,4 +167,4 @@ void CommandBufferImpl::DidLoseContext() { OnConnectionError(); } -} // namespace mus +} // namespace gles2 diff --git a/components/mus/gles2/command_buffer_impl.h b/components/mus/gles2/command_buffer_impl.h index 46f8273..7992391 100644 --- a/components/mus/gles2/command_buffer_impl.h +++ b/components/mus/gles2/command_buffer_impl.h @@ -11,8 +11,7 @@ #include "components/mus/public/interfaces/command_buffer.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" -namespace mus { - +namespace gles2 { class CommandBufferDriver; class CommandBufferImplObserver; class GpuState; @@ -78,6 +77,6 @@ class CommandBufferImpl : public mojo::CommandBuffer { DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_ diff --git a/components/mus/gles2/command_buffer_impl_observer.h b/components/mus/gles2/command_buffer_impl_observer.h index 6ea42de..c39b497 100644 --- a/components/mus/gles2/command_buffer_impl_observer.h +++ b/components/mus/gles2/command_buffer_impl_observer.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_GLES2_COMMAND_BUFFER_IMPL_OBSERVER_H_ #define COMPONENTS_GLES2_COMMAND_BUFFER_IMPL_OBSERVER_H_ -namespace mus { +namespace gles2 { class CommandBufferImplObserver { public: @@ -15,6 +15,6 @@ class CommandBufferImplObserver { ~CommandBufferImplObserver() {} }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_IMPL_OBSERVER_H_ diff --git a/components/mus/gles2/command_buffer_local.cc b/components/mus/gles2/command_buffer_local.cc index f6e15a0..3d2ac95 100644 --- a/components/mus/gles2/command_buffer_local.cc +++ b/components/mus/gles2/command_buffer_local.cc @@ -22,13 +22,14 @@ #include "ui/gl/gl_image_memory.h" #include "ui/gl/gl_surface.h" -namespace mus { +namespace gles2 { const unsigned int GL_MAP_CHROMIUM = 0x78F1; -CommandBufferLocal::CommandBufferLocal(CommandBufferLocalClient* client, - gfx::AcceleratedWidget widget, - const scoped_refptr<GpuState>& gpu_state) +CommandBufferLocal::CommandBufferLocal( + CommandBufferLocalClient* client, + gfx::AcceleratedWidget widget, + const scoped_refptr<gles2::GpuState>& gpu_state) : widget_(widget), gpu_state_(gpu_state), client_(client), @@ -74,7 +75,7 @@ bool CommandBufferLocal::Initialize() { bool bind_generates_resource = false; scoped_refptr<gpu::gles2::ContextGroup> context_group = new gpu::gles2::ContextGroup( - gpu_state_->mailbox_manager(), new GpuMemoryTracker, + gpu_state_->mailbox_manager(), new gles2::GpuMemoryTracker, new gpu::gles2::ShaderTranslatorCache, new gpu::gles2::FramebufferCompletenessCache, nullptr, nullptr, nullptr, bind_generates_resource); @@ -127,8 +128,8 @@ int32_t CommandBufferLocal::CreateImage(ClientBuffer buffer, size_t width, size_t height, unsigned internalformat) { - MojoGpuMemoryBufferImpl* gpu_memory_buffer = - MojoGpuMemoryBufferImpl::FromClientBuffer(buffer); + gles2::MojoGpuMemoryBufferImpl* gpu_memory_buffer = + gles2::MojoGpuMemoryBufferImpl::FromClientBuffer(buffer); scoped_refptr<gfx::GLImageMemory> image(new gfx::GLImageMemory( gfx::Size(static_cast<int>(width), static_cast<int>(height)), @@ -159,10 +160,11 @@ int32_t CommandBufferLocal::CreateGpuMemoryBufferImage(size_t width, unsigned internalformat, unsigned usage) { DCHECK_EQ(usage, static_cast<unsigned>(GL_MAP_CHROMIUM)); - scoped_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create( - gfx::Size(static_cast<int>(width), static_cast<int>(height)), - gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat), - gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage))); + scoped_ptr<gfx::GpuMemoryBuffer> buffer( + gles2::MojoGpuMemoryBufferImpl::Create( + gfx::Size(static_cast<int>(width), static_cast<int>(height)), + gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat), + gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage))); if (!buffer) return -1; return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); @@ -257,4 +259,4 @@ void CommandBufferLocal::OnSyncPointRetired() { scheduler_->SetScheduled(true); } -} // namespace mus +} // namespace gles2 diff --git a/components/mus/gles2/command_buffer_local.h b/components/mus/gles2/command_buffer_local.h index 14c4821..bc50bdf 100644 --- a/components/mus/gles2/command_buffer_local.h +++ b/components/mus/gles2/command_buffer_local.h @@ -31,10 +31,9 @@ class GLContext; class GLSurface; } -namespace mus { +namespace gles2 { class CommandBufferLocalClient; -class GpuState; // This class provides a thin wrapper around a CommandBufferService and a // GpuControl implementation to allow cc::Display to generate GL directly on @@ -43,7 +42,7 @@ class CommandBufferLocal : public gpu::GpuControl { public: CommandBufferLocal(CommandBufferLocalClient* client, gfx::AcceleratedWidget widget, - const scoped_refptr<GpuState>& gpu_state); + const scoped_refptr<gles2::GpuState>& gpu_state); ~CommandBufferLocal() override; bool Initialize(); @@ -84,7 +83,7 @@ class CommandBufferLocal : public gpu::GpuControl { void OnSyncPointRetired(); gfx::AcceleratedWidget widget_; - scoped_refptr<GpuState> gpu_state_; + scoped_refptr<gles2::GpuState> gpu_state_; scoped_ptr<gpu::CommandBufferService> command_buffer_; scoped_ptr<gpu::GpuScheduler> scheduler_; scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; @@ -97,6 +96,6 @@ class CommandBufferLocal : public gpu::GpuControl { DISALLOW_COPY_AND_ASSIGN(CommandBufferLocal); }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_ diff --git a/components/mus/gles2/command_buffer_local_client.h b/components/mus/gles2/command_buffer_local_client.h index b4e237a..ce644ae 100644 --- a/components/mus/gles2/command_buffer_local_client.h +++ b/components/mus/gles2/command_buffer_local_client.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_CLIENT_H_ #define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_CLIENT_H_ -namespace mus { +namespace gles2 { class CommandBufferLocalClient { public: @@ -16,6 +16,6 @@ class CommandBufferLocalClient { virtual ~CommandBufferLocalClient() {} }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_CLIENT_H_ diff --git a/components/mus/gles2/command_buffer_type_conversions.cc b/components/mus/gles2/command_buffer_type_conversions.cc index 3762e47..2ec6484 100644 --- a/components/mus/gles2/command_buffer_type_conversions.cc +++ b/components/mus/gles2/command_buffer_type_conversions.cc @@ -167,4 +167,4 @@ gpu::Capabilities TypeConverter<gpu::Capabilities, GpuCapabilitiesPtr>::Convert( return result; } -} // namespace mojo +} // namespace gles2 diff --git a/components/mus/gles2/command_buffer_type_conversions.h b/components/mus/gles2/command_buffer_type_conversions.h index 2055c4b..ee1d8e9 100644 --- a/components/mus/gles2/command_buffer_type_conversions.h +++ b/components/mus/gles2/command_buffer_type_conversions.h @@ -62,6 +62,6 @@ struct TypeConverter<gpu::Capabilities, GpuCapabilitiesPtr> { static gpu::Capabilities Convert(const GpuCapabilitiesPtr& input); }; -} // namespace mojo +} // namespace gles2 #endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_TYPE_CONVERSIONS_H_ diff --git a/components/mus/gles2/gpu_impl.cc b/components/mus/gles2/gpu_impl.cc index b8c3e95..506b3eb 100644 --- a/components/mus/gles2/gpu_impl.cc +++ b/components/mus/gles2/gpu_impl.cc @@ -7,7 +7,7 @@ #include "components/mus/gles2/command_buffer_driver.h" #include "components/mus/gles2/command_buffer_impl.h" -namespace mus { +namespace gles2 { GpuImpl::GpuImpl(mojo::InterfaceRequest<Gpu> request, const scoped_refptr<GpuState>& state) @@ -21,4 +21,4 @@ void GpuImpl::CreateOffscreenGLES2Context( make_scoped_ptr(new CommandBufferDriver(state_))); } -} // namespace mus +} // namespace gles2 diff --git a/components/mus/gles2/gpu_impl.h b/components/mus/gles2/gpu_impl.h index 6bc1cdb..f184751 100644 --- a/components/mus/gles2/gpu_impl.h +++ b/components/mus/gles2/gpu_impl.h @@ -15,7 +15,7 @@ #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" #include "ui/mojo/geometry/geometry.mojom.h" -namespace mus { +namespace gles2 { class GpuImpl : public mojo::Gpu { public: @@ -33,6 +33,6 @@ class GpuImpl : public mojo::Gpu { DISALLOW_COPY_AND_ASSIGN(GpuImpl); }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_MUS_GLES2_GPU_IMPL_H_ diff --git a/components/mus/gles2/gpu_memory_tracker.cc b/components/mus/gles2/gpu_memory_tracker.cc index 6048d61..b40e8f1 100644 --- a/components/mus/gles2/gpu_memory_tracker.cc +++ b/components/mus/gles2/gpu_memory_tracker.cc @@ -4,7 +4,7 @@ #include "components/mus/gles2/gpu_memory_tracker.h" -namespace mus { +namespace gles2 { GpuMemoryTracker::GpuMemoryTracker() {} @@ -27,4 +27,4 @@ int GpuMemoryTracker::ClientId() const { GpuMemoryTracker::~GpuMemoryTracker() {} -} // namespace mus +} // namespace gles2 diff --git a/components/mus/gles2/gpu_memory_tracker.h b/components/mus/gles2/gpu_memory_tracker.h index 91b9b982..94e6422 100644 --- a/components/mus/gles2/gpu_memory_tracker.h +++ b/components/mus/gles2/gpu_memory_tracker.h @@ -7,7 +7,7 @@ #include "gpu/command_buffer/service/memory_tracking.h" -namespace mus { +namespace gles2 { // TODO(fsamuel, rjkroege): This is a stub implementation that needs to be // completed for proper memory tracking. @@ -15,7 +15,7 @@ class GpuMemoryTracker : public gpu::gles2::MemoryTracker { public: GpuMemoryTracker(); - // gpu::MemoryTracker implementation: + // gpu::gles2::MemoryTracker implementation: void TrackMemoryAllocatedChange( size_t old_size, size_t new_size, @@ -30,6 +30,6 @@ class GpuMemoryTracker : public gpu::gles2::MemoryTracker { DISALLOW_COPY_AND_ASSIGN(GpuMemoryTracker); }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_MUS_GLES2_GPU_MEMORY_TRACKER_H_ diff --git a/components/mus/gles2/gpu_state.cc b/components/mus/gles2/gpu_state.cc index 48932e6..4553cf7 100644 --- a/components/mus/gles2/gpu_state.cc +++ b/components/mus/gles2/gpu_state.cc @@ -5,7 +5,7 @@ #include "components/mus/gles2/gpu_state.h" -namespace mus { +namespace gles2 { GpuState::GpuState() : control_thread_("gpu_command_buffer_control"), @@ -21,4 +21,4 @@ void GpuState::StopControlThread() { control_thread_.Stop(); } -} // namespace mus +} // namespace gles2 diff --git a/components/mus/gles2/gpu_state.h b/components/mus/gles2/gpu_state.h index 59148b7..4864053 100644 --- a/components/mus/gles2/gpu_state.h +++ b/components/mus/gles2/gpu_state.h @@ -13,7 +13,7 @@ #include "gpu/command_buffer/service/sync_point_manager.h" #include "ui/gl/gl_share_group.h" -namespace mus { +namespace gles2 { // We need to share these across all CommandBuffer instances so that contexts // they create can share resources with each other via mailboxes. @@ -50,6 +50,6 @@ class GpuState : public base::RefCounted<GpuState> { scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_MUS_GLES2_GPU_STATE_H_ diff --git a/components/mus/gles2/mojo_buffer_backing.cc b/components/mus/gles2/mojo_buffer_backing.cc index 1beadb32..bdb745b 100644 --- a/components/mus/gles2/mojo_buffer_backing.cc +++ b/components/mus/gles2/mojo_buffer_backing.cc @@ -6,7 +6,7 @@ #include "base/logging.h" -namespace mus { +namespace gles2 { MojoBufferBacking::MojoBufferBacking(mojo::ScopedSharedBufferHandle handle, void* memory, @@ -37,4 +37,4 @@ size_t MojoBufferBacking::GetSize() const { return size_; } -} // namespace mus +} // namespace gles2 diff --git a/components/mus/gles2/mojo_buffer_backing.h b/components/mus/gles2/mojo_buffer_backing.h index 730dd33..04da87b 100644 --- a/components/mus/gles2/mojo_buffer_backing.h +++ b/components/mus/gles2/mojo_buffer_backing.h @@ -10,7 +10,7 @@ #include "gpu/command_buffer/common/buffer.h" #include "third_party/mojo/src/mojo/public/cpp/system/core.h" -namespace mus { +namespace gles2 { class MojoBufferBacking : public gpu::BufferBacking { public: @@ -34,6 +34,6 @@ class MojoBufferBacking : public gpu::BufferBacking { DISALLOW_COPY_AND_ASSIGN(MojoBufferBacking); }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_MUS_GLES2_MOJO_BUFFER_BACKING_H_ diff --git a/components/mus/gles2/mojo_gpu_memory_buffer.cc b/components/mus/gles2/mojo_gpu_memory_buffer.cc index fac4629..c5aaef1 100644 --- a/components/mus/gles2/mojo_gpu_memory_buffer.cc +++ b/components/mus/gles2/mojo_gpu_memory_buffer.cc @@ -9,7 +9,7 @@ #include "base/numerics/safe_conversions.h" #include "ui/gfx/buffer_format_util.h" -namespace mus { +namespace gles2 { MojoGpuMemoryBufferImpl::MojoGpuMemoryBufferImpl( const gfx::Size& size, @@ -97,4 +97,4 @@ ClientBuffer MojoGpuMemoryBufferImpl::AsClientBuffer() { return reinterpret_cast<ClientBuffer>(this); } -} // namespace mus +} // namespace gles2 diff --git a/components/mus/gles2/mojo_gpu_memory_buffer.h b/components/mus/gles2/mojo_gpu_memory_buffer.h index cf16ebd0..691c6fc 100644 --- a/components/mus/gles2/mojo_gpu_memory_buffer.h +++ b/components/mus/gles2/mojo_gpu_memory_buffer.h @@ -9,7 +9,7 @@ #include "ui/gfx/geometry/size.h" #include "ui/gfx/gpu_memory_buffer.h" -namespace mus { +namespace gles2 { class MojoGpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { public: @@ -45,6 +45,6 @@ class MojoGpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferImpl); }; -} // namespace mus +} // gles2 #endif // COMPONENTS_MUS_GLES2_MOJO_GPU_MEMORY_BUFFER_H_ diff --git a/components/mus/gles2/mojo_gpu_memory_buffer_manager.cc b/components/mus/gles2/mojo_gpu_memory_buffer_manager.cc index a48594f..3ef2293 100644 --- a/components/mus/gles2/mojo_gpu_memory_buffer_manager.cc +++ b/components/mus/gles2/mojo_gpu_memory_buffer_manager.cc @@ -7,7 +7,7 @@ #include "base/logging.h" #include "components/mus/gles2/mojo_gpu_memory_buffer.h" -namespace mus { +namespace gles2 { MojoGpuMemoryBufferManager::MojoGpuMemoryBufferManager() {} @@ -32,4 +32,4 @@ void MojoGpuMemoryBufferManager::SetDestructionSyncPoint( NOTIMPLEMENTED(); } -} // namespace mus +} // namespace gles2 diff --git a/components/mus/gles2/mojo_gpu_memory_buffer_manager.h b/components/mus/gles2/mojo_gpu_memory_buffer_manager.h index 37133b3..2779135 100644 --- a/components/mus/gles2/mojo_gpu_memory_buffer_manager.h +++ b/components/mus/gles2/mojo_gpu_memory_buffer_manager.h @@ -7,7 +7,7 @@ #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" -namespace mus { +namespace gles2 { class MojoGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager { public: @@ -28,6 +28,6 @@ class MojoGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager { DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferManager); }; -} // namespace mus +} // namespace gles2 #endif // COMPONENTS_MUS_GLES2_MOJO_GPU_MEMORY_BUFFER_MANAGER_H_ diff --git a/components/mus/ids.h b/components/mus/ids.h index 7099a58..aac7712 100644 --- a/components/mus/ids.h +++ b/components/mus/ids.h @@ -8,15 +8,16 @@ #include "components/mus/public/cpp/types.h" #include "components/mus/public/cpp/util.h" -namespace mus { +namespace view_manager { // Connection id is used to indicate no connection. That is, no ViewTreeImpl // ever gets this id. -const ConnectionSpecificId kInvalidConnectionId = 0; +const mojo::ConnectionSpecificId kInvalidConnectionId = 0; // Adds a bit of type safety to view ids. struct ViewId { - ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId view_id) + ViewId(mojo::ConnectionSpecificId connection_id, + mojo::ConnectionSpecificId view_id) : connection_id(connection_id), view_id(view_id) {} ViewId() : connection_id(0), view_id(0) {} @@ -26,15 +27,15 @@ struct ViewId { bool operator!=(const ViewId& other) const { return !(*this == other); } - ConnectionSpecificId connection_id; - ConnectionSpecificId view_id; + mojo::ConnectionSpecificId connection_id; + mojo::ConnectionSpecificId view_id; }; -inline ViewId ViewIdFromTransportId(Id id) { - return ViewId(HiWord(id), LoWord(id)); +inline ViewId ViewIdFromTransportId(mojo::Id id) { + return ViewId(mojo::HiWord(id), mojo::LoWord(id)); } -inline Id ViewIdToTransportId(const ViewId& id) { +inline mojo::Id ViewIdToTransportId(const ViewId& id) { return (id.connection_id << 16) | id.view_id; } @@ -49,6 +50,6 @@ inline ViewId RootViewId(uint16_t index) { return ViewId(kInvalidConnectionId, 2 + index); } -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_IDS_H_ diff --git a/components/mus/main.cc b/components/mus/main.cc index e244124..a2f0817 100644 --- a/components/mus/main.cc +++ b/components/mus/main.cc @@ -2,15 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/mus/mus_app.h" +#include "components/mus/view_manager_app.h" #include "mojo/application/public/cpp/application_runner.h" #include "third_party/mojo/src/mojo/public/c/system/main.h" -namespace mus { - MojoResult MojoMain(MojoHandle shell_handle) { - mojo::ApplicationRunner runner(new MandolineUIServicesApp); + mojo::ApplicationRunner runner(new view_manager::ViewManagerApp); return runner.Run(shell_handle); } - -} // namespace mus diff --git a/components/mus/public/cpp/args.h b/components/mus/public/cpp/args.h index 863bbb5..a737fd7 100644 --- a/components/mus/public/cpp/args.h +++ b/components/mus/public/cpp/args.h @@ -5,13 +5,13 @@ #ifndef COMPONENTS_MUS_PUBLIC_CPP_ARGS_H_ #define COMPONENTS_MUS_PUBLIC_CPP_ARGS_H_ -namespace mus { +namespace mojo { // All args in alphabetical order. The switches should be documented // alongside the definition of their values in the .cc file. extern const char kUseHeadlessConfig[]; extern const char kUseX11TestConfig[]; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_ARGS_H_ diff --git a/components/mus/public/cpp/keys.cc b/components/mus/public/cpp/keys.cc index 623bb82..7c664ba 100644 --- a/components/mus/public/cpp/keys.cc +++ b/components/mus/public/cpp/keys.cc @@ -4,9 +4,9 @@ #include "components/mus/public/cpp/keys.h" -namespace mus { +namespace mojo { extern const char kViewManagerKeyWantsTouchEvents[] = "view-manager-key-wants-touch-events"; -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/keys.h b/components/mus/public/cpp/keys.h index cf3713a..2285c31 100644 --- a/components/mus/public/cpp/keys.h +++ b/components/mus/public/cpp/keys.h @@ -5,10 +5,10 @@ #ifndef COMPONENTS_MUS_PUBLIC_CPP_KEYS_H_ #define COMPONENTS_MUS_PUBLIC_CPP_KEYS_H_ -namespace mus { +namespace mojo { extern const char kViewManagerKeyWantsTouchEvents[]; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_KEYS_H_ diff --git a/components/mus/public/cpp/lib/args.cc b/components/mus/public/cpp/lib/args.cc index e17ada3..d23478b 100644 --- a/components/mus/public/cpp/lib/args.cc +++ b/components/mus/public/cpp/lib/args.cc @@ -4,7 +4,7 @@ #include "components/mus/public/cpp/args.h" -namespace mus { +namespace mojo { // Create native viewport in headless mode. const char kUseHeadlessConfig[] = "use-headless-config"; @@ -13,4 +13,4 @@ const char kUseHeadlessConfig[] = "use-headless-config"; // creating X11 windows. const char kUseX11TestConfig[] = "use-x11-test-config"; -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/lib/scoped_view_ptr.cc b/components/mus/public/cpp/lib/scoped_view_ptr.cc index 4c41709..79401fa 100644 --- a/components/mus/public/cpp/lib/scoped_view_ptr.cc +++ b/components/mus/public/cpp/lib/scoped_view_ptr.cc @@ -8,7 +8,7 @@ #include "components/mus/public/cpp/view_observer.h" #include "components/mus/public/cpp/view_tree_connection.h" -namespace mus { +namespace mojo { ScopedViewPtr::ScopedViewPtr(View* view) : view_(view) { view_->AddObserver(this); @@ -41,4 +41,4 @@ void ScopedViewPtr::OnViewDestroying(View* view) { DetachFromView(); } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/lib/view.cc b/components/mus/public/cpp/lib/view.cc index 88228eb..fe780365 100644 --- a/components/mus/public/cpp/lib/view.cc +++ b/components/mus/public/cpp/lib/view.cc @@ -15,7 +15,7 @@ #include "components/mus/public/cpp/view_tracker.h" #include "mojo/application/public/cpp/service_provider_impl.h" -namespace mus { +namespace mojo { namespace { @@ -88,7 +88,7 @@ class ScopedOrderChangedNotifier { public: ScopedOrderChangedNotifier(View* view, View* relative_view, - mojo::OrderDirection direction) + OrderDirection direction) : view_(view), relative_view_(relative_view), direction_(direction) { FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(), OnViewReordering(view_, relative_view_, direction_)); @@ -101,7 +101,7 @@ class ScopedOrderChangedNotifier { private: View* view_; View* relative_view_; - mojo::OrderDirection direction_; + OrderDirection direction_; MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier); }; @@ -110,7 +110,7 @@ class ScopedOrderChangedNotifier { bool ReorderImpl(View::Children* children, View* view, View* relative, - mojo::OrderDirection direction) { + OrderDirection direction) { DCHECK(relative); DCHECK_NE(view, relative); DCHECK_EQ(view->parent(), relative->parent()); @@ -120,14 +120,14 @@ bool ReorderImpl(View::Children* children, const size_t target_i = std::find(children->begin(), children->end(), relative) - children->begin(); - if ((direction == mojo::ORDER_DIRECTION_ABOVE && child_i == target_i + 1) || - (direction == mojo::ORDER_DIRECTION_BELOW && child_i + 1 == target_i)) { + if ((direction == ORDER_DIRECTION_ABOVE && child_i == target_i + 1) || + (direction == ORDER_DIRECTION_BELOW && child_i + 1 == target_i)) { return false; } ScopedOrderChangedNotifier notifier(view, relative, direction); - const size_t dest_i = direction == mojo::ORDER_DIRECTION_ABOVE + const size_t dest_i = direction == ORDER_DIRECTION_ABOVE ? (child_i < target_i ? target_i : target_i + 1) : (child_i < target_i ? target_i - 1 : target_i); children->erase(children->begin() + child_i); @@ -139,8 +139,8 @@ bool ReorderImpl(View::Children* children, class ScopedSetBoundsNotifier { public: ScopedSetBoundsNotifier(View* view, - const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) + const Rect& old_bounds, + const Rect& new_bounds) : view_(view), old_bounds_(old_bounds), new_bounds_(new_bounds) { FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(), OnViewBoundsChanging(view_, old_bounds_, new_bounds_)); @@ -152,8 +152,8 @@ class ScopedSetBoundsNotifier { private: View* view_; - const mojo::Rect old_bounds_; - const mojo::Rect new_bounds_; + const Rect old_bounds_; + const Rect new_bounds_; MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier); }; @@ -191,7 +191,7 @@ void View::Destroy() { LocalDestroy(); } -void View::SetBounds(const mojo::Rect& bounds) { +void View::SetBounds(const Rect& bounds) { if (!OwnsView(connection_, this)) return; @@ -212,15 +212,14 @@ void View::SetVisible(bool value) { LocalSetVisible(value); } -scoped_ptr<ViewSurface> View::RequestSurface() { +scoped_ptr<mojo::ViewSurface> View::RequestSurface() { mojo::SurfacePtr surface; mojo::SurfaceClientPtr client; - mojo::InterfaceRequest<mojo::SurfaceClient> client_request = - GetProxy(&client); + mojo::InterfaceRequest<SurfaceClient> client_request = GetProxy(&client); static_cast<ViewTreeClientImpl*>(connection_) ->RequestSurface(id_, GetProxy(&surface), client.Pass()); return make_scoped_ptr( - new ViewSurface(surface.PassInterface(), client_request.Pass())); + new mojo::ViewSurface(surface.PassInterface(), client_request.Pass())); } void View::SetSharedProperty(const std::string& name, @@ -248,7 +247,7 @@ void View::SetSharedProperty(const std::string& name, // TODO: add test coverage of this (450303). if (connection_) { - mojo::Array<uint8_t> transport_value; + Array<uint8_t> transport_value; if (value) { transport_value.resize(value->size()); if (value->size()) @@ -309,16 +308,16 @@ void View::RemoveChild(View* child) { void View::MoveToFront() { if (!parent_ || parent_->children_.back() == this) return; - Reorder(parent_->children_.back(), mojo::ORDER_DIRECTION_ABOVE); + Reorder(parent_->children_.back(), ORDER_DIRECTION_ABOVE); } void View::MoveToBack() { if (!parent_ || parent_->children_.front() == this) return; - Reorder(parent_->children_.front(), mojo::ORDER_DIRECTION_BELOW); + Reorder(parent_->children_.front(), ORDER_DIRECTION_BELOW); } -void View::Reorder(View* relative, mojo::OrderDirection direction) { +void View::Reorder(View* relative, OrderDirection direction) { if (!LocalReorder(relative, direction)) return; if (connection_) { @@ -354,16 +353,16 @@ View* View::GetChildById(Id id) { return NULL; } -void View::SetTextInputState(mojo::TextInputStatePtr state) { +void View::SetTextInputState(TextInputStatePtr state) { if (connection_) { static_cast<ViewTreeClientImpl*>(connection_) ->SetViewTextInputState(id_, state.Pass()); } } -void View::SetImeVisibility(bool visible, mojo::TextInputStatePtr state) { +void View::SetImeVisibility(bool visible, TextInputStatePtr state) { // SetImeVisibility() shouldn't be used if the view is not editable. - DCHECK(state.is_null() || state->type != mojo::TEXT_INPUT_TYPE_NONE); + DCHECK(state.is_null() || state->type != TEXT_INPUT_TYPE_NONE); if (connection_) { static_cast<ViewTreeClientImpl*>(connection_) ->SetImeVisibility(id_, visible, state.Pass()); @@ -379,12 +378,12 @@ bool View::HasFocus() const { return connection_ && connection_->GetFocusedView() == this; } -void View::Embed(mojo::ViewTreeClientPtr client) { - Embed(client.Pass(), mojo::ViewTree::ACCESS_POLICY_DEFAULT, +void View::Embed(ViewTreeClientPtr client) { + Embed(client.Pass(), ViewTree::ACCESS_POLICY_DEFAULT, base::Bind(&EmptyEmbedCallback)); } -void View::Embed(mojo::ViewTreeClientPtr client, +void View::Embed(ViewTreeClientPtr client, uint32_t policy_bitmask, const EmbedCallback& callback) { if (PrepareForEmbed()) { @@ -400,9 +399,9 @@ void View::Embed(mojo::ViewTreeClientPtr client, namespace { -mojo::ViewportMetricsPtr CreateEmptyViewportMetrics() { - mojo::ViewportMetricsPtr metrics = mojo::ViewportMetrics::New(); - metrics->size_in_pixels = mojo::Size::New(); +ViewportMetricsPtr CreateEmptyViewportMetrics() { + ViewportMetricsPtr metrics = ViewportMetrics::New(); + metrics->size_in_pixels = Size::New(); // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove it // once that's fixed. return metrics.Pass(); @@ -506,12 +505,11 @@ void View::LocalRemoveChild(View* child) { RemoveChildImpl(child, &children_); } -bool View::LocalReorder(View* relative, mojo::OrderDirection direction) { +bool View::LocalReorder(View* relative, OrderDirection direction) { return ReorderImpl(&parent_->children_, this, relative, direction); } -void View::LocalSetBounds(const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) { +void View::LocalSetBounds(const Rect& old_bounds, const Rect& new_bounds) { DCHECK(old_bounds.x == bounds_.x); DCHECK(old_bounds.y == bounds_.y); DCHECK(old_bounds.width == bounds_.width); @@ -520,8 +518,8 @@ void View::LocalSetBounds(const mojo::Rect& old_bounds, bounds_ = new_bounds; } -void View::LocalSetViewportMetrics(const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) { +void View::LocalSetViewportMetrics(const ViewportMetrics& old_metrics, + const ViewportMetrics& new_metrics) { // TODO(eseidel): We could check old_metrics against viewport_metrics_. viewport_metrics_ = new_metrics.Clone(); FOR_EACH_OBSERVER( @@ -612,4 +610,4 @@ bool View::PrepareForEmbed() { return true; } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/lib/view_observer.cc b/components/mus/public/cpp/lib/view_observer.cc index 40367ea..a216da9 100644 --- a/components/mus/public/cpp/lib/view_observer.cc +++ b/components/mus/public/cpp/lib/view_observer.cc @@ -4,7 +4,7 @@ #include "components/mus/public/cpp/view_observer.h" -namespace mus { +namespace mojo { //////////////////////////////////////////////////////////////////////////////// // ViewObserver, public: @@ -15,4 +15,4 @@ ViewObserver::TreeChangeParams::TreeChangeParams() new_parent(nullptr), receiver(nullptr) {} -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/lib/view_private.cc b/components/mus/public/cpp/lib/view_private.cc index 8cee1cc..12eef3c 100644 --- a/components/mus/public/cpp/lib/view_private.cc +++ b/components/mus/public/cpp/lib/view_private.cc @@ -4,7 +4,7 @@ #include "components/mus/public/cpp/lib/view_private.h" -namespace mus { +namespace mojo { ViewPrivate::ViewPrivate(View* view) : view_(view) { CHECK(view); @@ -17,4 +17,4 @@ View* ViewPrivate::LocalCreate() { return new View; } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/lib/view_private.h b/components/mus/public/cpp/lib/view_private.h index 56b20aa..4938d70 100644 --- a/components/mus/public/cpp/lib/view_private.h +++ b/components/mus/public/cpp/lib/view_private.h @@ -7,7 +7,7 @@ #include "components/mus/public/cpp/view.h" -namespace mus { +namespace mojo { // This class is a friend of a View and contains functions to mutate internal // state of View. @@ -37,19 +37,18 @@ class ViewPrivate { view_->properties_ = data; } - void LocalSetViewportMetrics(const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) { + void LocalSetViewportMetrics(const ViewportMetrics& old_metrics, + const ViewportMetrics& new_metrics) { view_->LocalSetViewportMetrics(new_metrics, new_metrics); } void LocalDestroy() { view_->LocalDestroy(); } void LocalAddChild(View* child) { view_->LocalAddChild(child); } void LocalRemoveChild(View* child) { view_->LocalRemoveChild(child); } - void LocalReorder(View* relative, mojo::OrderDirection direction) { + void LocalReorder(View* relative, OrderDirection direction) { view_->LocalReorder(relative, direction); } - void LocalSetBounds(const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) { + void LocalSetBounds(const Rect& old_bounds, const Rect& new_bounds) { view_->LocalSetBounds(old_bounds, new_bounds); } void LocalSetDrawn(bool drawn) { view_->LocalSetDrawn(drawn); } @@ -61,6 +60,6 @@ class ViewPrivate { MOJO_DISALLOW_COPY_AND_ASSIGN(ViewPrivate); }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_VIEW_PRIVATE_H_ diff --git a/components/mus/public/cpp/lib/view_surface.cc b/components/mus/public/cpp/lib/view_surface.cc index f5d9a26..bdd5c32 100644 --- a/components/mus/public/cpp/lib/view_surface.cc +++ b/components/mus/public/cpp/lib/view_surface.cc @@ -7,7 +7,7 @@ #include "components/mus/public/cpp/view_surface_client.h" #include "mojo/converters/surfaces/surfaces_type_converters.h" -namespace mus { +namespace mojo { ViewSurface::~ViewSurface() {} @@ -41,4 +41,4 @@ void ViewSurface::ReturnResources( client_->OnResourcesReturned(this, resources.Pass()); } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/lib/view_tree_client_impl.cc b/components/mus/public/cpp/lib/view_tree_client_impl.cc index 43a1935..ceac2ee 100644 --- a/components/mus/public/cpp/lib/view_tree_client_impl.cc +++ b/components/mus/public/cpp/lib/view_tree_client_impl.cc @@ -14,7 +14,7 @@ #include "mojo/application/public/cpp/service_provider_impl.h" #include "mojo/application/public/interfaces/service_provider.mojom.h" -namespace mus { +namespace mojo { Id MakeTransportId(ConnectionSpecificId connection_id, ConnectionSpecificId local_id) { @@ -24,7 +24,7 @@ Id MakeTransportId(ConnectionSpecificId connection_id, // Helper called to construct a local view object from transport data. View* AddViewToConnection(ViewTreeClientImpl* client, View* parent, - const mojo::ViewDataPtr& view_data) { + const ViewDataPtr& view_data) { // We don't use the cto that takes a ViewTreeConnection here, since it will // call back to the service and attempt to create a new view. View* view = ViewPrivate::LocalCreate(); @@ -33,19 +33,19 @@ View* AddViewToConnection(ViewTreeClientImpl* client, private_view.set_id(view_data->view_id); private_view.set_visible(view_data->visible); private_view.set_drawn(view_data->drawn); - private_view.LocalSetViewportMetrics(mojo::ViewportMetrics(), + private_view.LocalSetViewportMetrics(ViewportMetrics(), *view_data->viewport_metrics); private_view.set_properties( view_data->properties.To<std::map<std::string, std::vector<uint8_t>>>()); client->AddView(view); - private_view.LocalSetBounds(mojo::Rect(), *view_data->bounds); + private_view.LocalSetBounds(Rect(), *view_data->bounds); if (parent) ViewPrivate(parent).LocalAddChild(view); return view; } View* BuildViewTree(ViewTreeClientImpl* client, - const mojo::Array<mojo::ViewDataPtr>& views, + const Array<ViewDataPtr>& views, View* initial_parent) { std::vector<View*> parents; View* root = NULL; @@ -70,13 +70,12 @@ View* BuildViewTree(ViewTreeClientImpl* client, ViewTreeConnection* ViewTreeConnection::Create( ViewTreeDelegate* delegate, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) { + InterfaceRequest<ViewTreeClient> request) { return new ViewTreeClientImpl(delegate, request.Pass()); } -ViewTreeClientImpl::ViewTreeClientImpl( - ViewTreeDelegate* delegate, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) +ViewTreeClientImpl::ViewTreeClientImpl(ViewTreeDelegate* delegate, + InterfaceRequest<ViewTreeClient> request) : connection_id_(0), next_id_(1), delegate_(delegate), @@ -129,7 +128,7 @@ void ViewTreeClientImpl::RemoveChild(Id child_id, Id parent_id) { void ViewTreeClientImpl::Reorder(Id view_id, Id relative_view_id, - mojo::OrderDirection direction) { + OrderDirection direction) { DCHECK(tree_); tree_->ReorderView(view_id, relative_view_id, direction, ActionCompletedCallback()); @@ -139,7 +138,7 @@ bool ViewTreeClientImpl::OwnsView(Id id) const { return HiWord(id) == connection_id_; } -void ViewTreeClientImpl::SetBounds(Id view_id, const mojo::Rect& bounds) { +void ViewTreeClientImpl::SetBounds(Id view_id, const Rect& bounds) { DCHECK(tree_); tree_->SetViewBounds(view_id, bounds.Clone(), ActionCompletedCallback()); } @@ -160,36 +159,34 @@ void ViewTreeClientImpl::SetProperty(Id view_id, const std::string& name, const std::vector<uint8_t>& data) { DCHECK(tree_); - tree_->SetViewProperty(view_id, mojo::String(name), - mojo::Array<uint8_t>::From(data), + tree_->SetViewProperty(view_id, String(name), Array<uint8_t>::From(data), ActionCompletedCallback()); } void ViewTreeClientImpl::SetViewTextInputState(Id view_id, - mojo::TextInputStatePtr state) { + TextInputStatePtr state) { DCHECK(tree_); tree_->SetViewTextInputState(view_id, state.Pass()); } void ViewTreeClientImpl::SetImeVisibility(Id view_id, bool visible, - mojo::TextInputStatePtr state) { + TextInputStatePtr state) { DCHECK(tree_); tree_->SetImeVisibility(view_id, visible, state.Pass()); } void ViewTreeClientImpl::Embed(Id view_id, - mojo::ViewTreeClientPtr client, + ViewTreeClientPtr client, uint32_t policy_bitmask, - const mojo::ViewTree::EmbedCallback& callback) { + const ViewTree::EmbedCallback& callback) { DCHECK(tree_); tree_->Embed(view_id, client.Pass(), policy_bitmask, callback); } -void ViewTreeClientImpl::RequestSurface( - Id view_id, - mojo::InterfaceRequest<mojo::Surface> surface, - mojo::SurfaceClientPtr client) { +void ViewTreeClientImpl::RequestSurface(Id view_id, + InterfaceRequest<Surface> surface, + SurfaceClientPtr client) { DCHECK(tree_); tree_->RequestSurface(view_id, surface.Pass(), client.Pass()); } @@ -223,8 +220,8 @@ void ViewTreeClientImpl::OnRootDestroyed(View* root) { Id ViewTreeClientImpl::CreateViewOnServer() { DCHECK(tree_); const Id view_id = MakeTransportId(connection_id_, ++next_id_); - tree_->CreateView(view_id, [this](mojo::ErrorCode code) { - OnActionCompleted(code == mojo::ERROR_CODE_NONE); + tree_->CreateView(view_id, [this](ErrorCode code) { + OnActionCompleted(code == ERROR_CODE_NONE); }); return view_id; } @@ -260,8 +257,8 @@ ConnectionSpecificId ViewTreeClientImpl::GetConnectionId() { // ViewTreeClientImpl, ViewTreeClient implementation: void ViewTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, - mojo::ViewDataPtr root_data, - mojo::ViewTreePtr tree, + ViewDataPtr root_data, + ViewTreePtr tree, Id focused_view_id, uint32 access_policy) { if (tree) { @@ -296,8 +293,8 @@ void ViewTreeClientImpl::OnUnembed() { } void ViewTreeClientImpl::OnViewBoundsChanged(Id view_id, - mojo::RectPtr old_bounds, - mojo::RectPtr new_bounds) { + RectPtr old_bounds, + RectPtr new_bounds) { View* view = GetViewById(view_id); ViewPrivate(view).LocalSetBounds(*old_bounds, *new_bounds); } @@ -305,8 +302,8 @@ void ViewTreeClientImpl::OnViewBoundsChanged(Id view_id, namespace { void SetViewportMetricsOnDecendants(View* root, - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) { + const ViewportMetrics& old_metrics, + const ViewportMetrics& new_metrics) { ViewPrivate(root).LocalSetViewportMetrics(old_metrics, new_metrics); const View::Children& children = root->children(); for (size_t i = 0; i < children.size(); ++i) @@ -315,8 +312,8 @@ void SetViewportMetricsOnDecendants(View* root, } void ViewTreeClientImpl::OnViewViewportMetricsChanged( - mojo::ViewportMetricsPtr old_metrics, - mojo::ViewportMetricsPtr new_metrics) { + ViewportMetricsPtr old_metrics, + ViewportMetricsPtr new_metrics) { View* view = GetRoot(); if (view) SetViewportMetricsOnDecendants(view, *old_metrics, *new_metrics); @@ -326,7 +323,7 @@ void ViewTreeClientImpl::OnViewHierarchyChanged( Id view_id, Id new_parent_id, Id old_parent_id, - mojo::Array<mojo::ViewDataPtr> views) { + mojo::Array<ViewDataPtr> views) { View* initial_parent = views.size() ? GetViewById(views[0]->parent_id) : NULL; const bool was_view_known = GetViewById(view_id) != nullptr; @@ -349,7 +346,7 @@ void ViewTreeClientImpl::OnViewHierarchyChanged( void ViewTreeClientImpl::OnViewReordered(Id view_id, Id relative_view_id, - mojo::OrderDirection direction) { + OrderDirection direction) { View* view = GetViewById(view_id); View* relative_view = GetViewById(relative_view_id); if (view && relative_view) @@ -377,10 +374,9 @@ void ViewTreeClientImpl::OnViewDrawnStateChanged(Id view_id, bool drawn) { ViewPrivate(view).LocalSetDrawn(drawn); } -void ViewTreeClientImpl::OnViewSharedPropertyChanged( - Id view_id, - const mojo::String& name, - mojo::Array<uint8_t> new_data) { +void ViewTreeClientImpl::OnViewSharedPropertyChanged(Id view_id, + const String& name, + Array<uint8_t> new_data) { View* view = GetViewById(view_id); if (view) { std::vector<uint8_t> data; @@ -396,8 +392,8 @@ void ViewTreeClientImpl::OnViewSharedPropertyChanged( void ViewTreeClientImpl::OnViewInputEvent( Id view_id, - mojo::EventPtr event, - const mojo::Callback<void()>& ack_callback) { + EventPtr event, + const Callback<void()>& ack_callback) { View* view = GetViewById(view_id); if (view) { FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view).observers(), @@ -431,8 +427,8 @@ void ViewTreeClientImpl::OnActionCompleted(bool success) { change_acked_callback_.Run(); } -mojo::Callback<void(bool)> ViewTreeClientImpl::ActionCompletedCallback() { +Callback<void(bool)> ViewTreeClientImpl::ActionCompletedCallback() { return [this](bool success) { OnActionCompleted(success); }; } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/lib/view_tree_client_impl.h b/components/mus/public/cpp/lib/view_tree_client_impl.h index 95e5593..458e6ec 100644 --- a/components/mus/public/cpp/lib/view_tree_client_impl.h +++ b/components/mus/public/cpp/lib/view_tree_client_impl.h @@ -11,16 +11,15 @@ #include "components/mus/public/interfaces/view_tree.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" -namespace mus { +namespace mojo { class ViewTreeConnection; class ViewTreeDelegate; // Manages the connection with the View Manager service. -class ViewTreeClientImpl : public ViewTreeConnection, - public mojo::ViewTreeClient { +class ViewTreeClientImpl : public ViewTreeConnection, public ViewTreeClient { public: ViewTreeClientImpl(ViewTreeDelegate* delegate, - mojo::InterfaceRequest<mojo::ViewTreeClient> request); + InterfaceRequest<ViewTreeClient> request); ~ViewTreeClientImpl() override; bool connected() const { return tree_; } @@ -36,32 +35,30 @@ class ViewTreeClientImpl : public ViewTreeConnection, void AddChild(Id child_id, Id parent_id); void RemoveChild(Id child_id, Id parent_id); - void Reorder(Id view_id, Id relative_view_id, mojo::OrderDirection direction); + void Reorder(Id view_id, Id relative_view_id, OrderDirection direction); // Returns true if the specified view was created by this connection. bool OwnsView(Id id) const; - void SetBounds(Id view_id, const mojo::Rect& bounds); + void SetBounds(Id view_id, const Rect& bounds); void SetFocus(Id view_id); void SetVisible(Id view_id, bool visible); void SetProperty(Id view_id, const std::string& name, const std::vector<uint8_t>& data); - void SetViewTextInputState(Id view_id, mojo::TextInputStatePtr state); - void SetImeVisibility(Id view_id, - bool visible, - mojo::TextInputStatePtr state); + void SetViewTextInputState(Id view_id, TextInputStatePtr state); + void SetImeVisibility(Id view_id, bool visible, TextInputStatePtr state); void Embed(Id view_id, - mojo::ViewTreeClientPtr client, + ViewTreeClientPtr client, uint32_t policy_bitmask, - const mojo::ViewTree::EmbedCallback& callback); + const ViewTree::EmbedCallback& callback); void RequestSurface(Id view_id, - mojo::InterfaceRequest<mojo::Surface> surface, - mojo::SurfaceClientPtr client); + InterfaceRequest<Surface> surface, + SurfaceClientPtr client); - void set_change_acked_callback(const mojo::Callback<void(void)>& callback) { + void set_change_acked_callback(const Callback<void(void)>& callback) { change_acked_callback_ = callback; } void ClearChangeAckedCallback() { change_acked_callback_.reset(); } @@ -93,46 +90,45 @@ class ViewTreeClientImpl : public ViewTreeConnection, // Overridden from ViewTreeClient: void OnEmbed(ConnectionSpecificId connection_id, - mojo::ViewDataPtr root, - mojo::ViewTreePtr tree, + ViewDataPtr root, + ViewTreePtr tree, Id focused_view_id, uint32_t access_policy) override; void OnEmbeddedAppDisconnected(Id view_id) override; void OnUnembed() override; void OnViewBoundsChanged(Id view_id, - mojo::RectPtr old_bounds, - mojo::RectPtr new_bounds) override; - void OnViewViewportMetricsChanged( - mojo::ViewportMetricsPtr old_metrics, - mojo::ViewportMetricsPtr new_metrics) override; + RectPtr old_bounds, + RectPtr new_bounds) override; + void OnViewViewportMetricsChanged(ViewportMetricsPtr old_metrics, + ViewportMetricsPtr new_metrics) override; void OnViewHierarchyChanged(Id view_id, Id new_parent_id, Id old_parent_id, - mojo::Array<mojo::ViewDataPtr> views) override; + Array<ViewDataPtr> views) override; void OnViewReordered(Id view_id, Id relative_view_id, - mojo::OrderDirection direction) override; + OrderDirection direction) override; void OnViewDeleted(Id view_id) override; void OnViewVisibilityChanged(Id view_id, bool visible) override; void OnViewDrawnStateChanged(Id view_id, bool drawn) override; void OnViewSharedPropertyChanged(Id view_id, - const mojo::String& name, - mojo::Array<uint8_t> new_data) override; + const String& name, + Array<uint8_t> new_data) override; void OnViewInputEvent(Id view_id, - mojo::EventPtr event, - const mojo::Callback<void()>& callback) override; + EventPtr event, + const Callback<void()>& callback) override; void OnViewFocused(Id focused_view_id) override; void RootDestroyed(View* root); void OnActionCompleted(bool success); - mojo::Callback<void(bool)> ActionCompletedCallback(); + Callback<void(bool)> ActionCompletedCallback(); ConnectionSpecificId connection_id_; ConnectionSpecificId next_id_; - mojo::Callback<void(void)> change_acked_callback_; + Callback<void(void)> change_acked_callback_; ViewTreeDelegate* delegate_; @@ -144,8 +140,8 @@ class ViewTreeClientImpl : public ViewTreeConnection, View* focused_view_; View* activated_view_; - mojo::Binding<ViewTreeClient> binding_; - mojo::ViewTreePtr tree_; + Binding<ViewTreeClient> binding_; + ViewTreePtr tree_; bool is_embed_root_; @@ -154,6 +150,6 @@ class ViewTreeClientImpl : public ViewTreeConnection, MOJO_DISALLOW_COPY_AND_ASSIGN(ViewTreeClientImpl); }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_VIEW_TREE_CLIENT_IMPL_H_ diff --git a/components/mus/public/cpp/lib/view_tree_delegate.cc b/components/mus/public/cpp/lib/view_tree_delegate.cc index c134414..870da6e 100644 --- a/components/mus/public/cpp/lib/view_tree_delegate.cc +++ b/components/mus/public/cpp/lib/view_tree_delegate.cc @@ -4,8 +4,8 @@ #include "components/mus/public/cpp/view_tree_delegate.h" -namespace mus { +namespace mojo { void ViewTreeDelegate::OnUnembed() {} -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/lib/view_tree_host_factory.cc b/components/mus/public/cpp/lib/view_tree_host_factory.cc index 1da65c9..7259d4a 100644 --- a/components/mus/public/cpp/lib/view_tree_host_factory.cc +++ b/components/mus/public/cpp/lib/view_tree_host_factory.cc @@ -8,21 +8,21 @@ #include "components/mus/public/cpp/view_tree_delegate.h" #include "mojo/application/public/cpp/application_impl.h" -namespace mus { +namespace mojo { -void CreateViewTreeHost(mojo::ViewTreeHostFactory* factory, - mojo::ViewTreeHostClientPtr host_client, +void CreateViewTreeHost(ViewTreeHostFactory* factory, + ViewTreeHostClientPtr host_client, ViewTreeDelegate* delegate, - mojo::ViewTreeHostPtr* host) { - mojo::ViewTreeClientPtr tree_client; + ViewTreeHostPtr* host) { + ViewTreeClientPtr tree_client; ViewTreeConnection::Create(delegate, GetProxy(&tree_client)); factory->CreateViewTreeHost(GetProxy(host), host_client.Pass(), tree_client.Pass()); } -void CreateSingleViewTreeHost(mojo::ApplicationImpl* app, +void CreateSingleViewTreeHost(ApplicationImpl* app, ViewTreeDelegate* delegate, - mojo::ViewTreeHostPtr* host) { + ViewTreeHostPtr* host) { mojo::ViewTreeHostFactoryPtr factory; mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = "mojo:mus"; @@ -31,4 +31,4 @@ void CreateSingleViewTreeHost(mojo::ApplicationImpl* app, host); } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/scoped_view_ptr.h b/components/mus/public/cpp/scoped_view_ptr.h index 92c12f2..47e50ba 100644 --- a/components/mus/public/cpp/scoped_view_ptr.h +++ b/components/mus/public/cpp/scoped_view_ptr.h @@ -7,7 +7,7 @@ #include "components/mus/public/cpp/view_observer.h" -namespace mus { +namespace mojo { // Wraps a View, taking overship of the View. Also deals with View being // destroyed while ScopedViewPtr still exists. @@ -33,6 +33,6 @@ class ScopedViewPtr : public ViewObserver { DISALLOW_COPY_AND_ASSIGN(ScopedViewPtr); }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_SCOPED_VIEW_PTR_H_ diff --git a/components/mus/public/cpp/tests/run_all_unittests.cc b/components/mus/public/cpp/tests/run_all_unittests.cc index ee82a07..3d191d4 100644 --- a/components/mus/public/cpp/tests/run_all_unittests.cc +++ b/components/mus/public/cpp/tests/run_all_unittests.cc @@ -7,9 +7,9 @@ #include "components/mus/public/cpp/tests/view_manager_test_suite.h" int main(int argc, char** argv) { - mus::ViewManagerTestSuite test_suite(argc, argv); + mojo::ViewManagerTestSuite test_suite(argc, argv); return base::LaunchUnitTests(argc, argv, - base::Bind(&mus::ViewManagerTestSuite::Run, + base::Bind(&mojo::ViewManagerTestSuite::Run, base::Unretained(&test_suite))); } diff --git a/components/mus/public/cpp/tests/view_manager_test_base.cc b/components/mus/public/cpp/tests/view_manager_test_base.cc index 508cd82..8ed4204 100644 --- a/components/mus/public/cpp/tests/view_manager_test_base.cc +++ b/components/mus/public/cpp/tests/view_manager_test_base.cc @@ -13,7 +13,7 @@ #include "components/mus/public/cpp/view_tree_host_factory.h" #include "mojo/application/public/cpp/application_impl.h" -namespace mus { +namespace mojo { namespace { base::RunLoop* current_run_loop = nullptr; @@ -73,13 +73,13 @@ void ViewManagerTestBase::TearDown() { ApplicationTestBase::TearDown(); } -mojo::ApplicationDelegate* ViewManagerTestBase::GetApplicationDelegate() { +ApplicationDelegate* ViewManagerTestBase::GetApplicationDelegate() { return this; } bool ViewManagerTestBase::ConfigureIncomingConnection( - mojo::ApplicationConnection* connection) { - connection->AddService<mojo::ViewTreeClient>(this); + ApplicationConnection* connection) { + connection->AddService<ViewTreeClient>(this); return true; } @@ -92,10 +92,9 @@ void ViewManagerTestBase::OnConnectionLost(ViewTreeConnection* connection) { view_tree_connection_destroyed_ = true; } -void ViewManagerTestBase::Create( - mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) { +void ViewManagerTestBase::Create(ApplicationConnection* connection, + InterfaceRequest<ViewTreeClient> request) { ViewTreeConnection::Create(this, request.Pass()); } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/tests/view_manager_test_base.h b/components/mus/public/cpp/tests/view_manager_test_base.h index a1529f3..15a802c 100644 --- a/components/mus/public/cpp/tests/view_manager_test_base.h +++ b/components/mus/public/cpp/tests/view_manager_test_base.h @@ -13,17 +13,16 @@ #include "mojo/application/public/cpp/application_test_base.h" #include "mojo/application/public/cpp/interface_factory.h" -namespace mus { +namespace mojo { // ViewManagerTestBase is a base class for use with app tests that use // ViewManager. SetUp() connects to the ViewManager and blocks until OnEmbed() // has been invoked. window_manager() can be used to access the ViewManager // established as part of SetUp(). -class ViewManagerTestBase - : public mojo::test::ApplicationTestBase, - public mojo::ApplicationDelegate, - public ViewTreeDelegate, - public mojo::InterfaceFactory<mojo::ViewTreeClient> { +class ViewManagerTestBase : public test::ApplicationTestBase, + public ApplicationDelegate, + public ViewTreeDelegate, + public InterfaceFactory<ViewTreeClient> { public: ViewManagerTestBase(); ~ViewManagerTestBase() override; @@ -54,26 +53,25 @@ class ViewManagerTestBase void TearDown() override; // test::ApplicationTestBase: - mojo::ApplicationDelegate* GetApplicationDelegate() override; + ApplicationDelegate* GetApplicationDelegate() override; // ApplicationDelegate: - bool ConfigureIncomingConnection( - mojo::ApplicationConnection* connection) override; + bool ConfigureIncomingConnection(ApplicationConnection* connection) override; // ViewTreeDelegate: void OnEmbed(View* root) override; void OnConnectionLost(ViewTreeConnection* connection) override; // InterfaceFactory<ViewTreeClient>: - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) override; + void Create(ApplicationConnection* connection, + InterfaceRequest<ViewTreeClient> request) override; // Used to receive the most recent view tree connection loaded by an embed // action. ViewTreeConnection* most_recent_connection_; private: - mojo::ViewTreeHostPtr host_; + ViewTreeHostPtr host_; // The View Manager connection held by the window manager (app running at the // root view). @@ -84,6 +82,6 @@ class ViewManagerTestBase MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerTestBase); }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_BASE_H_ diff --git a/components/mus/public/cpp/tests/view_manager_test_suite.cc b/components/mus/public/cpp/tests/view_manager_test_suite.cc index a1e0c98..a349ea6 100644 --- a/components/mus/public/cpp/tests/view_manager_test_suite.cc +++ b/components/mus/public/cpp/tests/view_manager_test_suite.cc @@ -10,7 +10,7 @@ #include "ui/gfx/x/x11_connection.h" #endif -namespace mus { +namespace mojo { ViewManagerTestSuite::ViewManagerTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} @@ -30,4 +30,4 @@ void ViewManagerTestSuite::Initialize() { base::i18n::AllowMultipleInitializeCallsForTesting(); } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/tests/view_manager_test_suite.h b/components/mus/public/cpp/tests/view_manager_test_suite.h index b68bb2f..7010631 100644 --- a/components/mus/public/cpp/tests/view_manager_test_suite.h +++ b/components/mus/public/cpp/tests/view_manager_test_suite.h @@ -8,7 +8,7 @@ #include "base/test/test_suite.h" #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" -namespace mus { +namespace mojo { class ViewManagerTestSuite : public base::TestSuite { public: @@ -22,6 +22,6 @@ class ViewManagerTestSuite : public base::TestSuite { MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerTestSuite); }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_SUITE_H_ diff --git a/components/mus/public/cpp/tests/view_unittest.cc b/components/mus/public/cpp/tests/view_unittest.cc index c991ca3..ca5c3b7 100644 --- a/components/mus/public/cpp/tests/view_unittest.cc +++ b/components/mus/public/cpp/tests/view_unittest.cc @@ -12,7 +12,7 @@ #include "components/mus/public/cpp/view_property.h" #include "testing/gtest/include/gtest/gtest.h" -namespace mus { +namespace mojo { // View ------------------------------------------------------------------------ @@ -423,7 +423,7 @@ class OrderChangeObserver : public ViewObserver { struct Change { View* view; View* relative_view; - mojo::OrderDirection direction; + OrderDirection direction; }; typedef std::vector<Change> Changes; @@ -442,13 +442,13 @@ class OrderChangeObserver : public ViewObserver { // Overridden from ViewObserver: void OnViewReordering(View* view, View* relative_view, - mojo::OrderDirection direction) override { + OrderDirection direction) override { OnViewReordered(view, relative_view, direction); } void OnViewReordered(View* view, View* relative_view, - mojo::OrderDirection direction) override { + OrderDirection direction) override { Change change; change.view = view; change.relative_view = relative_view; @@ -488,11 +488,11 @@ TEST_F(ViewObserverTest, Order) { ASSERT_EQ(2U, changes.size()); EXPECT_EQ(&v11, changes[0].view); EXPECT_EQ(&v13, changes[0].relative_view); - EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[0].direction); + EXPECT_EQ(ORDER_DIRECTION_ABOVE, changes[0].direction); EXPECT_EQ(&v11, changes[1].view); EXPECT_EQ(&v13, changes[1].relative_view); - EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[1].direction); + EXPECT_EQ(ORDER_DIRECTION_ABOVE, changes[1].direction); } { @@ -508,11 +508,11 @@ TEST_F(ViewObserverTest, Order) { ASSERT_EQ(2U, changes.size()); EXPECT_EQ(&v11, changes[0].view); EXPECT_EQ(&v12, changes[0].relative_view); - EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[0].direction); + EXPECT_EQ(ORDER_DIRECTION_BELOW, changes[0].direction); EXPECT_EQ(&v11, changes[1].view); EXPECT_EQ(&v12, changes[1].relative_view); - EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[1].direction); + EXPECT_EQ(ORDER_DIRECTION_BELOW, changes[1].direction); } { @@ -520,7 +520,7 @@ TEST_F(ViewObserverTest, Order) { // Move v11 above v12. // Resulting order: v12. v11, v13 - v11.Reorder(&v12, mojo::ORDER_DIRECTION_ABOVE); + v11.Reorder(&v12, ORDER_DIRECTION_ABOVE); EXPECT_EQ(&v12, v1.children().front()); EXPECT_EQ(&v13, v1.children().back()); @@ -528,11 +528,11 @@ TEST_F(ViewObserverTest, Order) { ASSERT_EQ(2U, changes.size()); EXPECT_EQ(&v11, changes[0].view); EXPECT_EQ(&v12, changes[0].relative_view); - EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[0].direction); + EXPECT_EQ(ORDER_DIRECTION_ABOVE, changes[0].direction); EXPECT_EQ(&v11, changes[1].view); EXPECT_EQ(&v12, changes[1].relative_view); - EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[1].direction); + EXPECT_EQ(ORDER_DIRECTION_ABOVE, changes[1].direction); } { @@ -540,7 +540,7 @@ TEST_F(ViewObserverTest, Order) { // Move v11 below v12. // Resulting order: v11, v12, v13 - v11.Reorder(&v12, mojo::ORDER_DIRECTION_BELOW); + v11.Reorder(&v12, ORDER_DIRECTION_BELOW); EXPECT_EQ(&v11, v1.children().front()); EXPECT_EQ(&v13, v1.children().back()); @@ -548,11 +548,11 @@ TEST_F(ViewObserverTest, Order) { ASSERT_EQ(2U, changes.size()); EXPECT_EQ(&v11, changes[0].view); EXPECT_EQ(&v12, changes[0].relative_view); - EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[0].direction); + EXPECT_EQ(ORDER_DIRECTION_BELOW, changes[0].direction); EXPECT_EQ(&v11, changes[1].view); EXPECT_EQ(&v12, changes[1].relative_view); - EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[1].direction); + EXPECT_EQ(ORDER_DIRECTION_BELOW, changes[1].direction); } } @@ -565,7 +565,7 @@ std::string ViewIdToString(Id id) { : base::StringPrintf("%d,%d", HiWord(id), LoWord(id)); } -std::string RectToString(const mojo::Rect& rect) { +std::string RectToString(const Rect& rect) { return base::StringPrintf("%d,%d %dx%d", rect.x, rect.y, rect.width, rect.height); } @@ -586,16 +586,16 @@ class BoundsChangeObserver : public ViewObserver { private: // Overridden from ViewObserver: void OnViewBoundsChanging(View* view, - const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) override { + const Rect& old_bounds, + const Rect& new_bounds) override { changes_.push_back(base::StringPrintf( "view=%s old_bounds=%s new_bounds=%s phase=changing", ViewIdToString(view->id()).c_str(), RectToString(old_bounds).c_str(), RectToString(new_bounds).c_str())); } void OnViewBoundsChanged(View* view, - const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) override { + const Rect& old_bounds, + const Rect& new_bounds) override { changes_.push_back(base::StringPrintf( "view=%s old_bounds=%s new_bounds=%s phase=changed", ViewIdToString(view->id()).c_str(), RectToString(old_bounds).c_str(), @@ -614,7 +614,7 @@ TEST_F(ViewObserverTest, SetBounds) { TestView v1; { BoundsChangeObserver observer(&v1); - mojo::Rect rect; + Rect rect; rect.width = rect.height = 100; v1.SetBounds(rect); @@ -871,4 +871,4 @@ TEST_F(ViewObserverTest, LocalPropertyChanged) { o.PropertyChangeInfoAndClear()); } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/types.h b/components/mus/public/cpp/types.h index a81a0bc7..3e7f07f 100644 --- a/components/mus/public/cpp/types.h +++ b/components/mus/public/cpp/types.h @@ -10,7 +10,7 @@ // Typedefs for the transport types. These typedefs match that of the mojom // file, see it for specifics. -namespace mus { +namespace mojo { // Used to identify views and change ids. typedef uint32_t Id; @@ -20,6 +20,6 @@ typedef uint32_t Id; // connection and the ConnectionSpecificId of the view. typedef uint16_t ConnectionSpecificId; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_TYPES_H_ diff --git a/components/mus/public/cpp/util.h b/components/mus/public/cpp/util.h index c9cd91f..96f8eeb 100644 --- a/components/mus/public/cpp/util.h +++ b/components/mus/public/cpp/util.h @@ -15,7 +15,7 @@ #undef LoWord #endif -namespace mus { +namespace mojo { inline uint16_t HiWord(uint32_t id) { return static_cast<uint16_t>((id >> 16) & 0xFFFF); @@ -25,6 +25,6 @@ inline uint16_t LoWord(uint32_t id) { return static_cast<uint16_t>(id & 0xFFFF); } -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_UTIL_H_ diff --git a/components/mus/public/cpp/view.h b/components/mus/public/cpp/view.h index f65f79a..e2cded9 100644 --- a/components/mus/public/cpp/view.h +++ b/components/mus/public/cpp/view.h @@ -11,15 +11,15 @@ #include "base/callback.h" #include "base/observer_list.h" #include "components/mus/public/cpp/types.h" -#include "components/mus/public/interfaces/mus_constants.mojom.h" #include "components/mus/public/interfaces/surface_id.mojom.h" +#include "components/mus/public/interfaces/view_manager_constants.mojom.h" #include "components/mus/public/interfaces/view_tree.mojom.h" #include "mojo/application/public/interfaces/service_provider.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" #include "ui/mojo/geometry/geometry.mojom.h" -namespace mus { +namespace mojo { class ServiceProviderImpl; class View; @@ -55,14 +55,14 @@ class View { Id id() const { return id_; } // Geometric disposition. - const mojo::Rect& bounds() const { return bounds_; } - void SetBounds(const mojo::Rect& bounds); + const Rect& bounds() const { return bounds_; } + void SetBounds(const Rect& bounds); // Visibility (also see IsDrawn()). When created views are hidden. bool visible() const { return visible_; } void SetVisible(bool value); - const mojo::ViewportMetrics& viewport_metrics() { return *viewport_metrics_; } + const ViewportMetrics& viewport_metrics() { return *viewport_metrics_; } scoped_ptr<ViewSurface> RequestSurface(); @@ -120,7 +120,7 @@ class View { void AddChild(View* child); void RemoveChild(View* child); - void Reorder(View* relative, mojo::OrderDirection direction); + void Reorder(View* relative, OrderDirection direction); void MoveToFront(); void MoveToBack(); @@ -128,19 +128,19 @@ class View { View* GetChildById(Id id); - void SetTextInputState(mojo::TextInputStatePtr state); - void SetImeVisibility(bool visible, mojo::TextInputStatePtr state); + void SetTextInputState(TextInputStatePtr state); + void SetImeVisibility(bool visible, TextInputStatePtr state); // Focus. void SetFocus(); bool HasFocus() const; // Embedding. See view_tree.mojom for details. - void Embed(mojo::ViewTreeClientPtr client); + void Embed(ViewTreeClientPtr client); // NOTE: callback is run synchronously if Embed() is not allowed on this // View. - void Embed(mojo::ViewTreeClientPtr client, + void Embed(ViewTreeClientPtr client, uint32_t policy_bitmask, const EmbedCallback& callback); @@ -168,11 +168,10 @@ class View { void LocalAddChild(View* child); void LocalRemoveChild(View* child); // Returns true if the order actually changed. - bool LocalReorder(View* relative, mojo::OrderDirection direction); - void LocalSetBounds(const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds); - void LocalSetViewportMetrics(const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics); + bool LocalReorder(View* relative, OrderDirection direction); + void LocalSetBounds(const Rect& old_bounds, const Rect& new_bounds); + void LocalSetViewportMetrics(const ViewportMetrics& old_metrics, + const ViewportMetrics& new_metrics); void LocalSetDrawn(bool drawn); void LocalSetVisible(bool visible); @@ -199,8 +198,8 @@ class View { base::ObserverList<ViewObserver> observers_; - mojo::Rect bounds_; - mojo::ViewportMetricsPtr viewport_metrics_; + Rect bounds_; + ViewportMetricsPtr viewport_metrics_; bool visible_; @@ -224,6 +223,6 @@ class View { MOJO_DISALLOW_COPY_AND_ASSIGN(View); }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_H_ diff --git a/components/mus/public/cpp/view_observer.h b/components/mus/public/cpp/view_observer.h index 2bd541b..8c0dd25 100644 --- a/components/mus/public/cpp/view_observer.h +++ b/components/mus/public/cpp/view_observer.h @@ -10,7 +10,7 @@ #include "components/mus/public/cpp/view.h" #include "ui/mojo/events/input_events.mojom.h" -namespace mus { +namespace mojo { class View; @@ -39,29 +39,29 @@ class ViewObserver { virtual void OnViewReordering(View* view, View* relative_view, - mojo::OrderDirection direction) {} + OrderDirection direction) {} virtual void OnViewReordered(View* view, View* relative_view, - mojo::OrderDirection direction) {} + OrderDirection direction) {} virtual void OnViewDestroying(View* view) {} virtual void OnViewDestroyed(View* view) {} virtual void OnViewBoundsChanging(View* view, - const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) {} + const Rect& old_bounds, + const Rect& new_bounds) {} virtual void OnViewBoundsChanged(View* view, - const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) {} + const Rect& old_bounds, + const Rect& new_bounds) {} virtual void OnViewViewportMetricsChanged( View* view, - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) {} + const ViewportMetrics& old_metrics, + const ViewportMetrics& new_metrics) {} virtual void OnViewFocusChanged(View* gained_focus, View* lost_focus) {} - virtual void OnViewInputEvent(View* view, const mojo::EventPtr& event) {} + virtual void OnViewInputEvent(View* view, const EventPtr& event) {} virtual void OnViewVisibilityChanging(View* view) {} virtual void OnViewVisibilityChanged(View* view) {} @@ -97,6 +97,6 @@ class ViewObserver { virtual ~ViewObserver() {} }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_OBSERVER_H_ diff --git a/components/mus/public/cpp/view_property.h b/components/mus/public/cpp/view_property.h index ccebb7c..fee92e7 100644 --- a/components/mus/public/cpp/view_property.h +++ b/components/mus/public/cpp/view_property.h @@ -40,7 +40,7 @@ // If a property type is not exported, use DECLARE_VIEW_PROPERTY_TYPE(MyType) // which is a shorthand for DECLARE_EXPORTED_VIEW_PROPERTY_TYPE(, MyType). -namespace mus { +namespace mojo { namespace { // No single new-style cast works for every conversion to/from int64_t, so we @@ -99,41 +99,41 @@ void View::ClearLocalProperty(const ViewProperty<T>* property) { SetLocalProperty(property, property->default_value); } -} // namespace mus +} // namespace mojo // Macros to instantiate the property getter/setter template functions. -#define DECLARE_EXPORTED_VIEW_PROPERTY_TYPE(EXPORT, T) \ - template EXPORT void mus::View::SetLocalProperty( \ - const mus::ViewProperty<T>*, T); \ - template EXPORT T mus::View::GetLocalProperty(const mus::ViewProperty<T>*) \ - const; \ - template EXPORT void mus::View::ClearLocalProperty( \ - const mus::ViewProperty<T>*); +#define DECLARE_EXPORTED_VIEW_PROPERTY_TYPE(EXPORT, T) \ + template EXPORT void mojo::View::SetLocalProperty( \ + const mojo::ViewProperty<T>*, T); \ + template EXPORT T mojo::View::GetLocalProperty(const mojo::ViewProperty<T>*) \ + const; \ + template EXPORT void mojo::View::ClearLocalProperty( \ + const mojo::ViewProperty<T>*); #define DECLARE_VIEW_PROPERTY_TYPE(T) DECLARE_EXPORTED_VIEW_PROPERTY_TYPE(, T) #define DEFINE_VIEW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64_t), property_type_too_large); \ namespace { \ - const mus::ViewProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \ + const mojo::ViewProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \ } \ - const mus::ViewProperty<TYPE>* const NAME = &NAME##_Value; + const mojo::ViewProperty<TYPE>* const NAME = &NAME##_Value; #define DEFINE_LOCAL_VIEW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64_t), property_type_too_large); \ namespace { \ - const mus::ViewProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \ - const mus::ViewProperty<TYPE>* const NAME = &NAME##_Value; \ + const mojo::ViewProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \ + const mojo::ViewProperty<TYPE>* const NAME = &NAME##_Value; \ } -#define DEFINE_OWNED_VIEW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ - namespace { \ - void Deallocator##NAME(int64_t p) { \ - enum { type_must_be_complete = sizeof(TYPE) }; \ - delete mus::ViewPropertyCaster<TYPE*>::FromInt64(p); \ - } \ - const mus::ViewProperty<TYPE*> NAME##_Value = {DEFAULT, #NAME, \ - &Deallocator##NAME}; \ - } \ - const mus::ViewProperty<TYPE*>* const NAME = &NAME##_Value; +#define DEFINE_OWNED_VIEW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ + namespace { \ + void Deallocator##NAME(int64_t p) { \ + enum { type_must_be_complete = sizeof(TYPE) }; \ + delete mojo::ViewPropertyCaster<TYPE*>::FromInt64(p); \ + } \ + const mojo::ViewProperty<TYPE*> NAME##_Value = {DEFAULT, #NAME, \ + &Deallocator##NAME}; \ + } \ + const mojo::ViewProperty<TYPE*>* const NAME = &NAME##_Value; #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_PROPERTY_H_ diff --git a/components/mus/public/cpp/view_surface.h b/components/mus/public/cpp/view_surface.h index 91b0a482..f29bb92 100644 --- a/components/mus/public/cpp/view_surface.h +++ b/components/mus/public/cpp/view_surface.h @@ -10,7 +10,7 @@ #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h" -namespace mus { +namespace mojo { class ViewSurfaceClient; class View; @@ -28,10 +28,10 @@ class ViewSurface : public mojo::SurfaceClient { // TODO(fsamuel): Add a callback. void SubmitCompositorFrame(mojo::CompositorFramePtr frame); - void set_client(ViewSurfaceClient* client) { client_ = client; } + void set_client(mojo::ViewSurfaceClient* client) { client_ = client; } private: - friend class View; + friend class mojo::View; ViewSurface(mojo::InterfacePtrInfo<mojo::Surface> surface_info, mojo::InterfaceRequest<mojo::SurfaceClient> client_request); @@ -40,7 +40,7 @@ class ViewSurface : public mojo::SurfaceClient { void ReturnResources( mojo::Array<mojo::ReturnedResourcePtr> resources) override; - ViewSurfaceClient* client_; + mojo::ViewSurfaceClient* client_; mojo::InterfacePtrInfo<mojo::Surface> surface_info_; mojo::InterfaceRequest<mojo::SurfaceClient> client_request_; mojo::SurfacePtr surface_; @@ -48,6 +48,6 @@ class ViewSurface : public mojo::SurfaceClient { bool bound_to_thread_; }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_SURFACE_H_ diff --git a/components/mus/public/cpp/view_surface_client.h b/components/mus/public/cpp/view_surface_client.h index 0ac2c54..e8724c8 100644 --- a/components/mus/public/cpp/view_surface_client.h +++ b/components/mus/public/cpp/view_surface_client.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_MUS_PUBLIC_CPP_VIEW_SURFACE_CLIENT_H_ #define COMPONENTS_MUS_PUBLIC_CPP_VIEW_SURFACE_CLIENT_H_ -namespace mus { +namespace mojo { class ViewSurface; @@ -19,6 +19,6 @@ class ViewSurfaceClient { ~ViewSurfaceClient() {} }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_SURFACE_CLIENT_H_ diff --git a/components/mus/public/cpp/view_tracker.cc b/components/mus/public/cpp/view_tracker.cc index 3d97857..111c9e6 100644 --- a/components/mus/public/cpp/view_tracker.cc +++ b/components/mus/public/cpp/view_tracker.cc @@ -4,7 +4,7 @@ #include "components/mus/public/cpp/view_tracker.h" -namespace mus { +namespace mojo { ViewTracker::ViewTracker() {} @@ -37,4 +37,4 @@ void ViewTracker::OnViewDestroying(View* view) { Remove(view); } -} // namespace mus +} // namespace mojo diff --git a/components/mus/public/cpp/view_tracker.h b/components/mus/public/cpp/view_tracker.h index f551d5a..39d715b 100644 --- a/components/mus/public/cpp/view_tracker.h +++ b/components/mus/public/cpp/view_tracker.h @@ -11,7 +11,7 @@ #include "components/mus/public/cpp/view_observer.h" #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" -namespace mus { +namespace mojo { class ViewTracker : public ViewObserver { public: @@ -42,6 +42,6 @@ class ViewTracker : public ViewObserver { MOJO_DISALLOW_COPY_AND_ASSIGN(ViewTracker); }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_TRACKER_H_ diff --git a/components/mus/public/cpp/view_tree_connection.h b/components/mus/public/cpp/view_tree_connection.h index 984e664..36b8588 100644 --- a/components/mus/public/cpp/view_tree_connection.h +++ b/components/mus/public/cpp/view_tree_connection.h @@ -11,8 +11,7 @@ #include "components/mus/public/interfaces/view_tree.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" -namespace mus { - +namespace mojo { class View; class ViewTreeDelegate; @@ -24,9 +23,8 @@ class ViewTreeConnection { // The returned ViewTreeConnection instance owns itself, and is deleted when // the last root is destroyed or the connection to the service is broken. - static ViewTreeConnection* Create( - ViewTreeDelegate* delegate, - mojo::InterfaceRequest<mojo::ViewTreeClient> request); + static ViewTreeConnection* Create(ViewTreeDelegate* delegate, + InterfaceRequest<ViewTreeClient> request); // Returns the root of this connection. virtual View* GetRoot() = 0; @@ -49,6 +47,6 @@ class ViewTreeConnection { virtual ConnectionSpecificId GetConnectionId() = 0; }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_TREE_CONNECTION_H_ diff --git a/components/mus/public/cpp/view_tree_delegate.h b/components/mus/public/cpp/view_tree_delegate.h index 2e2115e..4d58f6f 100644 --- a/components/mus/public/cpp/view_tree_delegate.h +++ b/components/mus/public/cpp/view_tree_delegate.h @@ -11,7 +11,7 @@ #include "mojo/application/public/interfaces/service_provider.mojom.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h" -namespace mus { +namespace mojo { class View; class ViewTreeConnection; @@ -58,6 +58,6 @@ class ViewTreeDelegate { virtual ~ViewTreeDelegate() {} }; -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_TREE_DELEGATE_H_ diff --git a/components/mus/public/cpp/view_tree_host_factory.h b/components/mus/public/cpp/view_tree_host_factory.h index 0e44441..d4ac5eb 100644 --- a/components/mus/public/cpp/view_tree_host_factory.h +++ b/components/mus/public/cpp/view_tree_host_factory.h @@ -12,26 +12,23 @@ #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" namespace mojo { -class ApplicationImpl; -} - -namespace mus { +class ApplicationImpl; class ViewTreeDelegate; // Uses |factory| to create a new |host|, providing the supplied |host_client| // which may be null. |delegate| must not be null. -void CreateViewTreeHost(mojo::ViewTreeHostFactory* factory, - mojo::ViewTreeHostClientPtr host_client, +void CreateViewTreeHost(ViewTreeHostFactory* factory, + ViewTreeHostClientPtr host_client, ViewTreeDelegate* delegate, - mojo::ViewTreeHostPtr* host); + ViewTreeHostPtr* host); // Creates a single host with no client by connecting to the view manager // application. Useful only for tests and trivial UIs. -void CreateSingleViewTreeHost(mojo::ApplicationImpl* app, +void CreateSingleViewTreeHost(ApplicationImpl* app, ViewTreeDelegate* delegate, - mojo::ViewTreeHostPtr* host); + ViewTreeHostPtr* host); -} // namespace mus +} // namespace mojo #endif // COMPONENTS_MUS_PUBLIC_CPP_VIEW_TREE_HOST_FACTORY_H_ diff --git a/components/mus/public/interfaces/BUILD.gn b/components/mus/public/interfaces/BUILD.gn index 80d443b..2ac5fb3 100644 --- a/components/mus/public/interfaces/BUILD.gn +++ b/components/mus/public/interfaces/BUILD.gn @@ -10,9 +10,9 @@ mojom("interfaces") { "compositor_frame.mojom", "gpu.mojom", "gpu_capabilities.mojom", - "mus_constants.mojom", "quads.mojom", "surface_id.mojom", + "view_manager_constants.mojom", "view_tree.mojom", "view_tree_host.mojom", ] diff --git a/components/mus/public/interfaces/mus_constants.mojom b/components/mus/public/interfaces/view_manager_constants.mojom index 14bd363..14bd363 100644 --- a/components/mus/public/interfaces/mus_constants.mojom +++ b/components/mus/public/interfaces/view_manager_constants.mojom diff --git a/components/mus/public/interfaces/view_tree.mojom b/components/mus/public/interfaces/view_tree.mojom index 47ed4c7..21643ea 100644 --- a/components/mus/public/interfaces/view_tree.mojom +++ b/components/mus/public/interfaces/view_tree.mojom @@ -6,7 +6,7 @@ module mojo; import "components/mus/public/interfaces/compositor_frame.mojom"; import "components/mus/public/interfaces/surface_id.mojom"; -import "components/mus/public/interfaces/mus_constants.mojom"; +import "components/mus/public/interfaces/view_manager_constants.mojom"; import "mojo/application/public/interfaces/service_provider.mojom"; import "network/public/interfaces/url_loader.mojom"; import "ui/mojo/events/input_events.mojom"; diff --git a/components/mus/server_view.cc b/components/mus/server_view.cc index 41df118..e298e75 100644 --- a/components/mus/server_view.cc +++ b/components/mus/server_view.cc @@ -13,7 +13,7 @@ #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/converters/surfaces/surfaces_type_converters.h" -namespace mus { +namespace view_manager { namespace { @@ -311,4 +311,4 @@ void ServerView::RemoveImpl(ServerView* view) { children_.erase(std::find(children_.begin(), children_.end(), view)); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/server_view.h b/components/mus/server_view.h index afd82d85..70a58c9 100644 --- a/components/mus/server_view.h +++ b/components/mus/server_view.h @@ -20,7 +20,7 @@ #include "ui/gfx/transform.h" #include "ui/platform_window/text_input_state.h" -namespace mus { +namespace view_manager { class ServerViewDelegate; class ServerViewObserver; @@ -148,6 +148,6 @@ class ServerView : public mojo::Surface, public cc::SurfaceFactoryClient { DISALLOW_COPY_AND_ASSIGN(ServerView); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_SERVER_VIEW_H_ diff --git a/components/mus/server_view_delegate.h b/components/mus/server_view_delegate.h index abe0aaa..8f846a8 100644 --- a/components/mus/server_view_delegate.h +++ b/components/mus/server_view_delegate.h @@ -7,23 +7,26 @@ #include "base/memory/scoped_ptr.h" #include "components/mus/public/interfaces/compositor_frame.mojom.h" -#include "components/mus/public/interfaces/mus_constants.mojom.h" +#include "components/mus/public/interfaces/view_manager_constants.mojom.h" namespace cc { class CompositorFrame; } -namespace mus { +namespace surfaces { +class SurfacesState; +} + +namespace view_manager { class ServerView; -class SurfacesState; class ServerViewDelegate { public: virtual scoped_ptr<cc::CompositorFrame> UpdateViewTreeFromCompositorFrame( const mojo::CompositorFramePtr& input) = 0; - virtual SurfacesState* GetSurfacesState() = 0; + virtual surfaces::SurfacesState* GetSurfacesState() = 0; virtual void OnScheduleViewPaint(const ServerView* view) = 0; @@ -35,6 +38,6 @@ class ServerViewDelegate { virtual ~ServerViewDelegate() {} }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_SERVER_VIEW_DELEGATE_H_ diff --git a/components/mus/server_view_drawn_tracker.cc b/components/mus/server_view_drawn_tracker.cc index 85a05a8..af08ad9 100644 --- a/components/mus/server_view_drawn_tracker.cc +++ b/components/mus/server_view_drawn_tracker.cc @@ -7,7 +7,7 @@ #include "components/mus/server_view.h" #include "components/mus/server_view_drawn_tracker_observer.h" -namespace mus { +namespace view_manager { ServerViewDrawnTracker::ServerViewDrawnTracker( ServerView* view, @@ -69,4 +69,4 @@ void ServerViewDrawnTracker::OnViewVisibilityChanged(ServerView* view) { SetDrawn(is_drawn ? nullptr : view->parent(), is_drawn); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/server_view_drawn_tracker.h b/components/mus/server_view_drawn_tracker.h index 294d6b48..1c73f8d 100644 --- a/components/mus/server_view_drawn_tracker.h +++ b/components/mus/server_view_drawn_tracker.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "components/mus/server_view_observer.h" -namespace mus { +namespace view_manager { class ServerViewDrawnTrackerObserver; @@ -51,6 +51,6 @@ class ServerViewDrawnTracker : public ServerViewObserver { DISALLOW_COPY_AND_ASSIGN(ServerViewDrawnTracker); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_SERVER_VIEW_DRAWN_TRACKER_H_ diff --git a/components/mus/server_view_drawn_tracker_observer.h b/components/mus/server_view_drawn_tracker_observer.h index adf62c6..7fa1aa5 100644 --- a/components/mus/server_view_drawn_tracker_observer.h +++ b/components/mus/server_view_drawn_tracker_observer.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_MUS_SERVER_VIEW_DRAWN_TRACKER_OBSERVER_H_ #define COMPONENTS_MUS_SERVER_VIEW_DRAWN_TRACKER_OBSERVER_H_ -namespace mus { +namespace view_manager { class ServerView; @@ -23,6 +23,6 @@ class ServerViewDrawnTrackerObserver { virtual ~ServerViewDrawnTrackerObserver() {} }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_SERVER_VIEW_DRAWN_TRACKER_OBSERVER_H_ diff --git a/components/mus/server_view_drawn_tracker_unittest.cc b/components/mus/server_view_drawn_tracker_unittest.cc index c1596cf..adc3936 100644 --- a/components/mus/server_view_drawn_tracker_unittest.cc +++ b/components/mus/server_view_drawn_tracker_unittest.cc @@ -9,7 +9,7 @@ #include "components/mus/test_server_view_delegate.h" #include "testing/gtest/include/gtest/gtest.h" -namespace mus { +namespace view_manager { namespace { class TestServerViewDrawnTrackerObserver @@ -136,4 +136,4 @@ TEST(ServerViewDrawnTrackerTest, ChangeBecauseOfRemovingAncestorFromRoot) { EXPECT_TRUE(drawn_observer.is_drawn()); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/server_view_observer.h b/components/mus/server_view_observer.h index d744639..51c14fa 100644 --- a/components/mus/server_view_observer.h +++ b/components/mus/server_view_observer.h @@ -5,13 +5,13 @@ #ifndef COMPONENTS_MUS_SERVER_VIEW_OBSERVER_H_ #define COMPONENTS_MUS_SERVER_VIEW_OBSERVER_H_ -#include "components/mus/public/interfaces/mus_constants.mojom.h" +#include "components/mus/public/interfaces/view_manager_constants.mojom.h" namespace gfx { class Rect; } -namespace mus { +namespace mojo { class ViewportMetrics; } @@ -19,7 +19,7 @@ namespace ui { struct TextInputState; } -namespace mus { +namespace view_manager { class ServerView; @@ -65,6 +65,6 @@ class ServerViewObserver { virtual ~ServerViewObserver() {} }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_SERVER_VIEW_OBSERVER_H_ diff --git a/components/mus/surfaces/surfaces_context_provider.cc b/components/mus/surfaces/surfaces_context_provider.cc index c11fe0d..c98718a 100644 --- a/components/mus/surfaces/surfaces_context_provider.cc +++ b/components/mus/surfaces/surfaces_context_provider.cc @@ -16,7 +16,7 @@ #include "gpu/command_buffer/client/gles2_implementation.h" #include "gpu/command_buffer/client/transfer_buffer.h" -namespace mus { +namespace surfaces { namespace { const size_t kDefaultCommandBufferSize = 1024 * 1024; @@ -28,10 +28,11 @@ const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; SurfacesContextProvider::SurfacesContextProvider( SurfacesContextProviderDelegate* delegate, gfx::AcceleratedWidget widget, - const scoped_refptr<GpuState>& state) + const scoped_refptr<gles2::GpuState>& state) : delegate_(delegate), widget_(widget) { capabilities_.gpu.image = true; - command_buffer_local_.reset(new CommandBufferLocal(this, widget_, state)); + command_buffer_local_.reset( + new gles2::CommandBufferLocal(this, widget_, state)); } // This is called when we have an accelerated widget. @@ -115,4 +116,4 @@ void SurfacesContextProvider::DidLoseContext() { lost_context_callback_.Run(); } -} // namespace mus +} // namespace surfaces diff --git a/components/mus/surfaces/surfaces_context_provider.h b/components/mus/surfaces/surfaces_context_provider.h index 37cdfab..c8fd3eb 100644 --- a/components/mus/surfaces/surfaces_context_provider.h +++ b/components/mus/surfaces/surfaces_context_provider.h @@ -23,21 +23,24 @@ class GLES2Implementation; } // namespace gpu -namespace mus { - +namespace gles2 { class CommandBufferDriver; class CommandBufferImpl; class CommandBufferLocal; class GpuState; +} + +namespace surfaces { + class SurfacesContextProviderDelegate; class SurfacesContextProvider : public cc::ContextProvider, - public CommandBufferLocalClient, + public gles2::CommandBufferLocalClient, public base::NonThreadSafe { public: SurfacesContextProvider(SurfacesContextProviderDelegate* delegate, gfx::AcceleratedWidget widget, - const scoped_refptr<GpuState>& state); + const scoped_refptr<gles2::GpuState>& state); // cc::ContextProvider implementation. bool BindToCurrentThread() override; @@ -77,13 +80,13 @@ class SurfacesContextProvider : public cc::ContextProvider, SurfacesContextProviderDelegate* delegate_; gfx::AcceleratedWidget widget_; - scoped_ptr<CommandBufferLocal> command_buffer_local_; + scoped_ptr<gles2::CommandBufferLocal> command_buffer_local_; base::Lock context_lock_; DISALLOW_COPY_AND_ASSIGN(SurfacesContextProvider); }; -} // namespace mus +} // namespace surfaces #endif // COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_H_ diff --git a/components/mus/surfaces/surfaces_context_provider_delegate.h b/components/mus/surfaces/surfaces_context_provider_delegate.h index 7da78d8..ff27f7d 100644 --- a/components/mus/surfaces/surfaces_context_provider_delegate.h +++ b/components/mus/surfaces/surfaces_context_provider_delegate.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_DELEGATE_H_ #define COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_DELEGATE_H_ -namespace mus { +namespace surfaces { class SurfacesContextProviderDelegate { public: @@ -15,6 +15,6 @@ class SurfacesContextProviderDelegate { virtual ~SurfacesContextProviderDelegate() {} }; -} // namespace mus +} // namespace surfaces #endif // COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_DELEGATE_H_ diff --git a/components/mus/surfaces/surfaces_output_surface.cc b/components/mus/surfaces/surfaces_output_surface.cc index 46ccdb6..63053a4 100644 --- a/components/mus/surfaces/surfaces_output_surface.cc +++ b/components/mus/surfaces/surfaces_output_surface.cc @@ -11,7 +11,7 @@ #include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" -namespace mus { +namespace surfaces { DirectOutputSurface::DirectOutputSurface( const scoped_refptr<cc::ContextProvider>& context_provider) @@ -37,4 +37,4 @@ void DirectOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { client_->DidSwapBuffers(); } -} // namespace mus +} // namespace surfaces diff --git a/components/mus/surfaces/surfaces_output_surface.h b/components/mus/surfaces/surfaces_output_surface.h index 3bd62df..ea05a50 100644 --- a/components/mus/surfaces/surfaces_output_surface.h +++ b/components/mus/surfaces/surfaces_output_surface.h @@ -7,7 +7,7 @@ #include "cc/output/output_surface.h" -namespace mus { +namespace surfaces { // An OutputSurface implementation that directly draws and // swaps to an actual GL surface. @@ -24,6 +24,6 @@ class DirectOutputSurface : public cc::OutputSurface { base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; }; -} // namespace mus +} // namespace surfaces #endif // COMPONENTS_MUS_SURFACES_SURFACES_OUTPUT_SURFACE_H_
\ No newline at end of file diff --git a/components/mus/surfaces/surfaces_scheduler.cc b/components/mus/surfaces/surfaces_scheduler.cc index f3752f8..a938f33 100644 --- a/components/mus/surfaces/surfaces_scheduler.cc +++ b/components/mus/surfaces/surfaces_scheduler.cc @@ -8,7 +8,7 @@ #include "cc/scheduler/compositor_timing_history.h" #include "cc/surfaces/display.h" -namespace mus { +namespace surfaces { SurfacesScheduler::SurfacesScheduler() : rendering_stats_instrumentation_( @@ -98,4 +98,4 @@ void SurfacesScheduler::SendBeginFramesToChildren( void SurfacesScheduler::SendBeginMainFrameNotExpectedSoon() {} -} // namespace mus +} // namespace mojo diff --git a/components/mus/surfaces/surfaces_scheduler.h b/components/mus/surfaces/surfaces_scheduler.h index bffd9dd..86f05c3 100644 --- a/components/mus/surfaces/surfaces_scheduler.h +++ b/components/mus/surfaces/surfaces_scheduler.h @@ -14,7 +14,7 @@ class Display; class RenderingStatsInstrumentation; } -namespace mus { +namespace surfaces { // TODO(brianderson): Reconcile with DisplayScheduler crbug.com/476676 class SurfacesScheduler : public cc::SchedulerClient { @@ -53,6 +53,6 @@ class SurfacesScheduler : public cc::SchedulerClient { DISALLOW_COPY_AND_ASSIGN(SurfacesScheduler); }; -} // namespace mus +} // namespace surfaces #endif // COMPONENTS_MUS_SURFACES_SURFACES_SCHEDULER_H_ diff --git a/components/mus/surfaces/surfaces_state.cc b/components/mus/surfaces/surfaces_state.cc index e3dfeb8..6ae5118 100644 --- a/components/mus/surfaces/surfaces_state.cc +++ b/components/mus/surfaces/surfaces_state.cc @@ -4,10 +4,10 @@ #include "components/mus/surfaces/surfaces_state.h" -namespace mus { +namespace surfaces { SurfacesState::SurfacesState() : next_id_namespace_(1u) {} SurfacesState::~SurfacesState() {} -} // namespace mus +} // namespace surfaces diff --git a/components/mus/surfaces/surfaces_state.h b/components/mus/surfaces/surfaces_state.h index 5d31930..b4d4a2e 100644 --- a/components/mus/surfaces/surfaces_state.h +++ b/components/mus/surfaces/surfaces_state.h @@ -14,7 +14,7 @@ namespace cc { class SurfaceManager; } // namespace cc -namespace mus { +namespace surfaces { // The SurfacesState object is an object global to the View Manager app that // holds the SurfaceManager, SurfacesScheduler and allocates new Surfaces @@ -45,6 +45,6 @@ class SurfacesState : public base::RefCounted<SurfacesState> { DISALLOW_COPY_AND_ASSIGN(SurfacesState); }; -} // namespace mus +} // namespace surfaces #endif // COMPONENTS_MUS_SURFACES_SURFACES_STATE_H_ diff --git a/components/mus/surfaces/top_level_display_client.cc b/components/mus/surfaces/top_level_display_client.cc index 5f225f9..e3218af 100644 --- a/components/mus/surfaces/top_level_display_client.cc +++ b/components/mus/surfaces/top_level_display_client.cc @@ -12,7 +12,7 @@ #include "components/mus/surfaces/surfaces_scheduler.h" #include "components/mus/surfaces/surfaces_state.h" -namespace mus { +namespace surfaces { namespace { void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) { callback.Run(); @@ -21,7 +21,7 @@ void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) { TopLevelDisplayClient::TopLevelDisplayClient( gfx::AcceleratedWidget widget, - const scoped_refptr<GpuState>& gpu_state, + const scoped_refptr<gles2::GpuState>& gpu_state, const scoped_refptr<SurfacesState>& surfaces_state) : surfaces_state_(surfaces_state), factory_(surfaces_state->manager(), this), @@ -35,7 +35,7 @@ TopLevelDisplayClient::TopLevelDisplayClient( // TODO(brianderson): Reconcile with SurfacesScheduler crbug.com/476676 cc::DisplayScheduler* null_display_scheduler = nullptr; display_->Initialize( - make_scoped_ptr(new DirectOutputSurface( + make_scoped_ptr(new surfaces::DirectOutputSurface( new SurfacesContextProvider(this, widget, gpu_state))), null_display_scheduler); @@ -101,4 +101,4 @@ void TopLevelDisplayClient::ReturnResources( // TODO(fsamuel): Implement this. } -} // namespace mus +} // namespace surfaces diff --git a/components/mus/surfaces/top_level_display_client.h b/components/mus/surfaces/top_level_display_client.h index 3122c44..5179589 100644 --- a/components/mus/surfaces/top_level_display_client.h +++ b/components/mus/surfaces/top_level_display_client.h @@ -9,7 +9,6 @@ #include "cc/surfaces/display_client.h" #include "cc/surfaces/surface_factory.h" #include "cc/surfaces/surface_factory_client.h" -#include "components/mus/gles2/gpu_state.h" #include "components/mus/surfaces/surfaces_context_provider.h" #include "components/mus/surfaces/surfaces_context_provider_delegate.h" #include "components/mus/surfaces/surfaces_state.h" @@ -21,7 +20,11 @@ class Display; class SurfaceFactory; } -namespace mus { +namespace gles2 { +class GpuState; +} + +namespace surfaces { class DisplayDelegate; class SurfacesScheduler; @@ -32,10 +35,10 @@ class SurfacesState; // scheduled to be generated here based on VSync. class TopLevelDisplayClient : public cc::DisplayClient, public cc::SurfaceFactoryClient, - public SurfacesContextProviderDelegate { + public surfaces::SurfacesContextProviderDelegate { public: TopLevelDisplayClient(gfx::AcceleratedWidget widget, - const scoped_refptr<GpuState>& gpu_state, + const scoped_refptr<gles2::GpuState>& gpu_state, const scoped_refptr<SurfacesState>& surfaces_state); ~TopLevelDisplayClient() override; @@ -68,6 +71,6 @@ class TopLevelDisplayClient : public cc::DisplayClient, DISALLOW_COPY_AND_ASSIGN(TopLevelDisplayClient); }; -} // namespace mus +} // namespace surfaces #endif // COMPONENTS_MUS_SURFACES_DISPLAY_IMPL_H_ diff --git a/components/mus/test_change_tracker.cc b/components/mus/test_change_tracker.cc index 72dd0bc..117c639 100644 --- a/components/mus/test_change_tracker.cc +++ b/components/mus/test_change_tracker.cc @@ -10,14 +10,15 @@ #include "mojo/common/common_type_converters.h" using mojo::Array; +using mojo::Id; using mojo::ViewDataPtr; using mojo::String; -namespace mus { +namespace view_manager { std::string ViewIdToString(Id id) { - return (id == 0) ? "null" - : base::StringPrintf("%d,%d", HiWord(id), LoWord(id)); + return (id == 0) ? "null" : base::StringPrintf("%d,%d", mojo::HiWord(id), + mojo::LoWord(id)); } namespace { @@ -171,7 +172,7 @@ TestChangeTracker::TestChangeTracker() : delegate_(NULL) {} TestChangeTracker::~TestChangeTracker() {} -void TestChangeTracker::OnEmbed(ConnectionSpecificId connection_id, +void TestChangeTracker::OnEmbed(mojo::ConnectionSpecificId connection_id, ViewDataPtr root) { Change change; change.type = CHANGE_TYPE_EMBED; @@ -288,7 +289,7 @@ void TestChangeTracker::OnViewSharedPropertyChanged(Id view_id, AddChange(change); } -void TestChangeTracker::OnViewFocused(Id view_id) { +void TestChangeTracker::OnViewFocused(mojo::Id view_id) { Change change; change.type = CHANGE_TYPE_FOCUSED; change.view_id = view_id; @@ -325,4 +326,4 @@ std::string TestView::ToString2() const { drawn ? "true" : "false"); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/test_change_tracker.h b/components/mus/test_change_tracker.h index 358a464..a8a5b28 100644 --- a/components/mus/test_change_tracker.h +++ b/components/mus/test_change_tracker.h @@ -14,7 +14,7 @@ #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" #include "ui/mojo/geometry/geometry.mojom.h" -namespace mus { +namespace view_manager { enum ChangeType { CHANGE_TYPE_EMBED, @@ -45,8 +45,8 @@ struct TestView { // Returns a string description that includes visible and drawn. std::string ToString2() const; - Id parent_id; - Id view_id; + mojo::Id parent_id; + mojo::Id view_id; bool visible; bool drawn; std::map<std::string, std::vector<uint8_t>> properties; @@ -59,11 +59,11 @@ struct Change { ~Change(); ChangeType type; - ConnectionSpecificId connection_id; + mojo::ConnectionSpecificId connection_id; std::vector<TestView> views; - Id view_id; - Id view_id2; - Id view_id3; + mojo::Id view_id; + mojo::Id view_id2; + mojo::Id view_id3; mojo::Rect bounds; mojo::Rect bounds2; int32_t event_action; @@ -117,29 +117,30 @@ class TestChangeTracker { // Each of these functions generate a Change. There is one per // ViewTreeClient function. - void OnEmbed(ConnectionSpecificId connection_id, mojo::ViewDataPtr root); - void OnEmbeddedAppDisconnected(Id view_id); + void OnEmbed(mojo::ConnectionSpecificId connection_id, + mojo::ViewDataPtr root); + void OnEmbeddedAppDisconnected(mojo::Id view_id); void OnUnembed(); - void OnViewBoundsChanged(Id view_id, + void OnViewBoundsChanged(mojo::Id view_id, mojo::RectPtr old_bounds, mojo::RectPtr new_bounds); void OnViewViewportMetricsChanged(mojo::ViewportMetricsPtr old_bounds, mojo::ViewportMetricsPtr new_bounds); - void OnViewHierarchyChanged(Id view_id, - Id new_parent_id, - Id old_parent_id, + void OnViewHierarchyChanged(mojo::Id view_id, + mojo::Id new_parent_id, + mojo::Id old_parent_id, mojo::Array<mojo::ViewDataPtr> views); - void OnViewReordered(Id view_id, - Id relative_view_id, + void OnViewReordered(mojo::Id view_id, + mojo::Id relative_view_id, mojo::OrderDirection direction); - void OnViewDeleted(Id view_id); - void OnViewVisibilityChanged(Id view_id, bool visible); - void OnViewDrawnStateChanged(Id view_id, bool drawn); - void OnViewInputEvent(Id view_id, mojo::EventPtr event); - void OnViewSharedPropertyChanged(Id view_id, + void OnViewDeleted(mojo::Id view_id); + void OnViewVisibilityChanged(mojo::Id view_id, bool visible); + void OnViewDrawnStateChanged(mojo::Id view_id, bool drawn); + void OnViewInputEvent(mojo::Id view_id, mojo::EventPtr event); + void OnViewSharedPropertyChanged(mojo::Id view_id, mojo::String name, mojo::Array<uint8_t> data); - void OnViewFocused(Id view_id); + void OnViewFocused(mojo::Id view_id); void DelegateEmbed(const mojo::String& url); private: @@ -151,6 +152,6 @@ class TestChangeTracker { DISALLOW_COPY_AND_ASSIGN(TestChangeTracker); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_TEST_CHANGE_TRACKER_H_ diff --git a/components/mus/test_server_view_delegate.cc b/components/mus/test_server_view_delegate.cc index 2e927c3..f27a109 100644 --- a/components/mus/test_server_view_delegate.cc +++ b/components/mus/test_server_view_delegate.cc @@ -5,7 +5,7 @@ #include "components/mus/test_server_view_delegate.h" #include "components/mus/server_view.h" -namespace mus { +namespace view_manager { TestServerViewDelegate::TestServerViewDelegate() : root_view_(nullptr) {} @@ -17,7 +17,7 @@ TestServerViewDelegate::UpdateViewTreeFromCompositorFrame( return scoped_ptr<cc::CompositorFrame>(); } -SurfacesState* TestServerViewDelegate::GetSurfacesState() { +surfaces::SurfacesState* TestServerViewDelegate::GetSurfacesState() { return nullptr; } @@ -28,4 +28,4 @@ const ServerView* TestServerViewDelegate::GetRootView( return root_view_; } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/test_server_view_delegate.h b/components/mus/test_server_view_delegate.h index 7509326..8dbb502 100644 --- a/components/mus/test_server_view_delegate.h +++ b/components/mus/test_server_view_delegate.h @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "components/mus/server_view_delegate.h" -namespace mus { +namespace view_manager { class TestServerViewDelegate : public ServerViewDelegate { public: @@ -21,7 +21,7 @@ class TestServerViewDelegate : public ServerViewDelegate { // ServerViewDelegate: scoped_ptr<cc::CompositorFrame> UpdateViewTreeFromCompositorFrame( const mojo::CompositorFramePtr& input) override; - SurfacesState* GetSurfacesState() override; + surfaces::SurfacesState* GetSurfacesState() override; void OnScheduleViewPaint(const ServerView* view) override; const ServerView* GetRootView(const ServerView* view) const override; @@ -30,6 +30,6 @@ class TestServerViewDelegate : public ServerViewDelegate { DISALLOW_COPY_AND_ASSIGN(TestServerViewDelegate); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_TEST_SERVER_VIEW_DELEGATE_H_ diff --git a/components/mus/view_coordinate_conversions.cc b/components/mus/view_coordinate_conversions.cc index 445d762..20d2060 100644 --- a/components/mus/view_coordinate_conversions.cc +++ b/components/mus/view_coordinate_conversions.cc @@ -12,7 +12,7 @@ #include "ui/gfx/geometry/vector2d.h" #include "ui/gfx/geometry/vector2d_f.h" -namespace mus { +namespace view_manager { namespace { @@ -66,4 +66,4 @@ gfx::Rect ConvertRectBetweenViews(const ServerView* from, bottom_right.y() - top_left.y()); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/view_coordinate_conversions.h b/components/mus/view_coordinate_conversions.h index 2e8b494..7696dc6 100644 --- a/components/mus/view_coordinate_conversions.h +++ b/components/mus/view_coordinate_conversions.h @@ -11,7 +11,7 @@ class PointF; class Rect; } -namespace mus { +namespace view_manager { class ServerView; @@ -30,6 +30,6 @@ gfx::Rect ConvertRectBetweenViews(const ServerView* from, const ServerView* to, const gfx::Rect& rect); -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_VIEW_COORDINATE_CONVERSIONS_H_ diff --git a/components/mus/view_coordinate_conversions_unittest.cc b/components/mus/view_coordinate_conversions_unittest.cc index 71a220f..db97838 100644 --- a/components/mus/view_coordinate_conversions_unittest.cc +++ b/components/mus/view_coordinate_conversions_unittest.cc @@ -11,7 +11,7 @@ #include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/rect.h" -namespace mus { +namespace view_manager { using ViewCoordinateConversionsTest = testing::Test; @@ -55,4 +55,4 @@ TEST_F(ViewCoordinateConversionsTest, ConvertPointFBetweenViews) { } } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/view_locator.cc b/components/mus/view_locator.cc index 40cda4e..0fb92d1 100644 --- a/components/mus/view_locator.cc +++ b/components/mus/view_locator.cc @@ -6,7 +6,7 @@ #include "components/mus/server_view.h" -namespace mus { +namespace view_manager { const ServerView* FindDeepestVisibleView(const ServerView* view, const gfx::Point& location) { @@ -32,4 +32,4 @@ ServerView* FindDeepestVisibleView(ServerView* view, FindDeepestVisibleView(const_cast<const ServerView*>(view), location)); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/view_locator.h b/components/mus/view_locator.h index 883c625..c974834 100644 --- a/components/mus/view_locator.h +++ b/components/mus/view_locator.h @@ -9,7 +9,7 @@ namespace gfx { class Point; } -namespace mus { +namespace view_manager { class ServerView; @@ -19,6 +19,6 @@ const ServerView* FindDeepestVisibleView(const ServerView* view, ServerView* FindDeepestVisibleView(ServerView* view, const gfx::Point& location); -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_VIEW_LOCATOR_H_ diff --git a/components/mus/mus_app.cc b/components/mus/view_manager_app.cc index e33fa18..d83894d 100644 --- a/components/mus/mus_app.cc +++ b/components/mus/view_manager_app.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/mus/mus_app.h" +#include "components/mus/view_manager_app.h" #include "base/command_line.h" #include "base/stl_util.h" @@ -35,29 +35,28 @@ using mojo::Gpu; using mojo::InterfaceRequest; using mojo::ViewTreeHostFactory; -namespace mus { +namespace view_manager { -MandolineUIServicesApp::MandolineUIServicesApp() - : app_impl_(nullptr), is_headless_(false) {} +ViewManagerApp::ViewManagerApp() : app_impl_(nullptr), is_headless_(false) {} -MandolineUIServicesApp::~MandolineUIServicesApp() { +ViewManagerApp::~ViewManagerApp() { if (gpu_state_) gpu_state_->StopControlThread(); // Destroy |connection_manager_| first, since it depends on |event_source_|. connection_manager_.reset(); } -void MandolineUIServicesApp::Initialize(ApplicationImpl* app) { +void ViewManagerApp::Initialize(ApplicationImpl* app) { app_impl_ = app; tracing_.Initialize(app); - surfaces_state_ = new SurfacesState; + surfaces_state_ = new surfaces::SurfacesState; #if !defined(OS_ANDROID) base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - is_headless_ = command_line->HasSwitch(kUseHeadlessConfig); + is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); if (!is_headless_) { #if defined(USE_X11) - if (command_line->HasSwitch(kUseX11TestConfig)) { + if (command_line->HasSwitch(mojo::kUseX11TestConfig)) { XInitThreads(); ui::test::SetUseOverrideRedirectWindowByDefault(true); } @@ -68,27 +67,27 @@ void MandolineUIServicesApp::Initialize(ApplicationImpl* app) { #endif if (!gpu_state_.get()) - gpu_state_ = new GpuState; + gpu_state_ = new gles2::GpuState; connection_manager_.reset(new ConnectionManager(this, surfaces_state_)); } -bool MandolineUIServicesApp::ConfigureIncomingConnection( +bool ViewManagerApp::ConfigureIncomingConnection( ApplicationConnection* connection) { - // MandolineUIServices + // ViewManager connection->AddService<ViewTreeHostFactory>(this); // GPU connection->AddService<Gpu>(this); return true; } -void MandolineUIServicesApp::OnNoMoreRootConnections() { +void ViewManagerApp::OnNoMoreRootConnections() { app_impl_->Quit(); } -ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( +ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, mojo::InterfaceRequest<mojo::ViewTree> tree_request, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, mojo::URLRequestPtr request, const ViewId& root_id, uint32_t policy_bitmask) { @@ -101,10 +100,10 @@ ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( tree_request.Pass(), client.Pass()); } -ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( +ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, mojo::InterfaceRequest<mojo::ViewTree> tree_request, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask, mojo::ViewTreeClientPtr client) { @@ -114,20 +113,19 @@ ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( tree_request.Pass(), client.Pass()); } -void MandolineUIServicesApp::Create( - ApplicationConnection* connection, - InterfaceRequest<ViewTreeHostFactory> request) { +void ViewManagerApp::Create(ApplicationConnection* connection, + InterfaceRequest<ViewTreeHostFactory> request) { factory_bindings_.AddBinding(this, request.Pass()); } -void MandolineUIServicesApp::Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<Gpu> request) { +void ViewManagerApp::Create(mojo::ApplicationConnection* connection, + mojo::InterfaceRequest<Gpu> request) { if (!gpu_state_.get()) - gpu_state_ = new GpuState; - new GpuImpl(request.Pass(), gpu_state_); + gpu_state_ = new gles2::GpuState; + new gles2::GpuImpl(request.Pass(), gpu_state_); } -void MandolineUIServicesApp::CreateViewTreeHost( +void ViewManagerApp::CreateViewTreeHost( mojo::InterfaceRequest<mojo::ViewTreeHost> host, mojo::ViewTreeHostClientPtr host_client, mojo::ViewTreeClientPtr tree_client) { @@ -145,4 +143,4 @@ void MandolineUIServicesApp::CreateViewTreeHost( connection_manager_.get())); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/mus_app.h b/components/mus/view_manager_app.h index db528e1..3f65f51 100644 --- a/components/mus/mus_app.h +++ b/components/mus/view_manager_app.h @@ -19,30 +19,35 @@ #include "mojo/common/tracing_impl.h" #include "mojo/common/weak_binding_set.h" +namespace gles2 { +class GpuState; +} + namespace mojo { class ApplicationImpl; } +namespace surfaces { +class SurfacesScheduler; +class SurfacesState; +} + namespace ui { class PlatformEventSource; } -namespace mus { +namespace view_manager { class ConnectionManager; -class GpuState; -class SurfacesScheduler; -class SurfacesState; -class MandolineUIServicesApp - : public mojo::ApplicationDelegate, - public ConnectionManagerDelegate, - public mojo::InterfaceFactory<mojo::ViewTreeHostFactory>, - public mojo::InterfaceFactory<mojo::Gpu>, - public mojo::ViewTreeHostFactory { +class ViewManagerApp : public mojo::ApplicationDelegate, + public ConnectionManagerDelegate, + public mojo::InterfaceFactory<mojo::ViewTreeHostFactory>, + public mojo::InterfaceFactory<mojo::Gpu>, + public mojo::ViewTreeHostFactory { public: - MandolineUIServicesApp(); - ~MandolineUIServicesApp() override; + ViewManagerApp(); + ~ViewManagerApp() override; private: // ApplicationDelegate: @@ -55,14 +60,14 @@ class MandolineUIServicesApp ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, mojo::InterfaceRequest<mojo::ViewTree> tree_request, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, mojo::URLRequestPtr request, const ViewId& root_id, uint32_t policy_bitmask) override; ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, mojo::InterfaceRequest<mojo::ViewTree> tree_request, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask, mojo::ViewTreeClientPtr client) override; @@ -85,16 +90,16 @@ class MandolineUIServicesApp mojo::ApplicationImpl* app_impl_; scoped_ptr<ConnectionManager> connection_manager_; mojo::TracingImpl tracing_; - scoped_refptr<GpuState> gpu_state_; + scoped_refptr<gles2::GpuState> gpu_state_; scoped_ptr<ui::PlatformEventSource> event_source_; bool is_headless_; // Surfaces - scoped_refptr<SurfacesState> surfaces_state_; + scoped_refptr<surfaces::SurfacesState> surfaces_state_; - DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp); + DISALLOW_COPY_AND_ASSIGN(ViewManagerApp); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_VIEW_MANAGER_APP_H_ diff --git a/components/mus/view_manager_client_apptest.cc b/components/mus/view_manager_client_apptest.cc index 1b38820..5adf265 100644 --- a/components/mus/view_manager_client_apptest.cc +++ b/components/mus/view_manager_client_apptest.cc @@ -15,7 +15,7 @@ #include "mojo/application/public/cpp/application_test_base.h" #include "ui/mojo/geometry/geometry_util.h" -namespace mus { +namespace mojo { namespace { @@ -29,8 +29,8 @@ class BoundsChangeObserver : public ViewObserver { private: // Overridden from ViewObserver: void OnViewBoundsChanged(View* view, - const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) override { + const Rect& old_bounds, + const Rect& new_bounds) override { DCHECK_EQ(view, view_); EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop()); } @@ -97,7 +97,7 @@ class OrderChangeObserver : public ViewObserver { // Overridden from ViewObserver: void OnViewReordered(View* view, View* relative_view, - mojo::OrderDirection direction) override { + OrderDirection direction) override { DCHECK_EQ(view, view_); EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop()); } @@ -188,7 +188,7 @@ class ViewManagerTest : public ViewManagerTestBase { mojo::ViewTreeClientPtr ConnectToApplicationAndGetViewManagerClient() { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From(application_impl()->url()); - scoped_ptr<mojo::ApplicationConnection> connection = + scoped_ptr<ApplicationConnection> connection = application_impl()->ConnectToApplication(request.Pass()); mojo::ViewTreeClientPtr client; connection->ConnectToService(&client); @@ -311,7 +311,7 @@ TEST_F(ViewManagerTest, SetBounds) { View* view_in_embedded = embedded->GetViewById(view->id()); EXPECT_EQ(view->bounds(), view_in_embedded->bounds()); - mojo::Rect rect; + Rect rect; rect.width = rect.height = 100; view->SetBounds(rect); ASSERT_TRUE(WaitForBoundsToChange(view_in_embedded)); @@ -328,7 +328,7 @@ TEST_F(ViewManagerTest, SetBoundsSecurity) { ASSERT_NE(nullptr, embedded); View* view_in_embedded = embedded->GetViewById(view->id()); - mojo::Rect rect; + Rect rect; rect.width = 800; rect.height = 600; view->SetBounds(rect); @@ -778,7 +778,7 @@ TEST_F(ViewManagerTest, EmbedRootSeesHierarchyChanged) { window_manager()->GetRoot()->AddChild(embed_view); ViewTreeConnection* vm2 = - Embed(embed_view, mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT).connection; + Embed(embed_view, ViewTree::ACCESS_POLICY_EMBED_ROOT).connection; View* vm2_v1 = vm2->CreateView(); vm2->GetRoot()->AddChild(vm2_v1); @@ -796,7 +796,7 @@ TEST_F(ViewManagerTest, EmbedFromEmbedRoot) { // Give the connection embedded at |embed_view| embed root powers. const EmbedResult result1 = - Embed(embed_view, mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT); + Embed(embed_view, ViewTree::ACCESS_POLICY_EMBED_ROOT); ViewTreeConnection* vm2 = result1.connection; EXPECT_EQ(result1.connection_id, vm2->GetConnectionId()); View* vm2_v1 = vm2->CreateView(); @@ -826,4 +826,4 @@ TEST_F(ViewManagerTest, EmbedFromEmbedRoot) { EXPECT_EQ(result4.connection_id, result4.connection->GetConnectionId()); } -} // namespace mus +} // namespace mojo diff --git a/components/mus/view_tree_apptest.cc b/components/mus/view_tree_apptest.cc index dfef44e..7c598bb 100644 --- a/components/mus/view_tree_apptest.cc +++ b/components/mus/view_tree_apptest.cc @@ -18,9 +18,11 @@ using mojo::ApplicationConnection; using mojo::ApplicationDelegate; using mojo::Array; using mojo::Callback; +using mojo::ConnectionSpecificId; using mojo::ERROR_CODE_NONE; using mojo::ErrorCode; using mojo::EventPtr; +using mojo::Id; using mojo::InterfaceRequest; using mojo::ORDER_DIRECTION_ABOVE; using mojo::ORDER_DIRECTION_BELOW; @@ -34,9 +36,7 @@ using mojo::ViewTree; using mojo::ViewTreeClient; using mojo::ViewportMetricsPtr; -namespace mus { - -namespace { +namespace view_manager { // Creates an id used for transport from the specified parameters. Id BuildViewId(ConnectionSpecificId connection_id, @@ -216,8 +216,9 @@ bool WaitForAllMessages(ViewTree* vm) { const Id kNullParentId = 0; std::string IdToString(Id id) { - return (id == kNullParentId) ? "null" : base::StringPrintf( - "%d,%d", HiWord(id), LoWord(id)); + return (id == kNullParentId) + ? "null" + : base::StringPrintf("%d,%d", mojo::HiWord(id), mojo::LoWord(id)); } std::string ViewParentToString(Id view, Id parent) { @@ -228,10 +229,10 @@ std::string ViewParentToString(Id view, Id parent) { // ----------------------------------------------------------------------------- // A ViewTreeClient implementation that logs all changes to a tracker. -class TestViewTreeClientImpl : public mojo::ViewTreeClient, - public TestChangeTracker::Delegate { +class ViewTreeClientImpl : public mojo::ViewTreeClient, + public TestChangeTracker::Delegate { public: - explicit TestViewTreeClientImpl(mojo::ApplicationImpl* app) + explicit ViewTreeClientImpl(mojo::ApplicationImpl* app) : binding_(this), app_(app), connection_id_(0), root_view_id_(0) { tracker_.set_delegate(this); } @@ -303,7 +304,7 @@ class TestViewTreeClientImpl : public mojo::ViewTreeClient, void OnEmbed(ConnectionSpecificId connection_id, ViewDataPtr root, mojo::ViewTreePtr tree, - Id focused_view_id, + mojo::Id focused_view_id, uint32_t access_policy) override { // TODO(sky): add coverage of |focused_view_id|. tree_ = tree.Pass(); @@ -381,19 +382,19 @@ class TestViewTreeClientImpl : public mojo::ViewTreeClient, Id connection_id_; Id root_view_id_; - DISALLOW_COPY_AND_ASSIGN(TestViewTreeClientImpl); + DISALLOW_COPY_AND_ASSIGN(ViewTreeClientImpl); }; // ----------------------------------------------------------------------------- -// InterfaceFactory for vending TestViewTreeClientImpls. +// InterfaceFactory for vending ViewTreeClientImpls. class ViewTreeClientFactory : public mojo::InterfaceFactory<ViewTreeClient> { public: explicit ViewTreeClientFactory(mojo::ApplicationImpl* app) : app_(app) {} ~ViewTreeClientFactory() override {} // Runs a nested MessageLoop until a new instance has been created. - scoped_ptr<TestViewTreeClientImpl> WaitForInstance() { + scoped_ptr<ViewTreeClientImpl> WaitForInstance() { if (!client_impl_.get()) { DCHECK(!run_loop_.get()); run_loop_.reset(new base::RunLoop); @@ -407,21 +408,19 @@ class ViewTreeClientFactory : public mojo::InterfaceFactory<ViewTreeClient> { // InterfaceFactory<ViewTreeClient>: void Create(ApplicationConnection* connection, InterfaceRequest<ViewTreeClient> request) override { - client_impl_.reset(new TestViewTreeClientImpl(app_)); + client_impl_.reset(new ViewTreeClientImpl(app_)); client_impl_->Bind(request.Pass()); if (run_loop_.get()) run_loop_->Quit(); } mojo::ApplicationImpl* app_; - scoped_ptr<TestViewTreeClientImpl> client_impl_; + scoped_ptr<ViewTreeClientImpl> client_impl_; scoped_ptr<base::RunLoop> run_loop_; DISALLOW_COPY_AND_ASSIGN(ViewTreeClientFactory); }; -} // namespace - class ViewTreeAppTest : public mojo::test::ApplicationTestBase, public ApplicationDelegate { public: @@ -441,9 +440,9 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, ViewTree* vm2() { return vm_client2_->tree(); } ViewTree* vm3() { return vm_client3_->tree(); } - TestViewTreeClientImpl* vm_client1() { return vm_client1_.get(); } - TestViewTreeClientImpl* vm_client2() { return vm_client2_.get(); } - TestViewTreeClientImpl* vm_client3() { return vm_client3_.get(); } + ViewTreeClientImpl* vm_client1() { return vm_client1_.get(); } + ViewTreeClientImpl* vm_client2() { return vm_client2_.get(); } + ViewTreeClientImpl* vm_client3() { return vm_client3_.get(); } Id root_view_id() const { return root_view_id_; } @@ -481,30 +480,29 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, vm_client3_->set_root_view(root_view_id_); } - scoped_ptr<TestViewTreeClientImpl> WaitForViewTreeClient() { + scoped_ptr<ViewTreeClientImpl> WaitForViewTreeClient() { return client_factory_->WaitForInstance(); } // Establishes a new connection by way of Embed() on the specified // ViewTree. - scoped_ptr<TestViewTreeClientImpl> + scoped_ptr<ViewTreeClientImpl> EstablishConnectionViaEmbed(ViewTree* owner, Id root_id, int* connection_id) { return EstablishConnectionViaEmbedWithPolicyBitmask( owner, root_id, mojo::ViewTree::ACCESS_POLICY_DEFAULT, connection_id); } - scoped_ptr<TestViewTreeClientImpl> - EstablishConnectionViaEmbedWithPolicyBitmask(ViewTree* owner, - Id root_id, - uint32_t policy_bitmask, - int* connection_id) { + scoped_ptr<ViewTreeClientImpl> EstablishConnectionViaEmbedWithPolicyBitmask( + ViewTree* owner, + Id root_id, + uint32_t policy_bitmask, + int* connection_id) { if (!EmbedUrl(application_impl(), owner, application_impl()->url(), root_id)) { ADD_FAILURE() << "Embed() failed"; return nullptr; } - scoped_ptr<TestViewTreeClientImpl> client = - client_factory_->WaitForInstance(); + scoped_ptr<ViewTreeClientImpl> client = client_factory_->WaitForInstance(); if (!client.get()) { ADD_FAILURE() << "WaitForInstance failed"; return nullptr; @@ -530,7 +528,7 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, application_impl()->ConnectToService(request.Pass(), &factory); mojo::ViewTreeClientPtr tree_client_ptr; - vm_client1_.reset(new TestViewTreeClientImpl(application_impl())); + vm_client1_.reset(new ViewTreeClientImpl(application_impl())); vm_client1_->Bind(GetProxy(&tree_client_ptr)); factory->CreateViewTreeHost(GetProxy(&host_), mojo::ViewTreeHostClientPtr(), @@ -558,9 +556,9 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, return true; } - scoped_ptr<TestViewTreeClientImpl> vm_client1_; - scoped_ptr<TestViewTreeClientImpl> vm_client2_; - scoped_ptr<TestViewTreeClientImpl> vm_client3_; + scoped_ptr<ViewTreeClientImpl> vm_client1_; + scoped_ptr<ViewTreeClientImpl> vm_client2_; + scoped_ptr<ViewTreeClientImpl> vm_client3_; mojo::ViewTreeHostPtr host_; @@ -1267,7 +1265,7 @@ TEST_F(ViewTreeAppTest, EmbedWithSameViewId2) { changes3()->clear(); // We should get a new connection for the new embedding. - scoped_ptr<TestViewTreeClientImpl> connection4( + scoped_ptr<ViewTreeClientImpl> connection4( EstablishConnectionViaEmbed(vm1(), view_1_1, nullptr)); ASSERT_TRUE(connection4.get()); EXPECT_EQ("[" + ViewParentToString(view_1_1, kNullParentId) + "]", @@ -1588,7 +1586,7 @@ TEST_F(ViewTreeAppTest, DontCleanMapOnDestroy) { TEST_F(ViewTreeAppTest, EmbedSupplyingViewTreeClient) { ASSERT_TRUE(vm_client1()->CreateView(1)); - TestViewTreeClientImpl client2(application_impl()); + ViewTreeClientImpl client2(application_impl()); mojo::ViewTreeClientPtr client2_ptr; mojo::Binding<ViewTreeClient> client2_binding(&client2, &client2_ptr); ASSERT_TRUE( @@ -1676,4 +1674,4 @@ TEST_F(ViewTreeAppTest, CantEmbedFromConnectionRoot) { // ViewManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window manager // tests. -} // namespace mus +} // namespace view_manager diff --git a/components/mus/view_tree_host_connection.cc b/components/mus/view_tree_host_connection.cc index 3991b03..98a5877 100644 --- a/components/mus/view_tree_host_connection.cc +++ b/components/mus/view_tree_host_connection.cc @@ -7,7 +7,7 @@ #include "components/mus/connection_manager.h" #include "components/mus/view_tree_host_impl.h" -namespace mus { +namespace view_manager { ViewTreeHostConnection::ViewTreeHostConnection( scoped_ptr<ViewTreeHostImpl> host_impl, @@ -64,4 +64,4 @@ void ViewTreeHostConnectionImpl::OnDisplayInitialized() { mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT, client_.Pass())); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/view_tree_host_connection.h b/components/mus/view_tree_host_connection.h index 24ae6d1..44ea157 100644 --- a/components/mus/view_tree_host_connection.h +++ b/components/mus/view_tree_host_connection.h @@ -11,7 +11,7 @@ #include "components/mus/view_tree_host_impl.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" -namespace mus { +namespace view_manager { class ConnectionManager; class ViewTreeImpl; @@ -77,6 +77,6 @@ class ViewTreeHostConnectionImpl : public ViewTreeHostConnection { DISALLOW_COPY_AND_ASSIGN(ViewTreeHostConnectionImpl); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_VIEW_TREE_HOST_CONNECTION_H_ diff --git a/components/mus/view_tree_host_delegate.h b/components/mus/view_tree_host_delegate.h index 5012499..eca65a3 100644 --- a/components/mus/view_tree_host_delegate.h +++ b/components/mus/view_tree_host_delegate.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_MUS_VIEW_TREE_HOST_DELEGATE_H_ #define COMPONENTS_MUS_VIEW_TREE_HOST_DELEGATE_H_ -namespace mus { +namespace view_manager { class ViewTreeImpl; @@ -30,6 +30,6 @@ class ViewTreeHostDelegate { virtual ~ViewTreeHostDelegate() {} }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_VIEW_TREE_HOST_DELEGATE_H_ diff --git a/components/mus/view_tree_host_impl.cc b/components/mus/view_tree_host_impl.cc index 7f04d19..775c5f9 100644 --- a/components/mus/view_tree_host_impl.cc +++ b/components/mus/view_tree_host_impl.cc @@ -14,15 +14,15 @@ #include "mojo/common/common_type_converters.h" #include "mojo/converters/geometry/geometry_type_converters.h" -namespace mus { +namespace view_manager { ViewTreeHostImpl::ViewTreeHostImpl( mojo::ViewTreeHostClientPtr client, ConnectionManager* connection_manager, bool is_headless, mojo::ApplicationImpl* app_impl, - const scoped_refptr<GpuState>& gpu_state, - const scoped_refptr<SurfacesState>& surfaces_state) + const scoped_refptr<gles2::GpuState>& gpu_state, + const scoped_refptr<surfaces::SurfacesState>& surfaces_state) : delegate_(nullptr), connection_manager_(connection_manager), client_(client.Pass()), @@ -238,4 +238,4 @@ void ViewTreeHostImpl::OnFocusChanged(ServerView* old_focused_view, UpdateTextInputState(new_focused_view, new_focused_view->text_input_state()); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/view_tree_host_impl.h b/components/mus/view_tree_host_impl.h index 3aaeb80..2ce45c8 100644 --- a/components/mus/view_tree_host_impl.h +++ b/components/mus/view_tree_host_impl.h @@ -17,11 +17,11 @@ namespace cc { class SurfaceManager; } -namespace mus { +namespace surfaces { class SurfacesScheduler; } -namespace mus { +namespace view_manager { class ConnectionManager; class FocusController; @@ -40,12 +40,13 @@ class ViewTreeHostImpl : public DisplayManagerDelegate, // TODO(fsamuel): All these parameters are just plumbing for creating // DisplayManagers. We should probably just store these common parameters // in the DisplayManagerFactory and pass them along on DisplayManager::Create. - ViewTreeHostImpl(mojo::ViewTreeHostClientPtr client, - ConnectionManager* connection_manager, - bool is_headless, - mojo::ApplicationImpl* app_impl, - const scoped_refptr<GpuState>& gpu_state, - const scoped_refptr<SurfacesState>& surfaces_state); + ViewTreeHostImpl( + mojo::ViewTreeHostClientPtr client, + ConnectionManager* connection_manager, + bool is_headless, + mojo::ApplicationImpl* app_impl, + const scoped_refptr<gles2::GpuState>& gpu_state, + const scoped_refptr<surfaces::SurfacesState>& surfaces_state); ~ViewTreeHostImpl() override; // Initializes state that depends on the existence of a ViewTreeHostImpl. @@ -117,6 +118,6 @@ class ViewTreeHostImpl : public DisplayManagerDelegate, DISALLOW_COPY_AND_ASSIGN(ViewTreeHostImpl); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_VIEW_TREE_HOST_IMPL_H_ diff --git a/components/mus/view_tree_impl.cc b/components/mus/view_tree_impl.cc index b97583e1..bcc0364 100644 --- a/components/mus/view_tree_impl.cc +++ b/components/mus/view_tree_impl.cc @@ -20,6 +20,7 @@ using mojo::Array; using mojo::Callback; +using mojo::Id; using mojo::InterfaceRequest; using mojo::OrderDirection; using mojo::Rect; @@ -28,10 +29,10 @@ using mojo::ServiceProviderPtr; using mojo::String; using mojo::ViewDataPtr; -namespace mus { +namespace view_manager { ViewTreeImpl::ViewTreeImpl(ConnectionManager* connection_manager, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask) : connection_manager_(connection_manager), @@ -67,7 +68,7 @@ void ViewTreeImpl::Init(mojo::ViewTreeClient* client, mojo::ViewTreePtr tree) { const ServerView* focused_view = host ? host->GetFocusedView() : nullptr; if (focused_view) focused_view = access_policy_->GetViewForFocusChange(focused_view); - const Id focused_view_transport_id( + const mojo::Id focused_view_transport_id( ViewIdToTransportId(focused_view ? focused_view->id() : ViewId())); client->OnEmbed(id_, ViewToViewData(to_send.front()), tree.Pass(), @@ -155,7 +156,7 @@ bool ViewTreeImpl::SetViewVisibility(const ViewId& view_id, bool visible) { bool ViewTreeImpl::Embed(const ViewId& view_id, mojo::ViewTreeClientPtr client, uint32_t policy_bitmask, - ConnectionSpecificId* connection_id) { + mojo::ConnectionSpecificId* connection_id) { *connection_id = kInvalidConnectionId; if (!client.get() || !CanEmbed(view_id, policy_bitmask)) return false; @@ -605,7 +606,7 @@ void ViewTreeImpl::SetViewProperty(uint32_t view_id, callback.Run(success); } -void ViewTreeImpl::RequestSurface(Id view_id, +void ViewTreeImpl::RequestSurface(mojo::Id view_id, mojo::InterfaceRequest<mojo::Surface> surface, mojo::SurfaceClientPtr client) { ServerView* view = GetView(ViewIdFromTransportId(view_id)); @@ -638,11 +639,11 @@ void ViewTreeImpl::SetImeVisibility(Id transport_view_id, } } -void ViewTreeImpl::Embed(Id transport_view_id, +void ViewTreeImpl::Embed(mojo::Id transport_view_id, mojo::ViewTreeClientPtr client, uint32_t policy_bitmask, const EmbedCallback& callback) { - ConnectionSpecificId connection_id = kInvalidConnectionId; + mojo::ConnectionSpecificId connection_id = kInvalidConnectionId; const bool result = Embed(ViewIdFromTransportId(transport_view_id), client.Pass(), policy_bitmask, &connection_id); callback.Run(result, connection_id); @@ -679,4 +680,4 @@ bool ViewTreeImpl::IsDescendantOfEmbedRoot(const ServerView* view) { return is_embed_root_ && root_ && GetView(*root_)->Contains(view); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/view_tree_impl.h b/components/mus/view_tree_impl.h index 8549585..2c6f060 100644 --- a/components/mus/view_tree_impl.h +++ b/components/mus/view_tree_impl.h @@ -22,7 +22,7 @@ namespace gfx { class Rect; } -namespace mus { +namespace view_manager { class AccessPolicy; class ConnectionManager; @@ -36,7 +36,7 @@ class ViewTreeHostImpl; class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { public: ViewTreeImpl(ConnectionManager* connection_manager, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask); ~ViewTreeImpl() override; @@ -45,8 +45,8 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { // client via OnEmbed(). void Init(mojo::ViewTreeClient* client, mojo::ViewTreePtr tree); - ConnectionSpecificId id() const { return id_; } - ConnectionSpecificId creator_id() const { return creator_id_; } + mojo::ConnectionSpecificId id() const { return id_; } + mojo::ConnectionSpecificId creator_id() const { return creator_id_; } mojo::ViewTreeClient* client() { return client_; } @@ -80,7 +80,7 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { bool Embed(const ViewId& view_id, mojo::ViewTreeClientPtr client, uint32_t policy_bitmask, - ConnectionSpecificId* connection_id); + mojo::ConnectionSpecificId* connection_id); void Embed(const ViewId& view_id, mojo::URLRequestPtr request); // The following methods are invoked after the corresponding change has been @@ -116,8 +116,8 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { const ServerView* new_focused_view); private: - using ViewIdSet = base::hash_set<Id>; - using ViewMap = std::map<ConnectionSpecificId, ServerView*>; + using ViewIdSet = base::hash_set<mojo::Id>; + using ViewMap = std::map<mojo::ConnectionSpecificId, ServerView*>; bool IsViewKnown(const ServerView* view) const; @@ -170,44 +170,44 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { // ViewTree: void CreateView( - Id transport_view_id, + mojo::Id transport_view_id, const mojo::Callback<void(mojo::ErrorCode)>& callback) override; - void DeleteView(Id transport_view_id, + void DeleteView(mojo::Id transport_view_id, const mojo::Callback<void(bool)>& callback) override; - void AddView(Id parent_id, - Id child_id, + void AddView(mojo::Id parent_id, + mojo::Id child_id, const mojo::Callback<void(bool)>& callback) override; void RemoveViewFromParent( - Id view_id, + mojo::Id view_id, const mojo::Callback<void(bool)>& callback) override; - void ReorderView(Id view_id, - Id relative_view_id, + void ReorderView(mojo::Id view_id, + mojo::Id relative_view_id, mojo::OrderDirection direction, const mojo::Callback<void(bool)>& callback) override; - void GetViewTree(Id view_id, + void GetViewTree(mojo::Id view_id, const mojo::Callback<void(mojo::Array<mojo::ViewDataPtr>)>& callback) override; - void SetViewBounds(Id view_id, + void SetViewBounds(mojo::Id view_id, mojo::RectPtr bounds, const mojo::Callback<void(bool)>& callback) override; - void SetViewVisibility(Id view_id, + void SetViewVisibility(mojo::Id view_id, bool visible, const mojo::Callback<void(bool)>& callback) override; - void SetViewProperty(Id view_id, + void SetViewProperty(mojo::Id view_id, const mojo::String& name, mojo::Array<uint8_t> value, const mojo::Callback<void(bool)>& callback) override; - void RequestSurface(Id view_id, + void RequestSurface(mojo::Id view_id, mojo::InterfaceRequest<mojo::Surface> surface, mojo::SurfaceClientPtr client) override; - void Embed(Id transport_view_id, + void Embed(mojo::Id transport_view_id, mojo::ViewTreeClientPtr client, uint32_t policy_bitmask, const EmbedCallback& callback) override; void SetFocus(uint32_t view_id) override; void SetViewTextInputState(uint32_t view_id, mojo::TextInputStatePtr state) override; - void SetImeVisibility(Id transport_view_id, + void SetImeVisibility(mojo::Id transport_view_id, bool visible, mojo::TextInputStatePtr state) override; @@ -221,15 +221,15 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { ConnectionManager* connection_manager_; // Id of this connection as assigned by ConnectionManager. - const ConnectionSpecificId id_; + const mojo::ConnectionSpecificId id_; // ID of the connection that created us. If 0 it indicates either we were // created by the root, or the connection that created us has been destroyed. - ConnectionSpecificId creator_id_; + mojo::ConnectionSpecificId creator_id_; mojo::ViewTreeClient* client_; - scoped_ptr<mus::AccessPolicy> access_policy_; + scoped_ptr<view_manager::AccessPolicy> access_policy_; // The views created by this connection. This connection owns these objects. ViewMap view_map_; @@ -247,6 +247,6 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { DISALLOW_COPY_AND_ASSIGN(ViewTreeImpl); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_VIEW_TREE_IMPL_H_ diff --git a/components/mus/view_tree_unittest.cc b/components/mus/view_tree_unittest.cc index 7138037..6b3e685 100644 --- a/components/mus/view_tree_unittest.cc +++ b/components/mus/view_tree_unittest.cc @@ -33,7 +33,7 @@ using mojo::ServiceProviderPtr; using mojo::String; using mojo::ViewDataPtr; -namespace mus { +namespace view_manager { namespace { // ----------------------------------------------------------------------------- @@ -52,7 +52,7 @@ class TestViewTreeClient : public mojo::ViewTreeClient { void OnEmbed(uint16_t connection_id, ViewDataPtr root, mojo::ViewTreePtr tree, - Id focused_view_id, + mojo::Id focused_view_id, uint32_t access_policy) override { // TODO(sky): add test coverage of |focused_view_id|. tracker_.OnEmbed(connection_id, root.Pass()); @@ -148,7 +148,7 @@ class TestConnectionManagerDelegate : public ConnectionManagerDelegate { ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, mojo::InterfaceRequest<mojo::ViewTree> service_request, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, mojo::URLRequestPtr request, const ViewId& root_id, uint32_t policy_bitmask) override { @@ -160,7 +160,7 @@ class TestConnectionManagerDelegate : public ConnectionManagerDelegate { ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, mojo::InterfaceRequest<mojo::ViewTree> service_request, - ConnectionSpecificId creator_id, + mojo::ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask, mojo::ViewTreeClientPtr client) override { @@ -237,8 +237,8 @@ class TestDisplayManagerFactory : public DisplayManagerFactory { DisplayManager* CreateDisplayManager( bool is_headless, mojo::ApplicationImpl* app_impl, - const scoped_refptr<GpuState>& gpu_state, - const scoped_refptr<SurfacesState>& surfaces_state) override { + const scoped_refptr<gles2::GpuState>& gpu_state, + const scoped_refptr<surfaces::SurfacesState>& surfaces_state) override { return new TestDisplayManager(); } @@ -302,12 +302,12 @@ class ViewTreeTest : public testing::Test { void SetUp() override { DisplayManager::set_factory_for_testing(&display_manager_factory_); // TODO(fsamuel): This is probably broken. We need a root. - connection_manager_.reset( - new ConnectionManager(&delegate_, scoped_refptr<SurfacesState>())); + connection_manager_.reset(new ConnectionManager( + &delegate_, scoped_refptr<surfaces::SurfacesState>())); ViewTreeHostImpl* host = new ViewTreeHostImpl( mojo::ViewTreeHostClientPtr(), connection_manager_.get(), - true /* is_headless */, nullptr, scoped_refptr<GpuState>(), - scoped_refptr<SurfacesState>()); + true /* is_headless */, nullptr, scoped_refptr<gles2::GpuState>(), + scoped_refptr<surfaces::SurfacesState>()); // TODO(fsamuel): This is way too magical. We need to find a better way to // manage lifetime. host_connection_ = new TestViewTreeHostConnection( @@ -447,4 +447,4 @@ TEST_F(ViewTreeTest, BasicInputEventTarget) { ChangesToDescription1(*embed_connection->tracker()->changes())[1]); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/window_manager_access_policy.cc b/components/mus/window_manager_access_policy.cc index 7e9e5b0..ae21dd8 100644 --- a/components/mus/window_manager_access_policy.cc +++ b/components/mus/window_manager_access_policy.cc @@ -7,13 +7,13 @@ #include "components/mus/access_policy_delegate.h" #include "components/mus/server_view.h" -namespace mus { +namespace view_manager { // TODO(sky): document why this differs from default for each case. Maybe want // to subclass DefaultAccessPolicy. WindowManagerAccessPolicy::WindowManagerAccessPolicy( - ConnectionSpecificId connection_id, + mojo::ConnectionSpecificId connection_id, AccessPolicyDelegate* delegate) : connection_id_(connection_id), delegate_(delegate) {} @@ -106,4 +106,4 @@ bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const { return delegate_->IsViewKnownForAccessPolicy(view); } -} // namespace mus +} // namespace view_manager diff --git a/components/mus/window_manager_access_policy.h b/components/mus/window_manager_access_policy.h index 885ad7a..ffaac41 100644 --- a/components/mus/window_manager_access_policy.h +++ b/components/mus/window_manager_access_policy.h @@ -8,13 +8,13 @@ #include "base/basictypes.h" #include "components/mus/access_policy.h" -namespace mus { +namespace view_manager { class AccessPolicyDelegate; class WindowManagerAccessPolicy : public AccessPolicy { public: - WindowManagerAccessPolicy(ConnectionSpecificId connection_id, + WindowManagerAccessPolicy(mojo::ConnectionSpecificId connection_id, AccessPolicyDelegate* delegate); ~WindowManagerAccessPolicy() override; @@ -44,12 +44,12 @@ class WindowManagerAccessPolicy : public AccessPolicy { private: bool IsViewKnown(const ServerView* view) const; - const ConnectionSpecificId connection_id_; + const mojo::ConnectionSpecificId connection_id_; AccessPolicyDelegate* delegate_; DISALLOW_COPY_AND_ASSIGN(WindowManagerAccessPolicy); }; -} // namespace mus +} // namespace view_manager #endif // COMPONENTS_MUS_WINDOW_MANAGER_ACCESS_POLICY_H_ |