From 35b19f7d5d7b7b68878d6c766e93e148f8b06998 Mon Sep 17 00:00:00 2001 From: thakis Date: Wed, 16 Sep 2015 19:48:48 -0700 Subject: Revert of Mandoline UI Process: Update namespaces and file names (patchset #9 id:150001 of https://codereview.chromium.org/1340983002/ ) Reason for revert: Speculative, might've broken mojo_apptests on http://build.chromium.org/p/chromium.linux/builders/Linux%20GN/builds/32066 Original issue's description: > Mandoline UI Process: Update namespaces and file names > > This CL updates namespaces in components/mus to mus from mojo, surfaces, gles2, and view_manager. > > BUG=531533 > TBR=jam@chromium.org for trivial pdf_viewer change. > > Committed: https://crrev.com/49b0d73f3ebb4801fc518751145504af3a2f70ed > Cr-Commit-Position: refs/heads/master@{#349229} TBR=sky@chromium.org,fsamuel@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=531533 Review URL: https://codereview.chromium.org/1351013002 Cr-Commit-Position: refs/heads/master@{#349332} --- components/html_viewer/ax_provider_apptest.cc | 4 +- components/html_viewer/document_resource_waiter.cc | 6 +- components/html_viewer/document_resource_waiter.h | 12 +- components/html_viewer/global_state.h | 4 +- components/html_viewer/html_document.cc | 22 +-- components/html_viewer/html_document.h | 12 +- components/html_viewer/html_frame.cc | 16 +-- components/html_viewer/html_frame.h | 35 +++-- components/html_viewer/html_frame_apptest.cc | 10 +- components/html_viewer/html_frame_tree_manager.cc | 6 +- components/html_viewer/html_frame_tree_manager.h | 10 +- components/html_viewer/html_widget.cc | 14 +- components/html_viewer/html_widget.h | 19 ++- components/html_viewer/ime_controller.cc | 5 +- components/html_viewer/ime_controller.h | 8 +- components/html_viewer/web_layer_impl.cc | 13 +- components/html_viewer/web_layer_impl.h | 6 +- components/html_viewer/web_layer_tree_view_impl.cc | 2 +- components/html_viewer/web_layer_tree_view_impl.h | 4 +- components/mus/BUILD.gn | 4 +- components/mus/access_policy.h | 6 +- components/mus/access_policy_delegate.h | 4 +- components/mus/android_loader.cc | 8 +- components/mus/android_loader.h | 4 +- components/mus/client_connection.cc | 4 +- components/mus/client_connection.h | 4 +- components/mus/connection_manager.cc | 21 +-- components/mus/connection_manager.h | 41 +++--- components/mus/connection_manager_delegate.h | 13 +- components/mus/default_access_policy.cc | 9 +- components/mus/default_access_policy.h | 8 +- components/mus/display_manager.cc | 16 +-- components/mus/display_manager.h | 30 +++-- components/mus/display_manager_delegate.h | 4 +- components/mus/display_manager_factory.h | 12 +- components/mus/event_dispatcher.cc | 4 +- components/mus/event_dispatcher.h | 4 +- components/mus/focus_controller.cc | 4 +- components/mus/focus_controller.h | 4 +- components/mus/focus_controller_delegate.h | 4 +- components/mus/focus_controller_unittest.cc | 4 +- components/mus/gesture_manager.cc | 6 +- components/mus/gesture_manager.h | 4 +- components/mus/gesture_manager_delegate.h | 4 +- components/mus/gesture_manager_unittest.cc | 6 +- components/mus/gles2/command_buffer_driver.cc | 8 +- components/mus/gles2/command_buffer_driver.h | 4 +- components/mus/gles2/command_buffer_impl.cc | 7 +- components/mus/gles2/command_buffer_impl.h | 5 +- .../mus/gles2/command_buffer_impl_observer.h | 4 +- components/mus/gles2/command_buffer_local.cc | 26 ++-- components/mus/gles2/command_buffer_local.h | 9 +- components/mus/gles2/command_buffer_local_client.h | 4 +- .../mus/gles2/command_buffer_type_conversions.cc | 2 +- .../mus/gles2/command_buffer_type_conversions.h | 2 +- components/mus/gles2/gpu_impl.cc | 4 +- components/mus/gles2/gpu_impl.h | 4 +- components/mus/gles2/gpu_memory_tracker.cc | 4 +- components/mus/gles2/gpu_memory_tracker.h | 6 +- components/mus/gles2/gpu_state.cc | 4 +- components/mus/gles2/gpu_state.h | 4 +- components/mus/gles2/mojo_buffer_backing.cc | 4 +- components/mus/gles2/mojo_buffer_backing.h | 4 +- components/mus/gles2/mojo_gpu_memory_buffer.cc | 4 +- components/mus/gles2/mojo_gpu_memory_buffer.h | 4 +- .../mus/gles2/mojo_gpu_memory_buffer_manager.cc | 4 +- .../mus/gles2/mojo_gpu_memory_buffer_manager.h | 4 +- components/mus/ids.h | 19 +-- components/mus/main.cc | 8 +- components/mus/mus_app.cc | 148 --------------------- components/mus/mus_app.h | 100 -------------- components/mus/public/cpp/args.h | 4 +- components/mus/public/cpp/keys.cc | 4 +- components/mus/public/cpp/keys.h | 4 +- components/mus/public/cpp/lib/args.cc | 4 +- components/mus/public/cpp/lib/scoped_view_ptr.cc | 4 +- components/mus/public/cpp/lib/view.cc | 68 +++++----- components/mus/public/cpp/lib/view_observer.cc | 4 +- components/mus/public/cpp/lib/view_private.cc | 4 +- components/mus/public/cpp/lib/view_private.h | 13 +- components/mus/public/cpp/lib/view_surface.cc | 4 +- .../mus/public/cpp/lib/view_tree_client_impl.cc | 78 ++++++----- .../mus/public/cpp/lib/view_tree_client_impl.h | 62 ++++----- .../mus/public/cpp/lib/view_tree_delegate.cc | 4 +- .../mus/public/cpp/lib/view_tree_host_factory.cc | 16 +-- components/mus/public/cpp/scoped_view_ptr.h | 4 +- .../mus/public/cpp/tests/run_all_unittests.cc | 4 +- .../mus/public/cpp/tests/view_manager_test_base.cc | 15 +-- .../mus/public/cpp/tests/view_manager_test_base.h | 24 ++-- .../public/cpp/tests/view_manager_test_suite.cc | 4 +- .../mus/public/cpp/tests/view_manager_test_suite.h | 4 +- components/mus/public/cpp/tests/view_unittest.cc | 42 +++--- components/mus/public/cpp/types.h | 4 +- components/mus/public/cpp/util.h | 4 +- components/mus/public/cpp/view.h | 35 +++-- components/mus/public/cpp/view_observer.h | 22 +-- components/mus/public/cpp/view_property.h | 46 +++---- components/mus/public/cpp/view_surface.h | 10 +- components/mus/public/cpp/view_surface_client.h | 4 +- components/mus/public/cpp/view_tracker.cc | 4 +- components/mus/public/cpp/view_tracker.h | 4 +- components/mus/public/cpp/view_tree_connection.h | 10 +- components/mus/public/cpp/view_tree_delegate.h | 4 +- components/mus/public/cpp/view_tree_host_factory.h | 17 +-- components/mus/public/interfaces/BUILD.gn | 2 +- .../mus/public/interfaces/mus_constants.mojom | 10 -- .../public/interfaces/view_manager_constants.mojom | 10 ++ components/mus/public/interfaces/view_tree.mojom | 2 +- components/mus/server_view.cc | 4 +- components/mus/server_view.h | 4 +- components/mus/server_view_delegate.h | 13 +- components/mus/server_view_drawn_tracker.cc | 4 +- components/mus/server_view_drawn_tracker.h | 4 +- .../mus/server_view_drawn_tracker_observer.h | 4 +- .../mus/server_view_drawn_tracker_unittest.cc | 4 +- components/mus/server_view_observer.h | 8 +- .../mus/surfaces/surfaces_context_provider.cc | 9 +- .../mus/surfaces/surfaces_context_provider.h | 15 ++- .../surfaces/surfaces_context_provider_delegate.h | 4 +- components/mus/surfaces/surfaces_output_surface.cc | 4 +- components/mus/surfaces/surfaces_output_surface.h | 4 +- components/mus/surfaces/surfaces_scheduler.cc | 4 +- components/mus/surfaces/surfaces_scheduler.h | 4 +- components/mus/surfaces/surfaces_state.cc | 4 +- components/mus/surfaces/surfaces_state.h | 4 +- .../mus/surfaces/top_level_display_client.cc | 8 +- components/mus/surfaces/top_level_display_client.h | 13 +- components/mus/test_change_tracker.cc | 13 +- components/mus/test_change_tracker.h | 45 ++++--- components/mus/test_server_view_delegate.cc | 6 +- components/mus/test_server_view_delegate.h | 6 +- components/mus/view_coordinate_conversions.cc | 4 +- components/mus/view_coordinate_conversions.h | 4 +- .../mus/view_coordinate_conversions_unittest.cc | 4 +- components/mus/view_locator.cc | 4 +- components/mus/view_locator.h | 4 +- components/mus/view_manager_app.cc | 146 ++++++++++++++++++++ components/mus/view_manager_app.h | 105 +++++++++++++++ components/mus/view_manager_client_apptest.cc | 20 +-- components/mus/view_tree_apptest.cc | 68 +++++----- components/mus/view_tree_host_connection.cc | 4 +- components/mus/view_tree_host_connection.h | 4 +- components/mus/view_tree_host_delegate.h | 4 +- components/mus/view_tree_host_impl.cc | 8 +- components/mus/view_tree_host_impl.h | 19 +-- components/mus/view_tree_impl.cc | 17 +-- components/mus/view_tree_impl.h | 50 +++---- components/mus/view_tree_unittest.cc | 22 +-- components/mus/window_manager_access_policy.cc | 6 +- components/mus/window_manager_access_policy.h | 8 +- components/pdf_viewer/pdf_viewer.cc | 30 +++-- components/web_view/frame.cc | 12 +- components/web_view/frame.h | 24 ++-- components/web_view/frame_apptest.cc | 22 +-- components/web_view/frame_tree.cc | 4 +- components/web_view/frame_tree.h | 4 +- components/web_view/frame_tree_delegate.h | 2 +- components/web_view/public/cpp/web_view.cc | 2 +- components/web_view/public/cpp/web_view.h | 5 +- .../test_runner_application_delegate.cc | 12 +- .../test_runner/test_runner_application_delegate.h | 12 +- components/web_view/web_view_apptest.cc | 8 +- components/web_view/web_view_impl.cc | 16 +-- components/web_view/web_view_impl.h | 20 +-- .../application_delegate_factory_notandroid.cc | 4 +- mandoline/ui/aura/aura_init.cc | 2 +- mandoline/ui/aura/aura_init.h | 5 +- mandoline/ui/aura/input_method_mandoline.cc | 2 +- mandoline/ui/aura/input_method_mandoline.h | 6 +- mandoline/ui/aura/native_widget_view_manager.cc | 12 +- mandoline/ui/aura/native_widget_view_manager.h | 16 +-- mandoline/ui/aura/surface_binding.cc | 27 ++-- mandoline/ui/aura/surface_binding.h | 7 +- mandoline/ui/aura/surface_context_factory.cc | 6 +- mandoline/ui/aura/surface_context_factory.h | 7 +- mandoline/ui/aura/window_tree_host_mojo.cc | 9 +- mandoline/ui/aura/window_tree_host_mojo.h | 10 +- mandoline/ui/desktop_ui/browser_window.cc | 14 +- mandoline/ui/desktop_ui/browser_window.h | 16 +-- mandoline/ui/omnibox/omnibox_application.cc | 18 +-- .../phone_ui/phone_browser_application_delegate.cc | 13 +- .../phone_ui/phone_browser_application_delegate.h | 30 ++--- mojo/cc/output_surface_mojo.cc | 7 +- mojo/cc/output_surface_mojo.h | 10 +- mojo/gles2/command_buffer_client_impl.cc | 8 +- mojo/runner/android/main.cc | 6 +- 186 files changed, 1242 insertions(+), 1249 deletions(-) delete mode 100644 components/mus/mus_app.cc delete mode 100644 components/mus/mus_app.h delete mode 100644 components/mus/public/interfaces/mus_constants.mojom create mode 100644 components/mus/public/interfaces/view_manager_constants.mojom create mode 100644 components/mus/view_manager_app.cc create mode 100644 components/mus/view_manager_app.h diff --git a/components/html_viewer/ax_provider_apptest.cc b/components/html_viewer/ax_provider_apptest.cc index 5c35485..5068fa2 100644 --- a/components/html_viewer/ax_provider_apptest.cc +++ b/components/html_viewer/ax_provider_apptest.cc @@ -62,7 +62,7 @@ class TestFrameTreeServer : public web_view::FrameTreeServer { } // namespace -using AXProviderTest = mus::ViewManagerTestBase; +using AXProviderTest = ViewManagerTestBase; TEST_F(AXProviderTest, HelloWorld) { // Start a test server for net/data/test.html access. @@ -82,7 +82,7 @@ TEST_F(AXProviderTest, HelloWorld) { // Embed the html_viewer in a View. ViewTreeClientPtr tree_client; connection->ConnectToService(&tree_client); - mus::View* embed_view = window_manager()->CreateView(); + View* embed_view = window_manager()->CreateView(); embed_view->Embed(tree_client.Pass()); TestFrameTreeServer frame_tree_server; diff --git a/components/html_viewer/document_resource_waiter.cc b/components/html_viewer/document_resource_waiter.cc index cda1baf..8f80bf8 100644 --- a/components/html_viewer/document_resource_waiter.cc +++ b/components/html_viewer/document_resource_waiter.cc @@ -58,7 +58,7 @@ mojo::URLResponsePtr DocumentResourceWaiter::ReleaseURLResponse() { return response_.Pass(); } -void DocumentResourceWaiter::SetRoot(mus::View* root) { +void DocumentResourceWaiter::SetRoot(mojo::View* root) { DCHECK(!root_); root_ = root; root_->AddObserver(this); @@ -173,13 +173,13 @@ void DocumentResourceWaiter::OnWillNavigate(uint32_t target_frame_id) { } void DocumentResourceWaiter::OnViewViewportMetricsChanged( - mus::View* view, + mojo::View* view, const mojo::ViewportMetrics& old_metrics, const mojo::ViewportMetrics& new_metrics) { UpdateIsReady(); } -void DocumentResourceWaiter::OnViewDestroyed(mus::View* view) { +void DocumentResourceWaiter::OnViewDestroyed(mojo::View* view) { root_->RemoveObserver(this); root_ = nullptr; } diff --git a/components/html_viewer/document_resource_waiter.h b/components/html_viewer/document_resource_waiter.h index 380d615..f425c0c 100644 --- a/components/html_viewer/document_resource_waiter.h +++ b/components/html_viewer/document_resource_waiter.h @@ -27,7 +27,7 @@ class GlobalState; // assumed HTMLDocument will call back for the FrameTreeClient and FrameData. class DocumentResourceWaiter : public web_view::FrameTreeClient, public HTMLFrameTreeManagerObserver, - public mus::ViewObserver { + public mojo::ViewObserver { public: DocumentResourceWaiter(GlobalState* global_state, mojo::URLResponsePtr response, @@ -51,8 +51,8 @@ class DocumentResourceWaiter : public web_view::FrameTreeClient, // See class description. bool is_ready() const { return is_ready_; } - void SetRoot(mus::View* root); - mus::View* root() { return root_; } + void SetRoot(mojo::View* root); + mojo::View* root() { return root_; } void Bind(mojo::InterfaceRequest request); @@ -80,10 +80,10 @@ class DocumentResourceWaiter : public web_view::FrameTreeClient, // ViewObserver: void OnViewViewportMetricsChanged( - mus::View* view, + mojo::View* view, const mojo::ViewportMetrics& old_metrics, const mojo::ViewportMetrics& new_metrics) override; - void OnViewDestroyed(mus::View* view) override; + void OnViewDestroyed(mojo::View* view) override; // HTMLFrameTreeManagerObserver: void OnHTMLFrameTreeManagerChangeIdAdvanced() override; @@ -92,7 +92,7 @@ class DocumentResourceWaiter : public web_view::FrameTreeClient, GlobalState* global_state_; HTMLDocument* document_; mojo::URLResponsePtr response_; - mus::View* root_; + mojo::View* root_; web_view::FrameTreeServerPtr server_; mojo::Array frame_data_; uint32_t change_id_; diff --git a/components/html_viewer/global_state.h b/components/html_viewer/global_state.h index 0d60e79..28ee041 100644 --- a/components/html_viewer/global_state.h +++ b/components/html_viewer/global_state.h @@ -74,7 +74,7 @@ class GlobalState { return &raster_thread_helper_; } - mus::MojoGpuMemoryBufferManager* gpu_memory_buffer_manager() { + gles2::MojoGpuMemoryBufferManager* gpu_memory_buffer_manager() { return &gpu_memory_buffer_manager_; } @@ -109,7 +109,7 @@ class GlobalState { scoped_ptr blink_platform_; base::Thread compositor_thread_; gles2::RasterThreadHelper raster_thread_helper_; - mus::MojoGpuMemoryBufferManager gpu_memory_buffer_manager_; + gles2::MojoGpuMemoryBufferManager gpu_memory_buffer_manager_; scoped_ptr media_factory_; #if defined(OS_LINUX) && !defined(OS_ANDROID) diff --git a/components/html_viewer/html_document.cc b/components/html_viewer/html_document.cc index 79bf312..32ae0dd 100644 --- a/components/html_viewer/html_document.cc +++ b/components/html_viewer/html_document.cc @@ -31,7 +31,7 @@ #include "ui/gfx/geometry/size.h" using mojo::AxProvider; -using mus::View; +using mojo::View; namespace html_viewer { namespace { @@ -48,23 +48,23 @@ bool IsTestInterfaceEnabled() { // A ViewTreeDelegate implementation that delegates to a (swappable) delegate. // This is used when one HTMLDocument takes over for another delegate // (OnSwap()). -class ViewTreeDelegateImpl : public mus::ViewTreeDelegate { +class ViewTreeDelegateImpl : public mojo::ViewTreeDelegate { public: - explicit ViewTreeDelegateImpl(mus::ViewTreeDelegate* delegate) + explicit ViewTreeDelegateImpl(mojo::ViewTreeDelegate* delegate) : delegate_(delegate) {} ~ViewTreeDelegateImpl() override {} - void set_delegate(mus::ViewTreeDelegate* delegate) { delegate_ = delegate; } + void set_delegate(mojo::ViewTreeDelegate* delegate) { delegate_ = delegate; } private: // ViewTreeDelegate: - void OnEmbed(mus::View* root) override { delegate_->OnEmbed(root); } + void OnEmbed(mojo::View* root) override { delegate_->OnEmbed(root); } void OnUnembed() override { delegate_->OnUnembed(); } - void OnConnectionLost(mus::ViewTreeConnection* connection) override { + void OnConnectionLost(mojo::ViewTreeConnection* connection) override { delegate_->OnConnectionLost(connection); } - mus::ViewTreeDelegate* delegate_; + mojo::ViewTreeDelegate* delegate_; DISALLOW_COPY_AND_ASSIGN(ViewTreeDelegateImpl); }; @@ -117,7 +117,7 @@ HTMLDocument::HTMLDocument(mojo::ApplicationImpl* html_document_app, void HTMLDocument::Destroy() { if (resource_waiter_) { - mus::View* root = resource_waiter_->root(); + mojo::View* root = resource_waiter_->root(); if (root) { resource_waiter_.reset(); delete root->connection(); @@ -149,7 +149,7 @@ void HTMLDocument::Load() { DCHECK(resource_waiter_ && resource_waiter_->is_ready()); // Note: |view| is null if we're taking over for an existing frame. - mus::View* view = resource_waiter_->root(); + mojo::View* view = resource_waiter_->root(); if (view) { global_state_->InitIfNecessary( view->viewport_metrics().size_in_pixels.To(), @@ -200,7 +200,7 @@ void HTMLDocument::OnEmbed(View* root) { resource_waiter_->SetRoot(root); } -void HTMLDocument::OnConnectionLost(mus::ViewTreeConnection* connection) { +void HTMLDocument::OnConnectionLost(mojo::ViewTreeConnection* connection) { delete this; } @@ -316,7 +316,7 @@ void HTMLDocument::Create( transferable_state_.view_tree_delegate_impl.reset( new ViewTreeDelegateImpl(this)); transferable_state_.owns_view_tree_connection = true; - mus::ViewTreeConnection::Create( + mojo::ViewTreeConnection::Create( transferable_state_.view_tree_delegate_impl.get(), request.Pass()); } diff --git a/components/html_viewer/html_document.h b/components/html_viewer/html_document.h index 6b6f961..6caf054 100644 --- a/components/html_viewer/html_document.h +++ b/components/html_viewer/html_document.h @@ -27,7 +27,7 @@ namespace base { class SingleThreadTaskRunner; } -namespace mus { +namespace mojo { class View; class ViewTreeConnection; } @@ -49,7 +49,7 @@ class WebLayerTreeViewImpl; // . When the View the HTMLDocument is embedded in is destroyed. // . Explicitly by way of Destroy(). class HTMLDocument - : public mus::ViewTreeDelegate, + : public mojo::ViewTreeDelegate, public HTMLFrameDelegate, public mojo::InterfaceFactory, public mojo::InterfaceFactory, @@ -96,7 +96,7 @@ class HTMLDocument void Move(TransferableState* other); bool owns_view_tree_connection; - mus::View* root; + mojo::View* root; scoped_ptr view_tree_delegate_impl; }; @@ -107,8 +107,8 @@ class HTMLDocument BeforeLoadCache* GetBeforeLoadCache(); // ViewTreeDelegate: - void OnEmbed(mus::View* root) override; - void OnConnectionLost(mus::ViewTreeConnection* connection) override; + void OnEmbed(mojo::View* root) override; + void OnConnectionLost(mojo::ViewTreeConnection* connection) override; // HTMLFrameDelegate: mojo::ApplicationImpl* GetApp() override; @@ -136,7 +136,7 @@ class HTMLDocument mojo::ApplicationConnection* connection, mojo::InterfaceRequest request) override; - // mojo::InterfaceFactory: + // mojo::InterfaceFactory: void Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest request) override; diff --git a/components/html_viewer/html_frame.cc b/components/html_viewer/html_frame.cc index 77d1524..718722f 100644 --- a/components/html_viewer/html_frame.cc +++ b/components/html_viewer/html_frame.cc @@ -71,7 +71,7 @@ using mojo::AxProvider; using mojo::Rect; using mojo::ServiceProviderPtr; using mojo::URLResponsePtr; -using mus::View; +using mojo::View; using web_view::HTMLMessageEvent; using web_view::HTMLMessageEventPtr; @@ -275,7 +275,7 @@ HTMLFrame::~HTMLFrame() { if (view_) { view_->RemoveObserver(this); - mus::ScopedViewPtr::DeleteViewOrViewManager(view_); + mojo::ScopedViewPtr::DeleteViewOrViewManager(view_); } } @@ -300,7 +300,7 @@ blink::WebFrame* HTMLFrame::createChildFrame( DCHECK(view_); // If we're local we have to have a view. // Create the view that will house the frame now. We embed once we know the // url (see decidePolicyForNavigation()). - mus::View* child_view = view_->connection()->CreateView(); + mojo::View* child_view = view_->connection()->CreateView(); ReplicatedFrameState child_state; child_state.name = frame_name; child_state.tree_scope = scope; @@ -320,7 +320,7 @@ blink::WebFrame* HTMLFrame::createChildFrame( params.allow_local_shared_frame = true; HTMLFrame* child_frame = GetLocalRoot()->delegate_->GetHTMLFactory()->CreateHTMLFrame(¶ms); - child_frame->owned_view_.reset(new mus::ScopedViewPtr(child_view)); + child_frame->owned_view_.reset(new mojo::ScopedViewPtr(child_view)); return child_frame->web_frame_; } @@ -494,7 +494,7 @@ web_view::FrameTreeServer* HTMLFrame::GetFrameTreeServer() { return frame_tree_manager_->local_root_->server_.get(); } -void HTMLFrame::SetView(mus::View* view) { +void HTMLFrame::SetView(mojo::View* view) { if (view_) view_->RemoveObserver(this); view_ = view; @@ -561,7 +561,7 @@ void HTMLFrame::SwapToRemote() { void HTMLFrame::SwapToLocal( HTMLFrameDelegate* delegate, - mus::View* view, + mojo::View* view, const mojo::Map>& properties) { CHECK(!IsLocal()); // It doesn't make sense for the root to swap to local. @@ -662,8 +662,8 @@ void HTMLFrame::OnViewInputEvent(View* view, const mojo::EventPtr& event) { web_widget->handleInputEvent(*web_event); } -void HTMLFrame::OnViewFocusChanged(mus::View* gained_focus, - mus::View* lost_focus) { +void HTMLFrame::OnViewFocusChanged(mojo::View* gained_focus, + mojo::View* lost_focus) { UpdateFocus(); } diff --git a/components/html_viewer/html_frame.h b/components/html_viewer/html_frame.h index 2b8c070..826299e 100644 --- a/components/html_viewer/html_frame.h +++ b/components/html_viewer/html_frame.h @@ -33,9 +33,6 @@ class WebWidget; namespace mojo { class ApplicationImpl; class Rect; -} - -namespace mus { class ScopedViewPtr; class View; } @@ -53,7 +50,7 @@ class WebLayerTreeViewImpl; // Frame is used to represent a single frame in the frame tree of a page. The // frame is either local or remote. Each Frame is associated with a single // HTMLFrameTreeManager and can not be moved to another HTMLFrameTreeManager. -// Local frames have a mus::View, remote frames do not. +// Local frames have a mojo::View, remote frames do not. // // HTMLFrame serves as the FrameTreeClient. It implements it by forwarding // the calls to HTMLFrameTreeManager so that HTMLFrameTreeManager can update @@ -68,14 +65,14 @@ class WebLayerTreeViewImpl; class HTMLFrame : public blink::WebFrameClient, public blink::WebRemoteFrameClient, public web_view::FrameTreeClient, - public mus::ViewObserver { + public mojo::ViewObserver { public: struct CreateParams { CreateParams( HTMLFrameTreeManager* manager, HTMLFrame* parent, uint32_t id, - mus::View* view, + mojo::View* view, const mojo::Map>& properties, HTMLFrameDelegate* delegate) : manager(manager), @@ -90,7 +87,7 @@ class HTMLFrame : public blink::WebFrameClient, HTMLFrameTreeManager* manager; HTMLFrame* parent; uint32_t id; - mus::View* view; + mojo::View* view; const mojo::Map>& properties; HTMLFrameDelegate* delegate; @@ -128,10 +125,10 @@ class HTMLFrame : public blink::WebFrameClient, blink::WebView* web_view(); blink::WebWidget* GetWebWidget(); - // The mus::View this frame renders to. This is non-null for the local frame + // The mojo::View this frame renders to. This is non-null for the local frame // the frame tree was created with as well as non-null for any frames created // locally. - mus::View* view() { return view_; } + mojo::View* view() { return view_; } HTMLFrameTreeManager* frame_tree_manager() { return frame_tree_manager_; } @@ -213,7 +210,7 @@ class HTMLFrame : public blink::WebFrameClient, // Gets the FrameTreeServer to use for this frame. web_view::FrameTreeServer* GetFrameTreeServer(); - void SetView(mus::View* view); + void SetView(mojo::View* view); // Creates the appropriate WebWidget implementation for the Frame. void CreateRootWebWidget(); @@ -228,7 +225,7 @@ class HTMLFrame : public blink::WebFrameClient, // Swaps this frame from a remote frame to a local frame. void SwapToLocal( HTMLFrameDelegate* delegate, - mus::View* view, + mojo::View* view, const mojo::Map>& properties); // Invoked when changing the delegate. This informs the new delegate to take @@ -244,14 +241,14 @@ class HTMLFrame : public blink::WebFrameClient, // The various frameDetached() implementations call into this. void FrameDetachedImpl(blink::WebFrame* web_frame); - // mus::ViewObserver methods: - void OnViewBoundsChanged(mus::View* view, + // mojo::ViewObserver methods: + void OnViewBoundsChanged(mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) override; - void OnViewDestroyed(mus::View* view) override; - void OnViewInputEvent(mus::View* view, const mojo::EventPtr& event) override; - void OnViewFocusChanged(mus::View* gained_focus, - mus::View* lost_focus) override; + void OnViewDestroyed(mojo::View* view) override; + void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; + void OnViewFocusChanged(mojo::View* gained_focus, + mojo::View* lost_focus) override; // web_view::FrameTreeClient: void OnConnect(web_view::FrameTreeServerPtr server, @@ -289,7 +286,7 @@ class HTMLFrame : public blink::WebFrameClient, HTMLFrame* parent_; // |view_| is non-null for local frames or remote frames that were once // local. - mus::View* view_; + mojo::View* view_; // The id for this frame. If there is a view, this is the same id as the // view has. const uint32_t id_; @@ -318,7 +315,7 @@ class HTMLFrame : public blink::WebFrameClient, // as long as the frame is valid). If the View was deleted as soon as the // frame was swapped to remote then the process rendering to the view would // be severed. - scoped_ptr owned_view_; + scoped_ptr owned_view_; // This object is only valid in the context of performance tests. tracing::StartupPerformanceDataCollectorPtr diff --git a/components/html_viewer/html_frame_apptest.cc b/components/html_viewer/html_frame_apptest.cc index 8faca9c..ac144e5 100644 --- a/components/html_viewer/html_frame_apptest.cc +++ b/components/html_viewer/html_frame_apptest.cc @@ -24,7 +24,6 @@ #include "net/test/spawned_test_server/spawned_test_server.h" #include "third_party/mojo_services/src/accessibility/public/interfaces/accessibility.mojom.h" -using mus::ViewManagerTestBase; using web_view::Frame; using web_view::FrameConnection; using web_view::FrameTree; @@ -142,7 +141,7 @@ class HTMLFrameTest : public ViewManagerTestBase { // Creates the frame tree showing an empty page at the root and adds (via // script) a frame showing the same empty page. Frame* LoadEmptyPageAndCreateFrame() { - mus::View* embed_view = window_manager()->CreateView(); + View* embed_view = window_manager()->CreateView(); frame_tree_delegate_.reset( new TestFrameTreeDelegateImpl(application_impl())); FrameConnection* root_connection = @@ -195,8 +194,7 @@ class HTMLFrameTest : public ViewManagerTestBase { return request.Pass(); } - FrameConnection* InitFrameTree(mus::View* view, - const std::string& url_string) { + FrameConnection* InitFrameTree(View* view, const std::string& url_string) { frame_tree_delegate_.reset( new TestFrameTreeDelegateImpl(application_impl())); scoped_ptr frame_connection(new FrameConnection); @@ -252,7 +250,7 @@ class HTMLFrameTest : public ViewManagerTestBase { }; TEST_F(HTMLFrameTest, PageWithSingleFrame) { - mus::View* embed_view = window_manager()->CreateView(); + View* embed_view = window_manager()->CreateView(); FrameConnection* root_connection = InitFrameTree( embed_view, "http://127.0.0.1:%u/files/page_with_single_frame.html"); @@ -281,7 +279,7 @@ TEST_F(HTMLFrameTest, PageWithSingleFrame) { // Creates two frames. The parent navigates the child frame by way of changing // the location of the child frame. TEST_F(HTMLFrameTest, ChangeLocationOfChildFrame) { - mus::View* embed_view = window_manager()->CreateView(); + View* embed_view = window_manager()->CreateView(); ASSERT_TRUE(InitFrameTree( embed_view, "http://127.0.0.1:%u/files/page_with_single_frame.html")); diff --git a/components/html_viewer/html_frame_tree_manager.cc b/components/html_viewer/html_frame_tree_manager.cc index 07d026e..84a6ab9 100644 --- a/components/html_viewer/html_frame_tree_manager.cc +++ b/components/html_viewer/html_frame_tree_manager.cc @@ -68,7 +68,7 @@ HTMLFrameTreeManager::TreeMap* HTMLFrameTreeManager::instances_ = nullptr; // static HTMLFrame* HTMLFrameTreeManager::CreateFrameAndAttachToTree( GlobalState* global_state, - mus::View* view, + mojo::View* view, scoped_ptr resource_waiter, HTMLFrameDelegate* delegate) { if (!instances_) @@ -209,7 +209,7 @@ HTMLFrameTreeManager::~HTMLFrameTreeManager() { void HTMLFrameTreeManager::Init( HTMLFrameDelegate* delegate, - mus::View* local_view, + mojo::View* local_view, const mojo::Array& frame_data, uint32_t change_id) { change_id_ = change_id; @@ -223,7 +223,7 @@ HTMLFrame* HTMLFrameTreeManager::BuildFrameTree( HTMLFrameDelegate* delegate, const mojo::Array& frame_data, uint32_t local_frame_id, - mus::View* local_view) { + mojo::View* local_view) { std::vector parents; HTMLFrame* root = nullptr; HTMLFrame* last_frame = nullptr; diff --git a/components/html_viewer/html_frame_tree_manager.h b/components/html_viewer/html_frame_tree_manager.h index bbd2d66..61ea86f 100644 --- a/components/html_viewer/html_frame_tree_manager.h +++ b/components/html_viewer/html_frame_tree_manager.h @@ -18,7 +18,7 @@ namespace blink { class WebView; } -namespace mus { +namespace mojo { class View; } @@ -34,7 +34,7 @@ class HTMLFrameTreeManagerObserver; // document. Some of the frames may be remote. HTMLFrameTreeManager updates its // state in response to changes from the FrameTreeServer, as well as changes // from the underlying frames. The frame tree has at least one local frame -// that is backed by a mus::View. +// that is backed by a mojo::View. class HTMLFrameTreeManager { public: // Returns a new HTMLFrame or null if a HTMLFrame does not need to be created. @@ -42,7 +42,7 @@ class HTMLFrameTreeManager { // Close() when done. static HTMLFrame* CreateFrameAndAttachToTree( GlobalState* global_state, - mus::View* view, + mojo::View* view, scoped_ptr resource_waiter, HTMLFrameDelegate* delegate); @@ -71,7 +71,7 @@ class HTMLFrameTreeManager { ~HTMLFrameTreeManager(); void Init(HTMLFrameDelegate* delegate, - mus::View* local_view, + mojo::View* local_view, const mojo::Array& frame_data, uint32_t change_id); @@ -80,7 +80,7 @@ class HTMLFrameTreeManager { HTMLFrameDelegate* delegate, const mojo::Array& frame_data, uint32_t local_frame_id, - mus::View* local_view); + mojo::View* local_view); // Returns this HTMLFrameTreeManager from |instances_|. void RemoveFromInstances(); diff --git a/components/html_viewer/html_widget.cc b/components/html_viewer/html_widget.cc index aacfcac..2442657 100644 --- a/components/html_viewer/html_widget.cc +++ b/components/html_viewer/html_widget.cc @@ -33,7 +33,7 @@ scoped_ptr CreateWebLayerTreeView( void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, mojo::ApplicationImpl* app, - mus::View* view, + mojo::View* view, blink::WebWidget* widget) { DCHECK(view); mojo::URLRequestPtr request(mojo::URLRequest::New()); @@ -43,7 +43,7 @@ void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, web_layer_tree_view->Initialize(gpu_service.Pass(), view, widget); } -void UpdateWebViewSizeFromViewSize(mus::View* view, +void UpdateWebViewSizeFromViewSize(mojo::View* view, blink::WebWidget* web_widget, WebLayerTreeViewImpl* web_layer_tree_view) { const gfx::Size size_in_pixels(view->bounds().width, view->bounds().height); @@ -81,13 +81,13 @@ blink::WebWidget* HTMLWidgetRootRemote::GetWidget() { return web_view_; } -void HTMLWidgetRootRemote::OnViewBoundsChanged(mus::View* view) {} +void HTMLWidgetRootRemote::OnViewBoundsChanged(mojo::View* view) {} // HTMLWidgetRootLocal -------------------------------------------------------- HTMLWidgetRootLocal::CreateParams::CreateParams(mojo::ApplicationImpl* app, GlobalState* global_state, - mus::View* view) + mojo::View* view) : app(app), global_state(global_state), view(view) {} HTMLWidgetRootLocal::CreateParams::~CreateParams() {} @@ -160,7 +160,7 @@ blink::WebWidget* HTMLWidgetRootLocal::GetWidget() { return web_view_; } -void HTMLWidgetRootLocal::OnViewBoundsChanged(mus::View* view) { +void HTMLWidgetRootLocal::OnViewBoundsChanged(mojo::View* view) { UpdateWebViewSizeFromViewSize(view, web_view_, web_layer_tree_view_impl_.get()); } @@ -169,7 +169,7 @@ void HTMLWidgetRootLocal::OnViewBoundsChanged(mus::View* view) { HTMLWidgetLocalRoot::HTMLWidgetLocalRoot(mojo::ApplicationImpl* app, GlobalState* global_state, - mus::View* view, + mojo::View* view, blink::WebLocalFrame* web_local_frame) : app_(app), global_state_(global_state), web_frame_widget_(nullptr) { web_frame_widget_ = blink::WebFrameWidget::create(this, web_local_frame); @@ -192,7 +192,7 @@ blink::WebWidget* HTMLWidgetLocalRoot::GetWidget() { return web_frame_widget_; } -void HTMLWidgetLocalRoot::OnViewBoundsChanged(mus::View* view) { +void HTMLWidgetLocalRoot::OnViewBoundsChanged(mojo::View* view) { UpdateWebViewSizeFromViewSize(view, web_frame_widget_, web_layer_tree_view_impl_.get()); } diff --git a/components/html_viewer/html_widget.h b/components/html_viewer/html_widget.h index 37074ce..6e26ea8 100644 --- a/components/html_viewer/html_widget.h +++ b/components/html_viewer/html_widget.h @@ -14,9 +14,6 @@ class WebFrameWidget; namespace mojo { class ApplicationImpl; -} - -namespace mus { class View; } @@ -34,7 +31,7 @@ class HTMLWidget { virtual blink::WebWidget* GetWidget() = 0; - virtual void OnViewBoundsChanged(mus::View* view) = 0; + virtual void OnViewBoundsChanged(mojo::View* view) = 0; }; // Used for the root frame when the root frame is remote. @@ -46,7 +43,7 @@ class HTMLWidgetRootRemote : public HTMLWidget { private: // HTMLWidget: blink::WebWidget* GetWidget() override; - void OnViewBoundsChanged(mus::View* view) override; + void OnViewBoundsChanged(mojo::View* view) override; blink::WebView* web_view_; @@ -60,12 +57,12 @@ class HTMLWidgetRootLocal : public HTMLWidget, public blink::WebViewClient { struct CreateParams { CreateParams(mojo::ApplicationImpl* app, GlobalState* global_state, - mus::View* view); + mojo::View* view); ~CreateParams(); mojo::ApplicationImpl* app; GlobalState* global_state; - mus::View* view; + mojo::View* view; }; HTMLWidgetRootLocal(CreateParams* create_params); @@ -88,11 +85,11 @@ class HTMLWidgetRootLocal : public HTMLWidget, public blink::WebViewClient { private: // HTMLWidget: blink::WebWidget* GetWidget() override; - void OnViewBoundsChanged(mus::View* view) override; + void OnViewBoundsChanged(mojo::View* view) override; mojo::ApplicationImpl* app_; GlobalState* global_state_; - mus::View* view_; + mojo::View* view_; blink::WebView* web_view_; scoped_ptr web_layer_tree_view_impl_; scoped_ptr ime_controller_; @@ -105,14 +102,14 @@ class HTMLWidgetLocalRoot : public HTMLWidget, public blink::WebWidgetClient { public: HTMLWidgetLocalRoot(mojo::ApplicationImpl* app, GlobalState* global_state, - mus::View* view, + mojo::View* view, blink::WebLocalFrame* web_local_frame); ~HTMLWidgetLocalRoot() override; private: // HTMLWidget: blink::WebWidget* GetWidget() override; - void OnViewBoundsChanged(mus::View* view) override; + void OnViewBoundsChanged(mojo::View* view) override; // WebWidgetClient: virtual void initializeLayerTreeView(); diff --git a/components/html_viewer/ime_controller.cc b/components/html_viewer/ime_controller.cc index 9fe06b3..f0eb50b 100644 --- a/components/html_viewer/ime_controller.cc +++ b/components/html_viewer/ime_controller.cc @@ -12,8 +12,9 @@ namespace html_viewer { -ImeController::ImeController(mus::View* view, blink::WebWidget* widget) - : view_(view), widget_(widget) {} +ImeController::ImeController(mojo::View* view, blink::WebWidget* widget) + : view_(view), widget_(widget) { +} ImeController::~ImeController() {} diff --git a/components/html_viewer/ime_controller.h b/components/html_viewer/ime_controller.h index 24923ab..8c2917f 100644 --- a/components/html_viewer/ime_controller.h +++ b/components/html_viewer/ime_controller.h @@ -12,7 +12,7 @@ class WebGestureEvent; class WebWidget; } -namespace mus { +namespace mojo { class View; } @@ -22,7 +22,7 @@ namespace html_viewer { // handling IME related stuff. class ImeController { public: - ImeController(mus::View* view, blink::WebWidget* widget); + ImeController(mojo::View* view, blink::WebWidget* widget); ~ImeController(); // Methods called by WebWidget overrides. @@ -33,13 +33,13 @@ class ImeController { void ShowImeIfNeeded(); private: - // Update text input state from WebWidget to mus::View. If the focused + // Update text input state from WebWidget to mojo::View. If the focused // element is editable and |show_ime| is True, the software keyboard will be // shown. void UpdateTextInputState(bool show_ime); // Not owned objects. - mus::View* view_; + mojo::View* view_; blink::WebWidget* widget_; blink::WebTextInputInfo text_input_info_; diff --git a/components/html_viewer/web_layer_impl.cc b/components/html_viewer/web_layer_impl.cc index 0eb5335..345e1fa 100644 --- a/components/html_viewer/web_layer_impl.cc +++ b/components/html_viewer/web_layer_impl.cc @@ -30,13 +30,14 @@ void RequireCallback(cc::SurfaceId surface_id, } -WebLayerImpl::WebLayerImpl(mus::View* view, float device_pixel_ratio) - : cc_blink::WebLayerImpl( - cc::SurfaceLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), - base::Bind(&SatisfyCallback), - base::Bind(&RequireCallback))), +WebLayerImpl::WebLayerImpl(mojo::View* view, float device_pixel_ratio) + : cc_blink::WebLayerImpl(cc::SurfaceLayer::Create( + cc_blink::WebLayerImpl::LayerSettings(), + base::Bind(&SatisfyCallback), + base::Bind(&RequireCallback))), view_(view), - device_pixel_ratio_(device_pixel_ratio) {} + device_pixel_ratio_(device_pixel_ratio) { +} WebLayerImpl::~WebLayerImpl() { } diff --git a/components/html_viewer/web_layer_impl.h b/components/html_viewer/web_layer_impl.h index e245d1f..779c69f 100644 --- a/components/html_viewer/web_layer_impl.h +++ b/components/html_viewer/web_layer_impl.h @@ -10,7 +10,7 @@ #include "cc/blink/web_layer_impl.h" #include "cc/layers/surface_layer.h" -namespace mus { +namespace mojo { class View; } @@ -18,14 +18,14 @@ namespace html_viewer { class WebLayerImpl : public cc_blink::WebLayerImpl { public: - WebLayerImpl(mus::View* view, float device_pixel_ratio); + WebLayerImpl(mojo::View* view, float device_pixel_ratio); ~WebLayerImpl() override; // WebLayer implementation. void setBounds(const blink::WebSize& bounds) override; private: - mus::View* view_; + mojo::View* view_; const float device_pixel_ratio_; scoped_refptr layer_; diff --git a/components/html_viewer/web_layer_tree_view_impl.cc b/components/html_viewer/web_layer_tree_view_impl.cc index ef9d8c5..a1559af 100644 --- a/components/html_viewer/web_layer_tree_view_impl.cc +++ b/components/html_viewer/web_layer_tree_view_impl.cc @@ -58,7 +58,7 @@ WebLayerTreeViewImpl::WebLayerTreeViewImpl( } void WebLayerTreeViewImpl::Initialize(mojo::GpuPtr gpu_service, - mus::View* view, + mojo::View* view, blink::WebWidget* widget) { view_ = view; widget_ = widget; diff --git a/components/html_viewer/web_layer_tree_view_impl.h b/components/html_viewer/web_layer_tree_view_impl.h index b78b556..0817b9b 100644 --- a/components/html_viewer/web_layer_tree_view_impl.h +++ b/components/html_viewer/web_layer_tree_view_impl.h @@ -48,7 +48,7 @@ class WebLayerTreeViewImpl : public blink::WebLayerTreeView, ~WebLayerTreeViewImpl() override; void Initialize(mojo::GpuPtr gpu_service, - mus::View* view, + mojo::View* view, blink::WebWidget* widget); // cc::LayerTreeHostClient implementation. @@ -115,7 +115,7 @@ class WebLayerTreeViewImpl : public blink::WebLayerTreeView, private: // widget_ and view_ will outlive us. blink::WebWidget* widget_; - mus::View* view_; + mojo::View* view_; scoped_ptr layer_tree_host_; scoped_ptr output_surface_; scoped_refptr 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 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 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& surfaces_state) + const scoped_refptr& 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 message_ids_; + std::set message_ids_; DISALLOW_COPY_AND_ASSIGN(ScopedChange); }; - ConnectionManager(ConnectionManagerDelegate* delegate, - const scoped_refptr& surfaces_state); + ConnectionManager( + ConnectionManagerDelegate* delegate, + const scoped_refptr& 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; + using ConnectionMap = std::map; using HostConnectionMap = std::map; @@ -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 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 surfaces_state_; + scoped_refptr 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 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 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& gpu_state, - const scoped_refptr& surfaces_state) { + const scoped_refptr& gpu_state, + const scoped_refptr& 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& gpu_state, - const scoped_refptr& surfaces_state) + const scoped_refptr& gpu_state, + const scoped_refptr& 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(), 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& gpu_state, - const scoped_refptr& surfaces_state); + const scoped_refptr& gpu_state, + const scoped_refptr& 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& gpu_state, - const scoped_refptr& surfaces_state); + DefaultDisplayManager( + bool is_headless, + mojo::ApplicationImpl* app_impl, + const scoped_refptr& gpu_state, + const scoped_refptr& surfaces_state); ~DefaultDisplayManager() override; // DisplayManager: @@ -121,8 +125,8 @@ class DefaultDisplayManager : public DisplayManager, bool is_headless_; mojo::ApplicationImpl* app_impl_; - scoped_refptr gpu_state_; - scoped_refptr surfaces_state_; + scoped_refptr gpu_state_; + scoped_refptr surfaces_state_; DisplayManagerDelegate* delegate_; mojo::ViewportMetrics metrics_; @@ -130,7 +134,7 @@ class DefaultDisplayManager : public DisplayManager, base::Timer draw_timer_; bool frame_pending_; - scoped_ptr top_level_display_client_; + scoped_ptr top_level_display_client_; scoped_ptr platform_window_; base::WeakPtrFactory 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& gpu_state, - const scoped_refptr& surfaces_state) = 0; + const scoped_refptr& gpu_state, + const scoped_refptr& 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; @@ -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 empty_vector; - view->SetProperty(kViewManagerKeyWantsTouchEvents, &empty_vector); + view->SetProperty(mojo::kViewManagerKeyWantsTouchEvents, &empty_vector); } std::set 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 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 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& 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& gpu_state) +CommandBufferLocal::CommandBufferLocal( + CommandBufferLocalClient* client, + gfx::AcceleratedWidget widget, + const scoped_refptr& gpu_state) : widget_(widget), gpu_state_(gpu_state), client_(client), @@ -74,7 +75,7 @@ bool CommandBufferLocal::Initialize() { bool bind_generates_resource = false; scoped_refptr 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 image(new gfx::GLImageMemory( gfx::Size(static_cast(width), static_cast(height)), @@ -159,10 +160,11 @@ int32_t CommandBufferLocal::CreateGpuMemoryBufferImage(size_t width, unsigned internalformat, unsigned usage) { DCHECK_EQ(usage, static_cast(GL_MAP_CHROMIUM)); - scoped_ptr buffer(MojoGpuMemoryBufferImpl::Create( - gfx::Size(static_cast(width), static_cast(height)), - gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat), - gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage))); + scoped_ptr buffer( + gles2::MojoGpuMemoryBufferImpl::Create( + gfx::Size(static_cast(width), static_cast(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& gpu_state); + const scoped_refptr& gpu_state); ~CommandBufferLocal() override; bool Initialize(); @@ -84,7 +83,7 @@ class CommandBufferLocal : public gpu::GpuControl { void OnSyncPointRetired(); gfx::AcceleratedWidget widget_; - scoped_refptr gpu_state_; + scoped_refptr gpu_state_; scoped_ptr command_buffer_; scoped_ptr scheduler_; scoped_ptr 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::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 { 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 request, const scoped_refptr& 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 { scoped_refptr 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(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/mus_app.cc b/components/mus/mus_app.cc deleted file mode 100644 index e33fa18..0000000 --- a/components/mus/mus_app.cc +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// 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 "base/command_line.h" -#include "base/stl_util.h" -#include "components/mus/client_connection.h" -#include "components/mus/connection_manager.h" -#include "components/mus/gles2/gpu_impl.h" -#include "components/mus/public/cpp/args.h" -#include "components/mus/surfaces/surfaces_scheduler.h" -#include "components/mus/view_tree_host_connection.h" -#include "components/mus/view_tree_host_impl.h" -#include "components/mus/view_tree_impl.h" -#include "mojo/application/public/cpp/application_connection.h" -#include "mojo/application/public/cpp/application_impl.h" -#include "mojo/application/public/cpp/application_runner.h" -#include "mojo/common/tracing_impl.h" -#include "third_party/mojo/src/mojo/public/c/system/main.h" -#include "ui/events/event_switches.h" -#include "ui/events/platform/platform_event_source.h" -#include "ui/gl/gl_surface.h" -#include "ui/gl/test/gl_surface_test_support.h" - -#if defined(USE_X11) -#include -#include "ui/platform_window/x11/x11_window.h" -#endif - -using mojo::ApplicationConnection; -using mojo::ApplicationImpl; -using mojo::Gpu; -using mojo::InterfaceRequest; -using mojo::ViewTreeHostFactory; - -namespace mus { - -MandolineUIServicesApp::MandolineUIServicesApp() - : app_impl_(nullptr), is_headless_(false) {} - -MandolineUIServicesApp::~MandolineUIServicesApp() { - if (gpu_state_) - gpu_state_->StopControlThread(); - // Destroy |connection_manager_| first, since it depends on |event_source_|. - connection_manager_.reset(); -} - -void MandolineUIServicesApp::Initialize(ApplicationImpl* app) { - app_impl_ = app; - tracing_.Initialize(app); - surfaces_state_ = new SurfacesState; - -#if !defined(OS_ANDROID) - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - is_headless_ = command_line->HasSwitch(kUseHeadlessConfig); - if (!is_headless_) { -#if defined(USE_X11) - if (command_line->HasSwitch(kUseX11TestConfig)) { - XInitThreads(); - ui::test::SetUseOverrideRedirectWindowByDefault(true); - } -#endif - gfx::GLSurface::InitializeOneOff(); - event_source_ = ui::PlatformEventSource::CreateDefault(); - } -#endif - - if (!gpu_state_.get()) - gpu_state_ = new GpuState; - connection_manager_.reset(new ConnectionManager(this, surfaces_state_)); -} - -bool MandolineUIServicesApp::ConfigureIncomingConnection( - ApplicationConnection* connection) { - // MandolineUIServices - connection->AddService(this); - // GPU - connection->AddService(this); - return true; -} - -void MandolineUIServicesApp::OnNoMoreRootConnections() { - app_impl_->Quit(); -} - -ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( - ConnectionManager* connection_manager, - mojo::InterfaceRequest tree_request, - ConnectionSpecificId creator_id, - mojo::URLRequestPtr request, - const ViewId& root_id, - uint32_t policy_bitmask) { - mojo::ViewTreeClientPtr client; - app_impl_->ConnectToService(request.Pass(), &client); - - scoped_ptr service(new ViewTreeImpl( - connection_manager, creator_id, root_id, policy_bitmask)); - return new DefaultClientConnection(service.Pass(), connection_manager, - tree_request.Pass(), client.Pass()); -} - -ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( - ConnectionManager* connection_manager, - mojo::InterfaceRequest tree_request, - ConnectionSpecificId creator_id, - const ViewId& root_id, - uint32_t policy_bitmask, - mojo::ViewTreeClientPtr client) { - scoped_ptr service(new ViewTreeImpl( - connection_manager, creator_id, root_id, policy_bitmask)); - return new DefaultClientConnection(service.Pass(), connection_manager, - tree_request.Pass(), client.Pass()); -} - -void MandolineUIServicesApp::Create( - ApplicationConnection* connection, - InterfaceRequest request) { - factory_bindings_.AddBinding(this, request.Pass()); -} - -void MandolineUIServicesApp::Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest request) { - if (!gpu_state_.get()) - gpu_state_ = new GpuState; - new GpuImpl(request.Pass(), gpu_state_); -} - -void MandolineUIServicesApp::CreateViewTreeHost( - mojo::InterfaceRequest host, - mojo::ViewTreeHostClientPtr host_client, - mojo::ViewTreeClientPtr tree_client) { - DCHECK(connection_manager_.get()); - - // TODO(fsamuel): We need to make sure that only the window manager can create - // new roots. - ViewTreeHostImpl* host_impl = new ViewTreeHostImpl( - host_client.Pass(), connection_manager_.get(), is_headless_, app_impl_, - gpu_state_, surfaces_state_); - - // ViewTreeHostConnection manages its own lifetime. - host_impl->Init(new ViewTreeHostConnectionImpl( - host.Pass(), make_scoped_ptr(host_impl), tree_client.Pass(), - connection_manager_.get())); -} - -} // namespace mus diff --git a/components/mus/mus_app.h b/components/mus/mus_app.h deleted file mode 100644 index db528e1..0000000 --- a/components/mus/mus_app.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_MUS_VIEW_MANAGER_APP_H_ -#define COMPONENTS_MUS_VIEW_MANAGER_APP_H_ - -#include - -#include "base/memory/scoped_ptr.h" -#include "cc/surfaces/surface_manager.h" -#include "components/mus/connection_manager_delegate.h" -#include "components/mus/public/interfaces/gpu.mojom.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" -#include "mojo/application/public/cpp/app_lifetime_helper.h" -#include "mojo/application/public/cpp/application_delegate.h" -#include "mojo/application/public/cpp/interface_factory.h" -#include "mojo/common/tracing_impl.h" -#include "mojo/common/weak_binding_set.h" - -namespace mojo { -class ApplicationImpl; -} - -namespace ui { -class PlatformEventSource; -} - -namespace mus { - -class ConnectionManager; -class GpuState; -class SurfacesScheduler; -class SurfacesState; - -class MandolineUIServicesApp - : public mojo::ApplicationDelegate, - public ConnectionManagerDelegate, - public mojo::InterfaceFactory, - public mojo::InterfaceFactory, - public mojo::ViewTreeHostFactory { - public: - MandolineUIServicesApp(); - ~MandolineUIServicesApp() override; - - private: - // ApplicationDelegate: - void Initialize(mojo::ApplicationImpl* app) override; - bool ConfigureIncomingConnection( - mojo::ApplicationConnection* connection) override; - - // ConnectionManagerDelegate: - void OnNoMoreRootConnections() override; - ClientConnection* CreateClientConnectionForEmbedAtView( - ConnectionManager* connection_manager, - mojo::InterfaceRequest tree_request, - ConnectionSpecificId creator_id, - mojo::URLRequestPtr request, - const ViewId& root_id, - uint32_t policy_bitmask) override; - ClientConnection* CreateClientConnectionForEmbedAtView( - ConnectionManager* connection_manager, - mojo::InterfaceRequest tree_request, - ConnectionSpecificId creator_id, - const ViewId& root_id, - uint32_t policy_bitmask, - mojo::ViewTreeClientPtr client) override; - - // mojo::InterfaceFactory: - void Create( - mojo::ApplicationConnection* connection, - mojo::InterfaceRequest request) override; - - // mojo::InterfaceFactory implementation. - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest request) override; - - // mojo::ViewTreeHostFactory implementation. - void CreateViewTreeHost(mojo::InterfaceRequest host, - mojo::ViewTreeHostClientPtr host_client, - mojo::ViewTreeClientPtr tree_client) override; - - mojo::WeakBindingSet factory_bindings_; - mojo::ApplicationImpl* app_impl_; - scoped_ptr connection_manager_; - mojo::TracingImpl tracing_; - scoped_refptr gpu_state_; - scoped_ptr event_source_; - bool is_headless_; - - // Surfaces - scoped_refptr surfaces_state_; - - DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp); -}; - -} // namespace mus - -#endif // COMPONENTS_MUS_VIEW_MANAGER_APP_H_ 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 View::RequestSurface() { +scoped_ptr View::RequestSurface() { mojo::SurfacePtr surface; mojo::SurfaceClientPtr client; - mojo::InterfaceRequest client_request = - GetProxy(&client); + mojo::InterfaceRequest client_request = GetProxy(&client); static_cast(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 transport_value; + Array 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(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(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>>()); 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& views, + const Array& views, View* initial_parent) { std::vector parents; View* root = NULL; @@ -70,13 +70,12 @@ View* BuildViewTree(ViewTreeClientImpl* client, ViewTreeConnection* ViewTreeConnection::Create( ViewTreeDelegate* delegate, - mojo::InterfaceRequest request) { + InterfaceRequest request) { return new ViewTreeClientImpl(delegate, request.Pass()); } -ViewTreeClientImpl::ViewTreeClientImpl( - ViewTreeDelegate* delegate, - mojo::InterfaceRequest request) +ViewTreeClientImpl::ViewTreeClientImpl(ViewTreeDelegate* delegate, + InterfaceRequest 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& data) { DCHECK(tree_); - tree_->SetViewProperty(view_id, mojo::String(name), - mojo::Array::From(data), + tree_->SetViewProperty(view_id, String(name), Array::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 surface, - mojo::SurfaceClientPtr client) { +void ViewTreeClientImpl::RequestSurface(Id view_id, + InterfaceRequest 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 views) { + mojo::Array 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 new_data) { +void ViewTreeClientImpl::OnViewSharedPropertyChanged(Id view_id, + const String& name, + Array new_data) { View* view = GetViewById(view_id); if (view) { std::vector data; @@ -396,8 +392,8 @@ void ViewTreeClientImpl::OnViewSharedPropertyChanged( void ViewTreeClientImpl::OnViewInputEvent( Id view_id, - mojo::EventPtr event, - const mojo::Callback& ack_callback) { + EventPtr event, + const Callback& 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 ViewTreeClientImpl::ActionCompletedCallback() { +Callback 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 request); + InterfaceRequest 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& 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 surface, - mojo::SurfaceClientPtr client); + InterfaceRequest surface, + SurfaceClientPtr client); - void set_change_acked_callback(const mojo::Callback& callback) { + void set_change_acked_callback(const Callback& 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 views) override; + Array 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 new_data) override; + const String& name, + Array new_data) override; void OnViewInputEvent(Id view_id, - mojo::EventPtr event, - const mojo::Callback& callback) override; + EventPtr event, + const Callback& callback) override; void OnViewFocused(Id focused_view_id) override; void RootDestroyed(View* root); void OnActionCompleted(bool success); - mojo::Callback ActionCompletedCallback(); + Callback ActionCompletedCallback(); ConnectionSpecificId connection_id_; ConnectionSpecificId next_id_; - mojo::Callback change_acked_callback_; + Callback change_acked_callback_; ViewTreeDelegate* delegate_; @@ -144,8 +140,8 @@ class ViewTreeClientImpl : public ViewTreeConnection, View* focused_view_; View* activated_view_; - mojo::Binding binding_; - mojo::ViewTreePtr tree_; + Binding 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(this); + ApplicationConnection* connection) { + connection->AddService(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 request) { +void ViewManagerTestBase::Create(ApplicationConnection* connection, + InterfaceRequest 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 { +class ViewManagerTestBase : public test::ApplicationTestBase, + public ApplicationDelegate, + public ViewTreeDelegate, + public InterfaceFactory { 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: - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest request) override; + void Create(ApplicationConnection* connection, + InterfaceRequest 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 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((id >> 16) & 0xFFFF); @@ -25,6 +25,6 @@ inline uint16_t LoWord(uint32_t id) { return static_cast(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 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 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* 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); \ - template EXPORT T mus::View::GetLocalProperty(const mus::ViewProperty*) \ - const; \ - template EXPORT void mus::View::ClearLocalProperty( \ - const mus::ViewProperty*); +#define DECLARE_EXPORTED_VIEW_PROPERTY_TYPE(EXPORT, T) \ + template EXPORT void mojo::View::SetLocalProperty( \ + const mojo::ViewProperty*, T); \ + template EXPORT T mojo::View::GetLocalProperty(const mojo::ViewProperty*) \ + const; \ + template EXPORT void mojo::View::ClearLocalProperty( \ + const mojo::ViewProperty*); #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 NAME##_Value = {DEFAULT, #NAME, nullptr}; \ + const mojo::ViewProperty NAME##_Value = {DEFAULT, #NAME, nullptr}; \ } \ - const mus::ViewProperty* const NAME = &NAME##_Value; + const mojo::ViewProperty* 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 NAME##_Value = {DEFAULT, #NAME, nullptr}; \ - const mus::ViewProperty* const NAME = &NAME##_Value; \ + const mojo::ViewProperty NAME##_Value = {DEFAULT, #NAME, nullptr}; \ + const mojo::ViewProperty* 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::FromInt64(p); \ - } \ - const mus::ViewProperty NAME##_Value = {DEFAULT, #NAME, \ - &Deallocator##NAME}; \ - } \ - const mus::ViewProperty* 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::FromInt64(p); \ + } \ + const mojo::ViewProperty NAME##_Value = {DEFAULT, #NAME, \ + &Deallocator##NAME}; \ + } \ + const mojo::ViewProperty* 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 surface_info, mojo::InterfaceRequest client_request); @@ -40,7 +40,7 @@ class ViewSurface : public mojo::SurfaceClient { void ReturnResources( mojo::Array resources) override; - ViewSurfaceClient* client_; + mojo::ViewSurfaceClient* client_; mojo::InterfacePtrInfo surface_info_; mojo::InterfaceRequest 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 request); + static ViewTreeConnection* Create(ViewTreeDelegate* delegate, + InterfaceRequest 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/mus_constants.mojom deleted file mode 100644 index 14bd363..0000000 --- a/components/mus/public/interfaces/mus_constants.mojom +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -module mojo; - -enum OrderDirection { - ABOVE = 1, - BELOW, -}; diff --git a/components/mus/public/interfaces/view_manager_constants.mojom b/components/mus/public/interfaces/view_manager_constants.mojom new file mode 100644 index 0000000..14bd363 --- /dev/null +++ b/components/mus/public/interfaces/view_manager_constants.mojom @@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo; + +enum OrderDirection { + ABOVE = 1, + BELOW, +}; 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 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& state) + const scoped_refptr& 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& state); + const scoped_refptr& state); // cc::ContextProvider implementation. bool BindToCurrentThread() override; @@ -77,13 +80,13 @@ class SurfacesContextProvider : public cc::ContextProvider, SurfacesContextProviderDelegate* delegate_; gfx::AcceleratedWidget widget_; - scoped_ptr command_buffer_local_; + scoped_ptr 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& 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 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 { 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& gpu_state, + const scoped_refptr& gpu_state, const scoped_refptr& 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& gpu_state, + const scoped_refptr& gpu_state, const scoped_refptr& 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> properties; @@ -59,11 +59,11 @@ struct Change { ~Change(); ChangeType type; - ConnectionSpecificId connection_id; + mojo::ConnectionSpecificId connection_id; std::vector 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 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 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(); } -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 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(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/view_manager_app.cc b/components/mus/view_manager_app.cc new file mode 100644 index 0000000..d83894d --- /dev/null +++ b/components/mus/view_manager_app.cc @@ -0,0 +1,146 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/mus/view_manager_app.h" + +#include "base/command_line.h" +#include "base/stl_util.h" +#include "components/mus/client_connection.h" +#include "components/mus/connection_manager.h" +#include "components/mus/gles2/gpu_impl.h" +#include "components/mus/public/cpp/args.h" +#include "components/mus/surfaces/surfaces_scheduler.h" +#include "components/mus/view_tree_host_connection.h" +#include "components/mus/view_tree_host_impl.h" +#include "components/mus/view_tree_impl.h" +#include "mojo/application/public/cpp/application_connection.h" +#include "mojo/application/public/cpp/application_impl.h" +#include "mojo/application/public/cpp/application_runner.h" +#include "mojo/common/tracing_impl.h" +#include "third_party/mojo/src/mojo/public/c/system/main.h" +#include "ui/events/event_switches.h" +#include "ui/events/platform/platform_event_source.h" +#include "ui/gl/gl_surface.h" +#include "ui/gl/test/gl_surface_test_support.h" + +#if defined(USE_X11) +#include +#include "ui/platform_window/x11/x11_window.h" +#endif + +using mojo::ApplicationConnection; +using mojo::ApplicationImpl; +using mojo::Gpu; +using mojo::InterfaceRequest; +using mojo::ViewTreeHostFactory; + +namespace view_manager { + +ViewManagerApp::ViewManagerApp() : app_impl_(nullptr), is_headless_(false) {} + +ViewManagerApp::~ViewManagerApp() { + if (gpu_state_) + gpu_state_->StopControlThread(); + // Destroy |connection_manager_| first, since it depends on |event_source_|. + connection_manager_.reset(); +} + +void ViewManagerApp::Initialize(ApplicationImpl* app) { + app_impl_ = app; + tracing_.Initialize(app); + surfaces_state_ = new surfaces::SurfacesState; + +#if !defined(OS_ANDROID) + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); + if (!is_headless_) { +#if defined(USE_X11) + if (command_line->HasSwitch(mojo::kUseX11TestConfig)) { + XInitThreads(); + ui::test::SetUseOverrideRedirectWindowByDefault(true); + } +#endif + gfx::GLSurface::InitializeOneOff(); + event_source_ = ui::PlatformEventSource::CreateDefault(); + } +#endif + + if (!gpu_state_.get()) + gpu_state_ = new gles2::GpuState; + connection_manager_.reset(new ConnectionManager(this, surfaces_state_)); +} + +bool ViewManagerApp::ConfigureIncomingConnection( + ApplicationConnection* connection) { + // ViewManager + connection->AddService(this); + // GPU + connection->AddService(this); + return true; +} + +void ViewManagerApp::OnNoMoreRootConnections() { + app_impl_->Quit(); +} + +ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( + ConnectionManager* connection_manager, + mojo::InterfaceRequest tree_request, + mojo::ConnectionSpecificId creator_id, + mojo::URLRequestPtr request, + const ViewId& root_id, + uint32_t policy_bitmask) { + mojo::ViewTreeClientPtr client; + app_impl_->ConnectToService(request.Pass(), &client); + + scoped_ptr service(new ViewTreeImpl( + connection_manager, creator_id, root_id, policy_bitmask)); + return new DefaultClientConnection(service.Pass(), connection_manager, + tree_request.Pass(), client.Pass()); +} + +ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( + ConnectionManager* connection_manager, + mojo::InterfaceRequest tree_request, + mojo::ConnectionSpecificId creator_id, + const ViewId& root_id, + uint32_t policy_bitmask, + mojo::ViewTreeClientPtr client) { + scoped_ptr service(new ViewTreeImpl( + connection_manager, creator_id, root_id, policy_bitmask)); + return new DefaultClientConnection(service.Pass(), connection_manager, + tree_request.Pass(), client.Pass()); +} + +void ViewManagerApp::Create(ApplicationConnection* connection, + InterfaceRequest request) { + factory_bindings_.AddBinding(this, request.Pass()); +} + +void ViewManagerApp::Create(mojo::ApplicationConnection* connection, + mojo::InterfaceRequest request) { + if (!gpu_state_.get()) + gpu_state_ = new gles2::GpuState; + new gles2::GpuImpl(request.Pass(), gpu_state_); +} + +void ViewManagerApp::CreateViewTreeHost( + mojo::InterfaceRequest host, + mojo::ViewTreeHostClientPtr host_client, + mojo::ViewTreeClientPtr tree_client) { + DCHECK(connection_manager_.get()); + + // TODO(fsamuel): We need to make sure that only the window manager can create + // new roots. + ViewTreeHostImpl* host_impl = new ViewTreeHostImpl( + host_client.Pass(), connection_manager_.get(), is_headless_, app_impl_, + gpu_state_, surfaces_state_); + + // ViewTreeHostConnection manages its own lifetime. + host_impl->Init(new ViewTreeHostConnectionImpl( + host.Pass(), make_scoped_ptr(host_impl), tree_client.Pass(), + connection_manager_.get())); +} + +} // namespace view_manager diff --git a/components/mus/view_manager_app.h b/components/mus/view_manager_app.h new file mode 100644 index 0000000..3f65f51 --- /dev/null +++ b/components/mus/view_manager_app.h @@ -0,0 +1,105 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_MUS_VIEW_MANAGER_APP_H_ +#define COMPONENTS_MUS_VIEW_MANAGER_APP_H_ + +#include + +#include "base/memory/scoped_ptr.h" +#include "cc/surfaces/surface_manager.h" +#include "components/mus/connection_manager_delegate.h" +#include "components/mus/public/interfaces/gpu.mojom.h" +#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "mojo/application/public/cpp/app_lifetime_helper.h" +#include "mojo/application/public/cpp/application_delegate.h" +#include "mojo/application/public/cpp/interface_factory.h" +#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 view_manager { + +class ConnectionManager; + +class ViewManagerApp : public mojo::ApplicationDelegate, + public ConnectionManagerDelegate, + public mojo::InterfaceFactory, + public mojo::InterfaceFactory, + public mojo::ViewTreeHostFactory { + public: + ViewManagerApp(); + ~ViewManagerApp() override; + + private: + // ApplicationDelegate: + void Initialize(mojo::ApplicationImpl* app) override; + bool ConfigureIncomingConnection( + mojo::ApplicationConnection* connection) override; + + // ConnectionManagerDelegate: + void OnNoMoreRootConnections() override; + ClientConnection* CreateClientConnectionForEmbedAtView( + ConnectionManager* connection_manager, + mojo::InterfaceRequest tree_request, + mojo::ConnectionSpecificId creator_id, + mojo::URLRequestPtr request, + const ViewId& root_id, + uint32_t policy_bitmask) override; + ClientConnection* CreateClientConnectionForEmbedAtView( + ConnectionManager* connection_manager, + mojo::InterfaceRequest tree_request, + mojo::ConnectionSpecificId creator_id, + const ViewId& root_id, + uint32_t policy_bitmask, + mojo::ViewTreeClientPtr client) override; + + // mojo::InterfaceFactory: + void Create( + mojo::ApplicationConnection* connection, + mojo::InterfaceRequest request) override; + + // mojo::InterfaceFactory implementation. + void Create(mojo::ApplicationConnection* connection, + mojo::InterfaceRequest request) override; + + // mojo::ViewTreeHostFactory implementation. + void CreateViewTreeHost(mojo::InterfaceRequest host, + mojo::ViewTreeHostClientPtr host_client, + mojo::ViewTreeClientPtr tree_client) override; + + mojo::WeakBindingSet factory_bindings_; + mojo::ApplicationImpl* app_impl_; + scoped_ptr connection_manager_; + mojo::TracingImpl tracing_; + scoped_refptr gpu_state_; + scoped_ptr event_source_; + bool is_headless_; + + // Surfaces + scoped_refptr surfaces_state_; + + DISALLOW_COPY_AND_ASSIGN(ViewManagerApp); +}; + +} // 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 connection = + scoped_ptr 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 { public: explicit ViewTreeClientFactory(mojo::ApplicationImpl* app) : app_(app) {} ~ViewTreeClientFactory() override {} // Runs a nested MessageLoop until a new instance has been created. - scoped_ptr WaitForInstance() { + scoped_ptr WaitForInstance() { if (!client_impl_.get()) { DCHECK(!run_loop_.get()); run_loop_.reset(new base::RunLoop); @@ -407,21 +408,19 @@ class ViewTreeClientFactory : public mojo::InterfaceFactory { // InterfaceFactory: void Create(ApplicationConnection* connection, InterfaceRequest 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 client_impl_; + scoped_ptr client_impl_; scoped_ptr 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 WaitForViewTreeClient() { + scoped_ptr WaitForViewTreeClient() { return client_factory_->WaitForInstance(); } // Establishes a new connection by way of Embed() on the specified // ViewTree. - scoped_ptr + scoped_ptr EstablishConnectionViaEmbed(ViewTree* owner, Id root_id, int* connection_id) { return EstablishConnectionViaEmbedWithPolicyBitmask( owner, root_id, mojo::ViewTree::ACCESS_POLICY_DEFAULT, connection_id); } - scoped_ptr - EstablishConnectionViaEmbedWithPolicyBitmask(ViewTree* owner, - Id root_id, - uint32_t policy_bitmask, - int* connection_id) { + scoped_ptr 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 client = - client_factory_->WaitForInstance(); + scoped_ptr 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 vm_client1_; - scoped_ptr vm_client2_; - scoped_ptr vm_client3_; + scoped_ptr vm_client1_; + scoped_ptr vm_client2_; + scoped_ptr 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 connection4( + scoped_ptr 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 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 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& gpu_state, - const scoped_refptr& surfaces_state) + const scoped_refptr& gpu_state, + const scoped_refptr& 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& gpu_state, - const scoped_refptr& surfaces_state); + ViewTreeHostImpl( + mojo::ViewTreeHostClientPtr client, + ConnectionManager* connection_manager, + bool is_headless, + mojo::ApplicationImpl* app_impl, + const scoped_refptr& gpu_state, + const scoped_refptr& 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 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; - using ViewMap = std::map; + using ViewIdSet = base::hash_set; + using ViewMap = std::map; 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& callback) override; - void DeleteView(Id transport_view_id, + void DeleteView(mojo::Id transport_view_id, const mojo::Callback& callback) override; - void AddView(Id parent_id, - Id child_id, + void AddView(mojo::Id parent_id, + mojo::Id child_id, const mojo::Callback& callback) override; void RemoveViewFromParent( - Id view_id, + mojo::Id view_id, const mojo::Callback& 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& callback) override; - void GetViewTree(Id view_id, + void GetViewTree(mojo::Id view_id, const mojo::Callback)>& callback) override; - void SetViewBounds(Id view_id, + void SetViewBounds(mojo::Id view_id, mojo::RectPtr bounds, const mojo::Callback& callback) override; - void SetViewVisibility(Id view_id, + void SetViewVisibility(mojo::Id view_id, bool visible, const mojo::Callback& callback) override; - void SetViewProperty(Id view_id, + void SetViewProperty(mojo::Id view_id, const mojo::String& name, mojo::Array value, const mojo::Callback& callback) override; - void RequestSurface(Id view_id, + void RequestSurface(mojo::Id view_id, mojo::InterfaceRequest 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 access_policy_; + scoped_ptr 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 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 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& gpu_state, - const scoped_refptr& surfaces_state) override { + const scoped_refptr& gpu_state, + const scoped_refptr& 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())); + connection_manager_.reset(new ConnectionManager( + &delegate_, scoped_refptr())); ViewTreeHostImpl* host = new ViewTreeHostImpl( mojo::ViewTreeHostClientPtr(), connection_manager_.get(), - true /* is_headless */, nullptr, scoped_refptr(), - scoped_refptr()); + true /* is_headless */, nullptr, scoped_refptr(), + scoped_refptr()); // 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_ diff --git a/components/pdf_viewer/pdf_viewer.cc b/components/pdf_viewer/pdf_viewer.cc index 270ea40..9321668 100644 --- a/components/pdf_viewer/pdf_viewer.cc +++ b/components/pdf_viewer/pdf_viewer.cc @@ -58,7 +58,7 @@ void OnGotContentHandlerID(uint32_t content_handler_id) {} // BitmapUploader is useful if you want to draw a bitmap or color in a View. class BitmapUploader : public mojo::SurfaceClient { public: - explicit BitmapUploader(mus::View* view) + explicit BitmapUploader(mojo::View* view) : view_(view), color_(g_transparent_color), width_(0), @@ -67,7 +67,8 @@ class BitmapUploader : public mojo::SurfaceClient { next_resource_id_(1u), id_namespace_(0u), local_id_(0u), - returner_binding_(this) {} + returner_binding_(this) { + } ~BitmapUploader() override { MojoGLES2DestroyContext(gles2_context_); } @@ -288,9 +289,9 @@ class BitmapUploader : public mojo::SurfaceClient { } } - mus::View* view_; + mojo::View* view_; mojo::GpuPtr gpu_service_; - scoped_ptr surface_; + scoped_ptr surface_; MojoGLES2Context gles2_context_; mojo::Size size_; @@ -310,7 +311,7 @@ class BitmapUploader : public mojo::SurfaceClient { class EmbedderData { public: - EmbedderData(mojo::Shell* shell, mus::View* root) : bitmap_uploader_(root) { + EmbedderData(mojo::Shell* shell, mojo::View* root) : bitmap_uploader_(root) { bitmap_uploader_.Init(shell); bitmap_uploader_.SetColor(g_background_color); } @@ -324,8 +325,8 @@ class EmbedderData { }; class PDFView : public mojo::ApplicationDelegate, - public mus::ViewTreeDelegate, - public mus::ViewObserver, + public mojo::ViewTreeDelegate, + public mojo::ViewObserver, public mojo::InterfaceFactory { public: PDFView(mojo::InterfaceRequest request, @@ -354,7 +355,7 @@ class PDFView : public mojo::ApplicationDelegate, } // Overridden from ViewTreeDelegate: - void OnEmbed(mus::View* root) override { + void OnEmbed(mojo::View* root) override { DCHECK(embedder_for_roots_.find(root) == embedder_for_roots_.end()); root->AddObserver(this); EmbedderData* embedder_data = new EmbedderData(app_.shell(), root); @@ -362,17 +363,18 @@ class PDFView : public mojo::ApplicationDelegate, DrawBitmap(embedder_data); } - void OnConnectionLost(mus::ViewTreeConnection* connection) override {} + void OnConnectionLost(mojo::ViewTreeConnection* connection) override {} // Overridden from ViewObserver: - void OnViewBoundsChanged(mus::View* view, + void OnViewBoundsChanged(mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) override { DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); DrawBitmap(embedder_for_roots_[view]); } - void OnViewInputEvent(mus::View* view, const mojo::EventPtr& event) override { + void OnViewInputEvent(mojo::View* view, + const mojo::EventPtr& event) override { DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); if (event->key_data && (event->action != mojo::EVENT_TYPE_KEY_PRESSED || @@ -401,7 +403,7 @@ class PDFView : public mojo::ApplicationDelegate, } } - void OnViewDestroyed(mus::View* view) override { + void OnViewDestroyed(mojo::View* view) override { DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); const auto& it = embedder_for_roots_.find(view); DCHECK(it != embedder_for_roots_.end()); @@ -415,7 +417,7 @@ class PDFView : public mojo::ApplicationDelegate, void Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest request) override { - mus::ViewTreeConnection::Create(this, request.Pass()); + mojo::ViewTreeConnection::Create(this, request.Pass()); } void DrawBitmap(EmbedderData* embedder_data) { @@ -464,7 +466,7 @@ class PDFView : public mojo::ApplicationDelegate, int current_page_; int page_count_; FPDF_DOCUMENT doc_; - std::map embedder_for_roots_; + std::map embedder_for_roots_; DISALLOW_COPY_AND_ASSIGN(PDFView); }; diff --git a/components/web_view/frame.cc b/components/web_view/frame.cc index 1097388..5f30640 100644 --- a/components/web_view/frame.cc +++ b/components/web_view/frame.cc @@ -18,7 +18,7 @@ #include "components/web_view/frame_utils.h" #include "mojo/application/public/interfaces/shell.mojom.h" -using mus::View; +using mojo::View; DECLARE_VIEW_PROPERTY_TYPE(web_view::Frame*); @@ -30,7 +30,7 @@ DEFINE_LOCAL_VIEW_PROPERTY_KEY(Frame*, kFrame, nullptr); namespace { const uint32_t kNoParentId = 0u; -const mus::ConnectionSpecificId kInvalidConnectionId = 0u; +const mojo::ConnectionSpecificId kInvalidConnectionId = 0u; FrameDataPtr FrameToFrameData(const Frame* frame) { FrameDataPtr frame_data(FrameData::New()); @@ -219,12 +219,12 @@ void Frame::ChangeClient(FrameTreeClient* frame_tree_client, view_tree_client.Pass()); } -void Frame::OnEmbedAck(bool success, mus::ConnectionSpecificId connection_id) { +void Frame::OnEmbedAck(bool success, mojo::ConnectionSpecificId connection_id) { if (success) embedded_connection_id_ = connection_id; } -void Frame::SetView(mus::View* view) { +void Frame::SetView(mojo::View* view) { DCHECK(!view_); DCHECK_EQ(id_, view->id()); view_ = view; @@ -407,7 +407,7 @@ void Frame::OnTreeChanged(const TreeChangeParams& params) { } } -void Frame::OnViewDestroying(mus::View* view) { +void Frame::OnViewDestroying(mojo::View* view) { if (parent_) parent_->Remove(this); @@ -424,7 +424,7 @@ void Frame::OnViewDestroying(mus::View* view) { delete this; } -void Frame::OnViewEmbeddedAppDisconnected(mus::View* view) { +void Frame::OnViewEmbeddedAppDisconnected(mojo::View* view) { // See FrameTreeDelegate::OnViewEmbeddedAppDisconnected() for details of when // this happens. // diff --git a/components/web_view/frame.h b/components/web_view/frame.h index 2951562..fbf4a78 100644 --- a/components/web_view/frame.h +++ b/components/web_view/frame.h @@ -49,12 +49,12 @@ enum class ViewOwnership { // by the argument |reuse_existing_view| supplied to OnConnect(). Typically the // id is that of content handler id, but this is left up to the // FrameTreeDelegate to decide. -class Frame : public mus::ViewObserver, public FrameTreeServer { +class Frame : public mojo::ViewObserver, public FrameTreeServer { public: using ClientPropertyMap = std::map>; Frame(FrameTree* tree, - mus::View* view, + mojo::View* view, uint32_t frame_id, uint32_t app_id, ViewOwnership view_ownership, @@ -69,15 +69,15 @@ class Frame : public mus::ViewObserver, public FrameTreeServer { // Frame that is associated with |view|. For example, if |view| // has a Frame associated with it, then that is returned. Otherwise // this checks view->parent() and so on. - static Frame* FindFirstFrameAncestor(mus::View* view); + static Frame* FindFirstFrameAncestor(mojo::View* view); FrameTree* tree() { return tree_; } Frame* parent() { return parent_; } const Frame* parent() const { return parent_; } - mus::View* view() { return view_; } - const mus::View* view() const { return view_; } + mojo::View* view() { return view_; } + const mojo::View* view() const { return view_; } uint32_t id() const { return id_; } @@ -137,7 +137,7 @@ class Frame : public mus::ViewObserver, public FrameTreeServer { scoped_ptr frame_tree_server_binding); // Callback from OnEmbed(). - void OnEmbedAck(bool success, mus::ConnectionSpecificId connection_id); + void OnEmbedAck(bool success, mojo::ConnectionSpecificId connection_id); // Completes a navigation request; swapping the existing FrameTreeClient to // the supplied arguments. @@ -146,7 +146,7 @@ class Frame : public mus::ViewObserver, public FrameTreeServer { mojo::ViewTreeClientPtr view_tree_client, uint32 app_id); - void SetView(mus::View* view); + void SetView(mojo::View* view); // Returns the first ancestor (starting at |this|) that has a // FrameTreeClient. @@ -192,10 +192,10 @@ class Frame : public mus::ViewObserver, public FrameTreeServer { const mojo::String& name, const mojo::Array& value); - // mus::ViewObserver: + // mojo::ViewObserver: void OnTreeChanged(const TreeChangeParams& params) override; - void OnViewDestroying(mus::View* view) override; - void OnViewEmbeddedAppDisconnected(mus::View* view) override; + void OnViewDestroying(mojo::View* view) override; + void OnViewEmbeddedAppDisconnected(mojo::View* view) override; // FrameTreeServer: void PostMessageEventToFrame(uint32_t source_frame_id, @@ -219,10 +219,10 @@ class Frame : public mus::ViewObserver, public FrameTreeServer { FrameTree* const tree_; // WARNING: this may be null. See class description for details. - mus::View* view_; + mojo::View* view_; // The connection id returned from ViewManager::Embed(). Frames created by // way of OnCreatedFrame() inherit the id from the parent. - mus::ConnectionSpecificId embedded_connection_id_; + mojo::ConnectionSpecificId embedded_connection_id_; // ID for the frame, which is the same as that of the view. const uint32_t id_; // ID of the app providing the FrameTreeClient and ViewTreeClient. diff --git a/components/web_view/frame_apptest.cc b/components/web_view/frame_apptest.cc index 99fb2e2..2526bd8 100644 --- a/components/web_view/frame_apptest.cc +++ b/components/web_view/frame_apptest.cc @@ -26,8 +26,8 @@ #include "mojo/application/public/cpp/application_test_base.h" #include "mojo/application/public/cpp/service_provider_impl.h" -using mus::View; -using mus::ViewTreeConnection; +using mojo::View; +using mojo::ViewTreeConnection; namespace web_view { @@ -141,7 +141,7 @@ class FrameTest; // a single FrameTreeClient. In other words this maintains the data structures // needed to represent a client side frame. To obtain one use // FrameTest::WaitForViewAndFrame(). -class ViewAndFrame : public mus::ViewTreeDelegate { +class ViewAndFrame : public mojo::ViewTreeDelegate { public: ~ViewAndFrame() override { if (view_) @@ -149,7 +149,7 @@ class ViewAndFrame : public mus::ViewTreeDelegate { } // The View associated with the frame. - mus::View* view() { return view_; } + mojo::View* view() { return view_; } TestFrameTreeClient* test_frame_tree_client() { return &test_frame_tree_client_; } @@ -189,7 +189,7 @@ class ViewAndFrame : public mus::ViewTreeDelegate { view_ = nullptr; } - mus::View* view_; + mojo::View* view_; base::RunLoop run_loop_; TestFrameTreeClient test_frame_tree_client_; mojo::Binding frame_tree_binding_; @@ -199,7 +199,7 @@ class ViewAndFrame : public mus::ViewTreeDelegate { class FrameTest : public mojo::test::ApplicationTestBase, public mojo::ApplicationDelegate, - public mus::ViewTreeDelegate, + public mojo::ViewTreeDelegate, public mojo::InterfaceFactory, public mojo::InterfaceFactory { public: @@ -223,7 +223,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, // Creates a new shared frame as a child of |parent|. Frame* CreateSharedFrame(ViewAndFrame* parent) { - mus::View* child_frame_view = parent->view()->connection()->CreateView(); + mojo::View* child_frame_view = parent->view()->connection()->CreateView(); parent->view()->AddChild(child_frame_view); mojo::Map> client_properties; client_properties.mark_non_null(); @@ -281,7 +281,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, void SetUp() override { ApplicationTestBase::SetUp(); - mus::CreateSingleViewTreeHost(application_impl(), this, &host_); + mojo::CreateSingleViewTreeHost(application_impl(), this, &host_); ASSERT_TRUE(DoRunLoopWithTimeout()); std::swap(window_manager_, most_recent_connection_); @@ -294,7 +294,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, FrameTreeClient* frame_tree_client = frame_connection->frame_tree_client(); mojo::ViewTreeClientPtr view_tree_client = frame_connection->GetViewTreeClient(); - mus::View* frame_root_view = window_manager()->CreateView(); + mojo::View* frame_root_view = window_manager()->CreateView(); window_manager()->GetRoot()->AddChild(frame_root_view); frame_tree_.reset( new FrameTree(0u, frame_root_view, view_tree_client.Pass(), @@ -316,9 +316,9 @@ class FrameTest : public mojo::test::ApplicationTestBase, mojo::ApplicationConnection* connection, mojo::InterfaceRequest request) override { if (view_and_frame_) { - mus::ViewTreeConnection::Create(view_and_frame_.get(), request.Pass()); + mojo::ViewTreeConnection::Create(view_and_frame_.get(), request.Pass()); } else { - mus::ViewTreeConnection::Create(this, request.Pass()); + mojo::ViewTreeConnection::Create(this, request.Pass()); } } diff --git a/components/web_view/frame_tree.cc b/components/web_view/frame_tree.cc index c82ebfb..eee41c1 100644 --- a/components/web_view/frame_tree.cc +++ b/components/web_view/frame_tree.cc @@ -10,7 +10,7 @@ namespace web_view { FrameTree::FrameTree(uint32_t root_app_id, - mus::View* view, + mojo::View* view, mojo::ViewTreeClientPtr view_tree_client, FrameTreeDelegate* delegate, FrameTreeClient* root_client, @@ -43,7 +43,7 @@ Frame* FrameTree::CreateSharedFrame( uint32_t frame_id, uint32_t app_id, const Frame::ClientPropertyMap& client_properties) { - mus::View* frame_view = root_->view()->GetChildById(frame_id); + mojo::View* frame_view = root_->view()->GetChildById(frame_id); // |frame_view| may be null if the View hasn't been created yet. If this is // the case the View will be connected to the Frame in Frame::OnTreeChanged. Frame* frame = diff --git a/components/web_view/frame_tree.h b/components/web_view/frame_tree.h index 64595c8..ad457d9 100644 --- a/components/web_view/frame_tree.h +++ b/components/web_view/frame_tree.h @@ -32,7 +32,7 @@ class FrameTree { // |root_app_id| is a unique identifier of the app providing |root_client|. // See Frame for details on app id's. FrameTree(uint32_t root_app_id, - mus::View* view, + mojo::View* view, mojo::ViewTreeClientPtr view_tree_client, FrameTreeDelegate* delegate, FrameTreeClient* root_client, @@ -66,7 +66,7 @@ class FrameTree { const mojo::String& name, const mojo::Array& value); - mus::View* view_; + mojo::View* view_; FrameTreeDelegate* delegate_; diff --git a/components/web_view/frame_tree_delegate.h b/components/web_view/frame_tree_delegate.h index 4b8afd7..123679f 100644 --- a/components/web_view/frame_tree_delegate.h +++ b/components/web_view/frame_tree_delegate.h @@ -51,7 +51,7 @@ class FrameTreeDelegate { // Asks the client if navigation is allowed. If the navigation is allowed // |callback| should be called to continue the navigation. |callback| // may be called synchronously or asynchronously. In the callback - // mojo::ViewTreeClientPtr should only be set if an app other than + // ViewTreeClientPtr should only be set if an app other than // frame->app_id() is used to render |request|. virtual void CanNavigateFrame(Frame* target, mojo::URLRequestPtr request, diff --git a/components/web_view/public/cpp/web_view.cc b/components/web_view/public/cpp/web_view.cc index d2ae310..5db2379 100644 --- a/components/web_view/public/cpp/web_view.cc +++ b/components/web_view/public/cpp/web_view.cc @@ -20,7 +20,7 @@ void OnEmbed(bool success, uint16 connection_id) { WebView::WebView(mojom::WebViewClient* client) : binding_(client) {} WebView::~WebView() {} -void WebView::Init(mojo::ApplicationImpl* app, mus::View* view) { +void WebView::Init(mojo::ApplicationImpl* app, mojo::View* view) { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = "mojo:web_view"; diff --git a/components/web_view/public/cpp/web_view.h b/components/web_view/public/cpp/web_view.h index b10c0d3..d3abc5a 100644 --- a/components/web_view/public/cpp/web_view.h +++ b/components/web_view/public/cpp/web_view.h @@ -12,9 +12,6 @@ namespace mojo { class ApplicationImpl; -} - -namespace mus { class View; } @@ -25,7 +22,7 @@ class WebView { explicit WebView(mojom::WebViewClient* client); ~WebView(); - void Init(mojo::ApplicationImpl* app, mus::View* view); + void Init(mojo::ApplicationImpl* app, mojo::View* view); mojom::WebView* web_view() { return web_view_.get(); } diff --git a/components/web_view/test_runner/test_runner_application_delegate.cc b/components/web_view/test_runner/test_runner_application_delegate.cc index 7a39632..6442077 100644 --- a/components/web_view/test_runner/test_runner_application_delegate.cc +++ b/components/web_view/test_runner/test_runner_application_delegate.cc @@ -39,7 +39,7 @@ TestRunnerApplicationDelegate::TestRunnerApplicationDelegate() TestRunnerApplicationDelegate::~TestRunnerApplicationDelegate() { if (root_) - mus::ScopedViewPtr::DeleteViewOrViewManager(root_); + mojo::ScopedViewPtr::DeleteViewOrViewManager(root_); } void TestRunnerApplicationDelegate::LaunchURL(const GURL& test_url) { @@ -54,7 +54,7 @@ void TestRunnerApplicationDelegate::LaunchURL(const GURL& test_url) { void TestRunnerApplicationDelegate::Terminate() { if (root_) - mus::ScopedViewPtr::DeleteViewOrViewManager(root_); + mojo::ScopedViewPtr::DeleteViewOrViewManager(root_); } //////////////////////////////////////////////////////////////////////////////// @@ -62,7 +62,7 @@ void TestRunnerApplicationDelegate::Terminate() { void TestRunnerApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { app_ = app; - mus::CreateSingleViewTreeHost(app_, this, &host_); + mojo::CreateSingleViewTreeHost(app_, this, &host_); } bool TestRunnerApplicationDelegate::ConfigureIncomingConnection( @@ -72,9 +72,9 @@ bool TestRunnerApplicationDelegate::ConfigureIncomingConnection( } //////////////////////////////////////////////////////////////////////////////// -// mus::ViewTreeDelegate implementation: +// mojo::ViewTreeDelegate implementation: -void TestRunnerApplicationDelegate::OnEmbed(mus::View* root) { +void TestRunnerApplicationDelegate::OnEmbed(mojo::View* root) { root_ = root; // If this is a sys-check, then terminate in the next cycle. @@ -107,7 +107,7 @@ void TestRunnerApplicationDelegate::OnEmbed(mus::View* root) { } void TestRunnerApplicationDelegate::OnConnectionLost( - mus::ViewTreeConnection* connection) { + mojo::ViewTreeConnection* connection) { root_ = nullptr; app_->Quit(); } diff --git a/components/web_view/test_runner/test_runner_application_delegate.h b/components/web_view/test_runner/test_runner_application_delegate.h index 6addcae..0e283be 100644 --- a/components/web_view/test_runner/test_runner_application_delegate.h +++ b/components/web_view/test_runner/test_runner_application_delegate.h @@ -27,7 +27,7 @@ namespace web_view { class TestRunnerApplicationDelegate : public mojo::ApplicationDelegate, - public mus::ViewTreeDelegate, + public mojo::ViewTreeDelegate, public mojom::WebViewClient, public LayoutTestRunner, public mojo::InterfaceFactory { @@ -44,9 +44,9 @@ class TestRunnerApplicationDelegate bool ConfigureIncomingConnection( mojo::ApplicationConnection* connection) override; - // mus::ViewTreeDelegate: - void OnEmbed(mus::View* root) override; - void OnConnectionLost(mus::ViewTreeConnection* connection) override; + // mojo::ViewTreeDelegate: + void OnEmbed(mojo::View* root) override; + void OnConnectionLost(mojo::ViewTreeConnection* connection) override; // mojom::WebViewClient: void TopLevelNavigate(mojo::URLRequestPtr request) override; @@ -66,8 +66,8 @@ class TestRunnerApplicationDelegate mojo::ApplicationImpl* app_; mojo::ViewTreeHostPtr host_; - mus::View* root_; - mus::View* content_; + mojo::View* root_; + mojo::View* content_; scoped_ptr web_view_; scoped_ptr test_extractor_; diff --git a/components/web_view/web_view_apptest.cc b/components/web_view/web_view_apptest.cc index 400f6ff..440d80c 100644 --- a/components/web_view/web_view_apptest.cc +++ b/components/web_view/web_view_apptest.cc @@ -28,7 +28,7 @@ const char kTestThreeFile[] = "test_three.html"; const char kTestThreeTitle[] = "Test Title Three"; } -class WebViewTest : public mus::ViewManagerTestBase, +class WebViewTest : public mojo::ViewManagerTestBase, public mojom::WebViewClient { public: WebViewTest() : web_view_(this) {} @@ -75,7 +75,7 @@ class WebViewTest : public mus::ViewManagerTestBase, } // Overridden from ViewTreeDelegate: - void OnEmbed(mus::View* root) override { + void OnEmbed(mojo::View* root) override { content_ = root->connection()->CreateView(); root->AddChild(content_); content_->SetVisible(true); @@ -86,7 +86,7 @@ class WebViewTest : public mus::ViewManagerTestBase, } void TearDown() override { - mus::ScopedViewPtr::DeleteViewOrViewManager(window_manager()->GetRoot()); + mojo::ScopedViewPtr::DeleteViewOrViewManager(window_manager()->GetRoot()); ViewManagerTestBase::TearDown(); } @@ -108,7 +108,7 @@ class WebViewTest : public mus::ViewManagerTestBase, mojo::ApplicationImpl* app_; - mus::View* content_; + mojo::View* content_; web_view::WebView web_view_; diff --git a/components/web_view/web_view_impl.cc b/components/web_view/web_view_impl.cc index 908fe7c..21eeabe 100644 --- a/components/web_view/web_view_impl.cc +++ b/components/web_view/web_view_impl.cc @@ -51,7 +51,7 @@ WebViewImpl::~WebViewImpl() { content_->RemoveObserver(this); if (root_) { root_->RemoveObserver(this); - mus::ScopedViewPtr::DeleteViewOrViewManager(root_); + mojo::ScopedViewPtr::DeleteViewOrViewManager(root_); } } @@ -109,7 +109,7 @@ void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) { void WebViewImpl::GetViewTreeClient( mojo::InterfaceRequest view_tree_client) { - mus::ViewTreeConnection::Create(this, view_tree_client.Pass()); + mojo::ViewTreeConnection::Create(this, view_tree_client.Pass()); } void WebViewImpl::GoBack() { @@ -138,9 +138,9 @@ void WebViewImpl::GoForward() { } //////////////////////////////////////////////////////////////////////////////// -// WebViewImpl, mus::ViewTreeDelegate implementation: +// WebViewImpl, mojo::ViewTreeDelegate implementation: -void WebViewImpl::OnEmbed(mus::View* root) { +void WebViewImpl::OnEmbed(mojo::View* root) { // We must have been granted embed root priviledges, otherwise we can't // Embed() in any descendants. DCHECK(root->connection()->IsEmbedRoot()); @@ -157,14 +157,14 @@ void WebViewImpl::OnEmbed(mus::View* root) { OnLoad(); } -void WebViewImpl::OnConnectionLost(mus::ViewTreeConnection* connection) { +void WebViewImpl::OnConnectionLost(mojo::ViewTreeConnection* connection) { root_ = nullptr; } //////////////////////////////////////////////////////////////////////////////// -// WebViewImpl, mus::ViewObserver implementation: +// WebViewImpl, mojo::ViewObserver implementation: -void WebViewImpl::OnViewBoundsChanged(mus::View* view, +void WebViewImpl::OnViewBoundsChanged(mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) { if (view != content_) { @@ -175,7 +175,7 @@ void WebViewImpl::OnViewBoundsChanged(mus::View* view, } } -void WebViewImpl::OnViewDestroyed(mus::View* view) { +void WebViewImpl::OnViewDestroyed(mojo::View* view) { // |FrameTree| cannot outlive the content view. if (view == content_) { frame_tree_.reset(); diff --git a/components/web_view/web_view_impl.h b/components/web_view/web_view_impl.h index fdde32a..b706f94 100644 --- a/components/web_view/web_view_impl.h +++ b/components/web_view/web_view_impl.h @@ -29,8 +29,8 @@ class PendingWebViewLoad; class URLRequestCloneable; class WebViewImpl : public mojom::WebView, - public mus::ViewTreeDelegate, - public mus::ViewObserver, + public mojo::ViewTreeDelegate, + public mojo::ViewObserver, public FrameTreeDelegate, public FrameDevToolsAgentDelegate { public: @@ -58,15 +58,15 @@ class WebViewImpl : public mojom::WebView, void GoBack() override; void GoForward() override; - // Overridden from mus::ViewTreeDelegate: - void OnEmbed(mus::View* root) override; - void OnConnectionLost(mus::ViewTreeConnection* connection) override; + // Overridden from mojo::ViewTreeDelegate: + void OnEmbed(mojo::View* root) override; + void OnConnectionLost(mojo::ViewTreeConnection* connection) override; - // Overridden from mus::ViewObserver: - void OnViewBoundsChanged(mus::View* view, + // Overridden from mojo::ViewObserver: + void OnViewBoundsChanged(mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) override; - void OnViewDestroyed(mus::View* view) override; + void OnViewDestroyed(mojo::View* view) override; // Overridden from FrameTreeDelegate: bool CanPostMessageEventToFrame(const Frame* source, @@ -87,8 +87,8 @@ class WebViewImpl : public mojom::WebView, mojo::ApplicationImpl* app_; mojom::WebViewClientPtr client_; mojo::StrongBinding binding_; - mus::View* root_; - mus::View* content_; + mojo::View* root_; + mojo::View* content_; scoped_ptr frame_tree_; // When LoadRequest() is called a PendingWebViewLoad is created to wait for diff --git a/mandoline/services/core_services/application_delegate_factory_notandroid.cc b/mandoline/services/core_services/application_delegate_factory_notandroid.cc index 6756c99..3b98097 100644 --- a/mandoline/services/core_services/application_delegate_factory_notandroid.cc +++ b/mandoline/services/core_services/application_delegate_factory_notandroid.cc @@ -4,7 +4,7 @@ #include "mandoline/services/core_services/application_delegate_factory.h" -#include "components/mus/mus_app.h" +#include "components/mus/view_manager_app.h" #include "components/resource_provider/resource_provider_app.h" #include "mojo/services/network/network_service_delegate.h" @@ -19,7 +19,7 @@ scoped_ptr CreateApplicationDelegateNotAndroid( new resource_provider::ResourceProviderApp("mojo:core_services")); } if (url == "mojo://mus/") - return make_scoped_ptr(new mus::MandolineUIServicesApp); + return make_scoped_ptr(new view_manager::ViewManagerApp); return nullptr; } diff --git a/mandoline/ui/aura/aura_init.cc b/mandoline/ui/aura/aura_init.cc index 26f7619..5d709bf 100644 --- a/mandoline/ui/aura/aura_init.cc +++ b/mandoline/ui/aura/aura_init.cc @@ -37,7 +37,7 @@ std::set GetResourcePaths() { // TODO(sky): the 1.f should be view->viewport_metrics().device_scale_factor, // but that causes clipping problems. No doubt we're not scaling a size // correctly. -AuraInit::AuraInit(mus::View* view, mojo::Shell* shell) +AuraInit::AuraInit(mojo::View* view, mojo::Shell* shell) : ui_init_(view->viewport_metrics().size_in_pixels.To(), 1.f) { aura::Env::CreateInstance(false); diff --git a/mandoline/ui/aura/aura_init.h b/mandoline/ui/aura/aura_init.h index 505adb4..69f1e3f 100644 --- a/mandoline/ui/aura/aura_init.h +++ b/mandoline/ui/aura/aura_init.h @@ -14,9 +14,6 @@ class FontLoader; namespace mojo { class Shell; -} - -namespace mus { class View; } @@ -25,7 +22,7 @@ namespace mandoline { // Sets up necessary state for aura when run with the viewmanager. class AuraInit { public: - AuraInit(mus::View* root, mojo::Shell* shell); + AuraInit(mojo::View* root, mojo::Shell* shell); ~AuraInit(); private: diff --git a/mandoline/ui/aura/input_method_mandoline.cc b/mandoline/ui/aura/input_method_mandoline.cc index 6e7925c..747d1b5 100644 --- a/mandoline/ui/aura/input_method_mandoline.cc +++ b/mandoline/ui/aura/input_method_mandoline.cc @@ -17,7 +17,7 @@ namespace mandoline { InputMethodMandoline::InputMethodMandoline( ui::internal::InputMethodDelegate* delegate, - mus::View* view) + mojo::View* view) : view_(view) { SetDelegate(delegate); } diff --git a/mandoline/ui/aura/input_method_mandoline.h b/mandoline/ui/aura/input_method_mandoline.h index 40a35a4e..1d90959 100644 --- a/mandoline/ui/aura/input_method_mandoline.h +++ b/mandoline/ui/aura/input_method_mandoline.h @@ -7,7 +7,7 @@ #ifndef MANDOLINE_UI_AURA_INPUT_METHOD_MANDOLINE_H_ #define MANDOLINE_UI_AURA_INPUT_METHOD_MANDOLINE_H_ -namespace mus { +namespace mojo { class View; } // namespace mojo @@ -16,7 +16,7 @@ namespace mandoline { class InputMethodMandoline : public ui::InputMethodBase { public: InputMethodMandoline(ui::internal::InputMethodDelegate* delegate, - mus::View* view); + mojo::View* view); ~InputMethodMandoline() override; private: @@ -40,7 +40,7 @@ class InputMethodMandoline : public ui::InputMethodBase { void UpdateTextInputType(); // The toplevel view which is not owned by this class. - mus::View* view_; + mojo::View* view_; DISALLOW_COPY_AND_ASSIGN(InputMethodMandoline); }; diff --git a/mandoline/ui/aura/native_widget_view_manager.cc b/mandoline/ui/aura/native_widget_view_manager.cc index ba86371..1665d18 100644 --- a/mandoline/ui/aura/native_widget_view_manager.cc +++ b/mandoline/ui/aura/native_widget_view_manager.cc @@ -38,7 +38,7 @@ class FocusRulesImpl : public wm::BaseFocusRules { NativeWidgetViewManager::NativeWidgetViewManager( views::internal::NativeWidgetDelegate* delegate, mojo::Shell* shell, - mus::View* view) + mojo::View* view) : NativeWidgetAura(delegate), view_(view) { view_->AddObserver(this); window_tree_host_.reset(new WindowTreeHostMojo(shell, view_)); @@ -76,7 +76,7 @@ void NativeWidgetViewManager::OnWindowVisibilityChanged(aura::Window* window, // I'm not bothering. } -void NativeWidgetViewManager::OnViewDestroyed(mus::View* view) { +void NativeWidgetViewManager::OnViewDestroyed(mojo::View* view) { DCHECK_EQ(view, view_); view->RemoveObserver(this); view_ = NULL; @@ -85,22 +85,22 @@ void NativeWidgetViewManager::OnViewDestroyed(mus::View* view) { } void NativeWidgetViewManager::OnViewBoundsChanged( - mus::View* view, + mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) { gfx::Rect view_rect = view->bounds().To(); GetWidget()->SetBounds(gfx::Rect(view_rect.size())); } -void NativeWidgetViewManager::OnViewFocusChanged(mus::View* gained_focus, - mus::View* lost_focus) { +void NativeWidgetViewManager::OnViewFocusChanged(mojo::View* gained_focus, + mojo::View* lost_focus) { if (gained_focus == view_) window_tree_host_->GetInputMethod()->OnFocus(); else if (lost_focus == view_) window_tree_host_->GetInputMethod()->OnBlur(); } -void NativeWidgetViewManager::OnViewInputEvent(mus::View* view, +void NativeWidgetViewManager::OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) { scoped_ptr ui_event(event.To>()); if (!ui_event) diff --git a/mandoline/ui/aura/native_widget_view_manager.h b/mandoline/ui/aura/native_widget_view_manager.h index 22cce85..83fb556a 100644 --- a/mandoline/ui/aura/native_widget_view_manager.h +++ b/mandoline/ui/aura/native_widget_view_manager.h @@ -33,11 +33,11 @@ namespace mandoline { class WindowTreeHostMojo; class NativeWidgetViewManager : public views::NativeWidgetAura, - public mus::ViewObserver { + public mojo::ViewObserver { public: NativeWidgetViewManager(views::internal::NativeWidgetDelegate* delegate, mojo::Shell* shell, - mus::View* view); + mojo::View* view); ~NativeWidgetViewManager() override; private: @@ -46,19 +46,19 @@ class NativeWidgetViewManager : public views::NativeWidgetAura, void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; // ViewObserver: - void OnViewDestroyed(mus::View* view) override; - void OnViewBoundsChanged(mus::View* view, + void OnViewDestroyed(mojo::View* view) override; + void OnViewBoundsChanged(mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) override; - void OnViewFocusChanged(mus::View* gained_focus, - mus::View* lost_focus) override; - void OnViewInputEvent(mus::View* view, const mojo::EventPtr& event) override; + void OnViewFocusChanged(mojo::View* gained_focus, + mojo::View* lost_focus) override; + void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; scoped_ptr window_tree_host_; scoped_ptr focus_client_; - mus::View* view_; + mojo::View* view_; scoped_ptr capture_client_; diff --git a/mandoline/ui/aura/surface_binding.cc b/mandoline/ui/aura/surface_binding.cc index 8048373..df2299e 100644 --- a/mandoline/ui/aura/surface_binding.cc +++ b/mandoline/ui/aura/surface_binding.cc @@ -42,17 +42,17 @@ class SurfaceBinding::PerConnectionState : public base::RefCounted { public: static PerConnectionState* Get(mojo::Shell* shell, - mus::ViewTreeConnection* connection); + mojo::ViewTreeConnection* connection); - scoped_ptr CreateOutputSurface(mus::View* view); + scoped_ptr CreateOutputSurface(mojo::View* view); private: - typedef std::map - ConnectionToStateMap; + typedef std::map ConnectionToStateMap; friend class base::RefCounted; - PerConnectionState(mojo::Shell* shell, mus::ViewTreeConnection* connection); + PerConnectionState(mojo::Shell* shell, mojo::ViewTreeConnection* connection); ~PerConnectionState(); void Init(); @@ -61,7 +61,7 @@ class SurfaceBinding::PerConnectionState base::ThreadLocalPointer>::Leaky view_states; mojo::Shell* shell_; - mus::ViewTreeConnection* connection_; + mojo::ViewTreeConnection* connection_; // Set of state needed to create an OutputSurface. mojo::GpuPtr gpu_; @@ -77,7 +77,7 @@ base::LazyInstanceGet(); if (!view_map) { view_map = new ConnectionToStateMap; @@ -91,7 +91,7 @@ SurfaceBinding::PerConnectionState* SurfaceBinding::PerConnectionState::Get( } scoped_ptr -SurfaceBinding::PerConnectionState::CreateOutputSurface(mus::View* view) { +SurfaceBinding::PerConnectionState::CreateOutputSurface(mojo::View* view) { // TODO(sky): figure out lifetime here. Do I need to worry about the return // value outliving this? mojo::CommandBufferPtr cb; @@ -105,8 +105,9 @@ SurfaceBinding::PerConnectionState::CreateOutputSurface(mus::View* view) { SurfaceBinding::PerConnectionState::PerConnectionState( mojo::Shell* shell, - mus::ViewTreeConnection* connection) - : shell_(shell) {} + mojo::ViewTreeConnection* connection) + : shell_(shell) { +} SurfaceBinding::PerConnectionState::~PerConnectionState() { ConnectionToStateMap* view_map = view_states.Pointer()->Get(); @@ -131,8 +132,10 @@ void SurfaceBinding::PerConnectionState::Init() { // SurfaceBinding -------------------------------------------------------------- -SurfaceBinding::SurfaceBinding(mojo::Shell* shell, mus::View* view) - : view_(view), state_(PerConnectionState::Get(shell, view->connection())) {} +SurfaceBinding::SurfaceBinding(mojo::Shell* shell, mojo::View* view) + : view_(view), + state_(PerConnectionState::Get(shell, view->connection())) { +} SurfaceBinding::~SurfaceBinding() { } diff --git a/mandoline/ui/aura/surface_binding.h b/mandoline/ui/aura/surface_binding.h index 840eeba..f36002d 100644 --- a/mandoline/ui/aura/surface_binding.h +++ b/mandoline/ui/aura/surface_binding.h @@ -14,9 +14,6 @@ class OutputSurface; namespace mojo { class Shell; -} - -namespace mus { class View; } @@ -29,7 +26,7 @@ namespace mandoline { // share the same connection. class SurfaceBinding { public: - SurfaceBinding(mojo::Shell* shell, mus::View* view); + SurfaceBinding(mojo::Shell* shell, mojo::View* view); ~SurfaceBinding(); // Creates an OutputSurface that renders to the View supplied to the @@ -40,7 +37,7 @@ class SurfaceBinding { class PerConnectionState; mojo::Shell* shell_; - mus::View* view_; + mojo::View* view_; scoped_refptr state_; DISALLOW_COPY_AND_ASSIGN(SurfaceBinding); diff --git a/mandoline/ui/aura/surface_context_factory.cc b/mandoline/ui/aura/surface_context_factory.cc index 0a75487..1f1589d 100644 --- a/mandoline/ui/aura/surface_context_factory.cc +++ b/mandoline/ui/aura/surface_context_factory.cc @@ -27,8 +27,10 @@ class FakeReflector : public ui::Reflector { } SurfaceContextFactory::SurfaceContextFactory(mojo::Shell* shell, - mus::View* view) - : surface_binding_(shell, view), next_surface_id_namespace_(1u) {} + mojo::View* view) + : surface_binding_(shell, view), + next_surface_id_namespace_(1u) { +} SurfaceContextFactory::~SurfaceContextFactory() { } diff --git a/mandoline/ui/aura/surface_context_factory.h b/mandoline/ui/aura/surface_context_factory.h index dd859eb..92d4d25 100644 --- a/mandoline/ui/aura/surface_context_factory.h +++ b/mandoline/ui/aura/surface_context_factory.h @@ -12,9 +12,6 @@ namespace mojo { class Shell; -} - -namespace mus { class View; } @@ -22,7 +19,7 @@ namespace mandoline { class SurfaceContextFactory : public ui::ContextFactory { public: - SurfaceContextFactory(mojo::Shell* shell, mus::View* view); + SurfaceContextFactory(mojo::Shell* shell, mojo::View* view); ~SurfaceContextFactory() override; private: @@ -47,7 +44,7 @@ class SurfaceContextFactory : public ui::ContextFactory { SurfaceBinding surface_binding_; uint32_t next_surface_id_namespace_; gles2::RasterThreadHelper raster_thread_helper_; - mus::MojoGpuMemoryBufferManager gpu_memory_buffer_manager_; + gles2::MojoGpuMemoryBufferManager gpu_memory_buffer_manager_; DISALLOW_COPY_AND_ASSIGN(SurfaceContextFactory); }; diff --git a/mandoline/ui/aura/window_tree_host_mojo.cc b/mandoline/ui/aura/window_tree_host_mojo.cc index c2a5dc3..227e41d 100644 --- a/mandoline/ui/aura/window_tree_host_mojo.cc +++ b/mandoline/ui/aura/window_tree_host_mojo.cc @@ -20,7 +20,7 @@ namespace mandoline { //////////////////////////////////////////////////////////////////////////////// // WindowTreeHostMojo, public: -WindowTreeHostMojo::WindowTreeHostMojo(mojo::Shell* shell, mus::View* view) +WindowTreeHostMojo::WindowTreeHostMojo(mojo::Shell* shell, mojo::View* view) : view_(view), bounds_(view->bounds().To()) { view_->AddObserver(this); @@ -99,9 +99,10 @@ void WindowTreeHostMojo::OnCursorVisibilityChangedNative(bool show) { //////////////////////////////////////////////////////////////////////////////// // WindowTreeHostMojo, ViewObserver implementation: -void WindowTreeHostMojo::OnViewBoundsChanged(mus::View* view, - const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) { +void WindowTreeHostMojo::OnViewBoundsChanged( + mojo::View* view, + const mojo::Rect& old_bounds, + const mojo::Rect& new_bounds) { gfx::Rect old_bounds2 = old_bounds.To(); gfx::Rect new_bounds2 = new_bounds.To(); bounds_ = new_bounds2; diff --git a/mandoline/ui/aura/window_tree_host_mojo.h b/mandoline/ui/aura/window_tree_host_mojo.h index 277b423..b3ce943 100644 --- a/mandoline/ui/aura/window_tree_host_mojo.h +++ b/mandoline/ui/aura/window_tree_host_mojo.h @@ -27,9 +27,9 @@ class InputMethodMandoline; class SurfaceContextFactory; class WindowTreeHostMojo : public aura::WindowTreeHost, - public mus::ViewObserver { + public mojo::ViewObserver { public: - WindowTreeHostMojo(mojo::Shell* shell, mus::View* view); + WindowTreeHostMojo(mojo::Shell* shell, mojo::View* view); ~WindowTreeHostMojo() override; const gfx::Rect& bounds() const { return bounds_; } @@ -53,12 +53,12 @@ class WindowTreeHostMojo : public aura::WindowTreeHost, void MoveCursorToNative(const gfx::Point& location) override; void OnCursorVisibilityChangedNative(bool show) override; - // mus::ViewObserver: - void OnViewBoundsChanged(mus::View* view, + // mojo::ViewObserver: + void OnViewBoundsChanged(mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) override; - mus::View* view_; + mojo::View* view_; gfx::Rect bounds_; diff --git a/mandoline/ui/desktop_ui/browser_window.cc b/mandoline/ui/desktop_ui/browser_window.cc index a6b7e93..a62299e 100644 --- a/mandoline/ui/desktop_ui/browser_window.cc +++ b/mandoline/ui/desktop_ui/browser_window.cc @@ -80,7 +80,7 @@ BrowserWindow::BrowserWindow(mojo::ApplicationImpl* app, web_view_(this) { mojo::ViewTreeHostClientPtr host_client; host_client_binding_.Bind(GetProxy(&host_client)); - mus::CreateViewTreeHost(host_factory, host_client.Pass(), this, &host_); + mojo::CreateViewTreeHost(host_factory, host_client.Pass(), this, &host_); } void BrowserWindow::LoadURL(const GURL& url) { @@ -103,7 +103,7 @@ void BrowserWindow::LoadURL(const GURL& url) { void BrowserWindow::Close() { if (root_) - mus::ScopedViewPtr::DeleteViewOrViewManager(root_); + mojo::ScopedViewPtr::DeleteViewOrViewManager(root_); else delete this; } @@ -143,9 +143,9 @@ float BrowserWindow::DIPSToPixels(float value) const { } //////////////////////////////////////////////////////////////////////////////// -// BrowserWindow, mus::ViewTreeDelegate implementation: +// BrowserWindow, mojo::ViewTreeDelegate implementation: -void BrowserWindow::OnEmbed(mus::View* root) { +void BrowserWindow::OnEmbed(mojo::View* root) { // BrowserWindow does not support being embedded more than once. CHECK(!root_); @@ -200,13 +200,13 @@ void BrowserWindow::OnEmbed(mus::View* root) { } } -void BrowserWindow::OnConnectionLost(mus::ViewTreeConnection* connection) { +void BrowserWindow::OnConnectionLost(mojo::ViewTreeConnection* connection) { root_ = nullptr; delete this; } //////////////////////////////////////////////////////////////////////////////// -// BrowserWindow, mus::ViewTreeHostClient implementation: +// BrowserWindow, mojo::ViewTreeHostClient implementation: void BrowserWindow::OnAccelerator(uint32_t id, mojo::EventPtr event) { switch (static_cast(id)) { @@ -328,7 +328,7 @@ void BrowserWindow::Layout(views::View* host) { //////////////////////////////////////////////////////////////////////////////// // BrowserWindow, private: -void BrowserWindow::Init(mus::View* root) { +void BrowserWindow::Init(mojo::View* root) { DCHECK_GT(root->viewport_metrics().device_pixel_ratio, 0); if (!aura_init_) aura_init_.reset(new AuraInit(root, app_->shell())); diff --git a/mandoline/ui/desktop_ui/browser_window.h b/mandoline/ui/desktop_ui/browser_window.h index 576e927..c2ff8de 100644 --- a/mandoline/ui/desktop_ui/browser_window.h +++ b/mandoline/ui/desktop_ui/browser_window.h @@ -30,7 +30,7 @@ class BrowserManager; class ProgressView; class ToolbarView; -class BrowserWindow : public mus::ViewTreeDelegate, +class BrowserWindow : public mojo::ViewTreeDelegate, public mojo::ViewTreeHostClient, public web_view::mojom::WebViewClient, public ViewEmbedder, @@ -53,9 +53,9 @@ class BrowserWindow : public mus::ViewTreeDelegate, float DIPSToPixels(float value) const; - // Overridden from mus::ViewTreeDelegate: - void OnEmbed(mus::View* root) override; - void OnConnectionLost(mus::ViewTreeConnection* connection) override; + // Overridden from mojo::ViewTreeDelegate: + void OnEmbed(mojo::View* root) override; + void OnConnectionLost(mojo::ViewTreeConnection* connection) override; // Overridden from ViewTreeHostClient: void OnAccelerator(uint32_t id, mojo::EventPtr event) override; @@ -80,7 +80,7 @@ class BrowserWindow : public mus::ViewTreeDelegate, gfx::Size GetPreferredSize(const views::View* view) const override; void Layout(views::View* host) override; - void Init(mus::View* root); + void Init(mojo::View* root); void EmbedOmnibox(); mojo::ApplicationImpl* app_; @@ -90,9 +90,9 @@ class BrowserWindow : public mus::ViewTreeDelegate, BrowserManager* manager_; ToolbarView* toolbar_view_; ProgressView* progress_bar_; - mus::View* root_; - mus::View* content_; - mus::View* omnibox_view_; + mojo::View* root_; + mojo::View* content_; + mojo::View* omnibox_view_; mojo::WeakBindingSet view_embedder_bindings_; diff --git a/mandoline/ui/omnibox/omnibox_application.cc b/mandoline/ui/omnibox/omnibox_application.cc index c3b42de..18930e3 100644 --- a/mandoline/ui/omnibox/omnibox_application.cc +++ b/mandoline/ui/omnibox/omnibox_application.cc @@ -26,7 +26,7 @@ namespace mandoline { //////////////////////////////////////////////////////////////////////////////// // OmniboxImpl -class OmniboxImpl : public mus::ViewTreeDelegate, +class OmniboxImpl : public mojo::ViewTreeDelegate, public views::LayoutManager, public views::TextfieldController, public Omnibox { @@ -37,9 +37,9 @@ class OmniboxImpl : public mus::ViewTreeDelegate, ~OmniboxImpl() override; private: - // Overridden from mus::ViewTreeDelegate: - void OnEmbed(mus::View* root) override; - void OnConnectionLost(mus::ViewTreeConnection* connection) override; + // Overridden from mojo::ViewTreeDelegate: + void OnEmbed(mojo::View* root) override; + void OnConnectionLost(mojo::ViewTreeConnection* connection) override; // Overridden from views::LayoutManager: gfx::Size GetPreferredSize(const views::View* view) const override; @@ -59,7 +59,7 @@ class OmniboxImpl : public mus::ViewTreeDelegate, scoped_ptr aura_init_; mojo::ApplicationImpl* app_; - mus::View* root_; + mojo::View* root_; mojo::String url_; views::Textfield* edit_; mojo::Binding binding_; @@ -110,9 +110,9 @@ OmniboxImpl::OmniboxImpl(mojo::ApplicationImpl* app, OmniboxImpl::~OmniboxImpl() {} //////////////////////////////////////////////////////////////////////////////// -// OmniboxImpl, mus::ViewTreeDelegate implementation: +// OmniboxImpl, mojo::ViewTreeDelegate implementation: -void OmniboxImpl::OnEmbed(mus::View* root) { +void OmniboxImpl::OnEmbed(mojo::View* root) { root_ = root; if (!aura_init_.get()) { @@ -148,7 +148,7 @@ void OmniboxImpl::OnEmbed(mus::View* root) { ShowWindow(); } -void OmniboxImpl::OnConnectionLost(mus::ViewTreeConnection* connection) { +void OmniboxImpl::OnConnectionLost(mojo::ViewTreeConnection* connection) { root_ = nullptr; } @@ -190,7 +190,7 @@ bool OmniboxImpl::HandleKeyEvent(views::Textfield* sender, void OmniboxImpl::GetViewTreeClient( mojo::InterfaceRequest request) { - mus::ViewTreeConnection::Create(this, request.Pass()); + mojo::ViewTreeConnection::Create(this, request.Pass()); } void OmniboxImpl::ShowForURL(const mojo::String& url) { diff --git a/mandoline/ui/phone_ui/phone_browser_application_delegate.cc b/mandoline/ui/phone_ui/phone_browser_application_delegate.cc index db21dde..93307aa 100644 --- a/mandoline/ui/phone_ui/phone_browser_application_delegate.cc +++ b/mandoline/ui/phone_ui/phone_browser_application_delegate.cc @@ -47,7 +47,7 @@ void PhoneBrowserApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { break; } } - mus::CreateSingleViewTreeHost(app_, this, &host_); + mojo::CreateSingleViewTreeHost(app_, this, &host_); } bool PhoneBrowserApplicationDelegate::ConfigureIncomingConnection( @@ -66,9 +66,9 @@ void PhoneBrowserApplicationDelegate::LaunchURL(const mojo::String& url) { } //////////////////////////////////////////////////////////////////////////////// -// PhoneBrowserApplicationDelegate, mus::ViewTreeDelegate implementation: +// PhoneBrowserApplicationDelegate, mojo::ViewTreeDelegate implementation: -void PhoneBrowserApplicationDelegate::OnEmbed(mus::View* root) { +void PhoneBrowserApplicationDelegate::OnEmbed(mojo::View* root) { CHECK(!root_); root_ = root; content_ = root->connection()->CreateView(); @@ -83,13 +83,14 @@ void PhoneBrowserApplicationDelegate::OnEmbed(mus::View* root) { } void PhoneBrowserApplicationDelegate::OnConnectionLost( - mus::ViewTreeConnection* connection) {} + mojo::ViewTreeConnection* connection) { +} //////////////////////////////////////////////////////////////////////////////// -// PhoneBrowserApplicationDelegate, mus::ViewObserver implementation: +// PhoneBrowserApplicationDelegate, mojo::ViewObserver implementation: void PhoneBrowserApplicationDelegate::OnViewBoundsChanged( - mus::View* view, + mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) { CHECK_EQ(view, root_); diff --git a/mandoline/ui/phone_ui/phone_browser_application_delegate.h b/mandoline/ui/phone_ui/phone_browser_application_delegate.h index 0193eed..bb41044 100644 --- a/mandoline/ui/phone_ui/phone_browser_application_delegate.h +++ b/mandoline/ui/phone_ui/phone_browser_application_delegate.h @@ -18,19 +18,19 @@ #include "mojo/application/public/cpp/interface_factory.h" #include "mojo/common/weak_binding_set.h" -namespace mus { +namespace mojo { class View; } namespace mandoline { -class PhoneBrowserApplicationDelegate - : public mojo::ApplicationDelegate, - public LaunchHandler, - public mus::ViewTreeDelegate, - public mus::ViewObserver, - public web_view::mojom::WebViewClient, - public mojo::InterfaceFactory { +class PhoneBrowserApplicationDelegate : + public mojo::ApplicationDelegate, + public LaunchHandler, + public mojo::ViewTreeDelegate, + public mojo::ViewObserver, + public web_view::mojom::WebViewClient, + public mojo::InterfaceFactory { public: PhoneBrowserApplicationDelegate(); ~PhoneBrowserApplicationDelegate() override; @@ -44,12 +44,12 @@ class PhoneBrowserApplicationDelegate // Overridden from LaunchHandler: void LaunchURL(const mojo::String& url) override; - // Overridden from mus::ViewTreeDelegate: - void OnEmbed(mus::View* root) override; - void OnConnectionLost(mus::ViewTreeConnection* connection) override; + // Overridden from mojo::ViewTreeDelegate: + void OnEmbed(mojo::View* root) override; + void OnConnectionLost(mojo::ViewTreeConnection* connection) override; - // Overridden from mus::ViewObserver: - void OnViewBoundsChanged(mus::View* view, + // Overridden from mojo::ViewObserver: + void OnViewBoundsChanged(mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) override; @@ -68,8 +68,8 @@ class PhoneBrowserApplicationDelegate mojo::ApplicationImpl* app_; mojo::ViewTreeHostPtr host_; - mus::View* root_; - mus::View* content_; + mojo::View* root_; + mojo::View* content_; web_view::WebView web_view_; mojo::String default_url_; diff --git a/mojo/cc/output_surface_mojo.cc b/mojo/cc/output_surface_mojo.cc index 68803ba..236bd1d 100644 --- a/mojo/cc/output_surface_mojo.cc +++ b/mojo/cc/output_surface_mojo.cc @@ -15,8 +15,9 @@ namespace mojo { OutputSurfaceMojo::OutputSurfaceMojo( const scoped_refptr& context_provider, - scoped_ptr surface) - : cc::OutputSurface(context_provider), surface_(surface.Pass()) { + scoped_ptr surface) + : cc::OutputSurface(context_provider), + surface_(surface.Pass()) { capabilities_.delegated_rendering = true; capabilities_.max_frames_pending = 1; } @@ -39,7 +40,7 @@ void OutputSurfaceMojo::SwapBuffers(cc::CompositorFrame* frame) { } void OutputSurfaceMojo::OnResourcesReturned( - mus::ViewSurface* surface, + mojo::ViewSurface* surface, mojo::Array resources) { cc::CompositorFrameAck cfa; cfa.resources = resources.To(); diff --git a/mojo/cc/output_surface_mojo.h b/mojo/cc/output_surface_mojo.h index 644a5dc..135e2af 100644 --- a/mojo/cc/output_surface_mojo.h +++ b/mojo/cc/output_surface_mojo.h @@ -15,10 +15,10 @@ namespace mojo { class OutputSurfaceMojo : public cc::OutputSurface, - public mus::ViewSurfaceClient { + public mojo::ViewSurfaceClient { public: OutputSurfaceMojo(const scoped_refptr& context_provider, - scoped_ptr surface); + scoped_ptr surface); ~OutputSurfaceMojo() override; // cc::OutputSurface implementation. @@ -26,12 +26,12 @@ class OutputSurfaceMojo : public cc::OutputSurface, bool BindToClient(cc::OutputSurfaceClient* client) override; private: - // ViewSurfaceClient implementation: + // uip::SurfaceObserver implementation: void OnResourcesReturned( - mus::ViewSurface* surface, + mojo::ViewSurface* surface, mojo::Array resources) override; - scoped_ptr surface_; + scoped_ptr surface_; DISALLOW_COPY_AND_ASSIGN(OutputSurfaceMojo); }; diff --git a/mojo/gles2/command_buffer_client_impl.cc b/mojo/gles2/command_buffer_client_impl.cc index d2767ff..b639f6e 100644 --- a/mojo/gles2/command_buffer_client_impl.cc +++ b/mojo/gles2/command_buffer_client_impl.cc @@ -238,7 +238,7 @@ scoped_refptr CommandBufferClientImpl::CreateTransferBuffer( *id, duped.Pass(), static_cast(size)); scoped_ptr backing( - new mus::MojoBufferBacking(handle.Pass(), memory, size)); + new MojoBufferBacking(handle.Pass(), memory, size)); scoped_refptr buffer(new gpu::Buffer(backing.Pass())); return buffer; } @@ -261,8 +261,8 @@ int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer, size->width = static_cast(width); size->height = static_cast(height); - mus::MojoGpuMemoryBufferImpl* gpu_memory_buffer = - mus::MojoGpuMemoryBufferImpl::FromClientBuffer(buffer); + MojoGpuMemoryBufferImpl* gpu_memory_buffer = + MojoGpuMemoryBufferImpl::FromClientBuffer(buffer); gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle(); bool requires_sync_point = false; @@ -312,7 +312,7 @@ int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage( size_t height, unsigned internalformat, unsigned usage) { - scoped_ptr buffer(mus::MojoGpuMemoryBufferImpl::Create( + scoped_ptr buffer(MojoGpuMemoryBufferImpl::Create( gfx::Size(static_cast(width), static_cast(height)), gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat), gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage))); diff --git a/mojo/runner/android/main.cc b/mojo/runner/android/main.cc index 6b17e6b..3c01462 100644 --- a/mojo/runner/android/main.cc +++ b/mojo/runner/android/main.cc @@ -56,9 +56,9 @@ LazyInstance> g_main_activiy = void ConfigureAndroidServices(Context* context) { context->application_manager()->SetLoaderForURL( - make_scoped_ptr( - new UIApplicationLoader(make_scoped_ptr(new mus::AndroidLoader()), - g_java_message_loop.Get().get())), + make_scoped_ptr(new UIApplicationLoader( + make_scoped_ptr(new view_manager::AndroidLoader()), + g_java_message_loop.Get().get())), GURL("mojo:mus")); // Android handler is bundled with the Mojo shell, because it uses the -- cgit v1.1