diff options
author | fsamuel <fsamuel@chromium.org> | 2015-10-16 16:48:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-16 23:50:02 +0000 |
commit | 3c32ae57723269239c36582c2dbd1ee1ac6f36cd (patch) | |
tree | 8e04349154d02ccd234a13701851fc06477057f6 | |
parent | 6baea1cba0a861e782e7a402ba6f8822708940fb (diff) | |
download | chromium_src-3c32ae57723269239c36582c2dbd1ee1ac6f36cd.zip chromium_src-3c32ae57723269239c36582c2dbd1ee1ac6f36cd.tar.gz chromium_src-3c32ae57723269239c36582c2dbd1ee1ac6f36cd.tar.bz2 |
components/mus/public/interfaces View => Window
This CL updates the namespace of the mojoms to mus.mojom.
BUG=542848
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/1406153004
Cr-Commit-Position: refs/heads/master@{#354643}
118 files changed, 1999 insertions, 1844 deletions
diff --git a/components/html_viewer/ax_provider_apptest.cc b/components/html_viewer/ax_provider_apptest.cc index ac703bc..f335951 100644 --- a/components/html_viewer/ax_provider_apptest.cc +++ b/components/html_viewer/ax_provider_apptest.cc @@ -86,7 +86,7 @@ TEST_F(AXProviderTest, HelloWorld) { application_impl()->ConnectToApplication(request.Pass()); // Embed the html_viewer in a Window. - ViewTreeClientPtr tree_client; + mus::mojom::WindowTreeClientPtr tree_client; connection->ConnectToService(&tree_client); mus::Window* embed_window = window_manager()->CreateWindow(); embed_window->Embed(tree_client.Pass()); diff --git a/components/html_viewer/document_resource_waiter.cc b/components/html_viewer/document_resource_waiter.cc index 10f7df9..ea19d3b 100644 --- a/components/html_viewer/document_resource_waiter.cc +++ b/components/html_viewer/document_resource_waiter.cc @@ -219,8 +219,8 @@ void DocumentResourceWaiter::StopHighlightingFindResults() { void DocumentResourceWaiter::OnWindowViewportMetricsChanged( mus::Window* window, - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) { + const mus::mojom::ViewportMetrics& old_metrics, + const mus::mojom::ViewportMetrics& new_metrics) { UpdateIsReady(); } diff --git a/components/html_viewer/document_resource_waiter.h b/components/html_viewer/document_resource_waiter.h index be22006..ea061c4 100644 --- a/components/html_viewer/document_resource_waiter.h +++ b/components/html_viewer/document_resource_waiter.h @@ -97,8 +97,8 @@ class DocumentResourceWaiter : public web_view::mojom::FrameClient, // WindowObserver: void OnWindowViewportMetricsChanged( mus::Window* window, - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) override; + const mus::mojom::ViewportMetrics& old_metrics, + const mus::mojom::ViewportMetrics& new_metrics) override; void OnWindowDestroyed(mus::Window* window) override; // HTMLFrameTreeManagerObserver: diff --git a/components/html_viewer/global_state.cc b/components/html_viewer/global_state.cc index 4400472..44ffcf3 100644 --- a/components/html_viewer/global_state.cc +++ b/components/html_viewer/global_state.cc @@ -175,13 +175,13 @@ void GlobalState::InitIfNecessary(const gfx::Size& screen_size_in_pixels, // TODO(rjkroege): These two functions probably do not interoperate correctly // with MUS. -const mojo::GpuInfo* GlobalState::GetGpuInfo() { +const mus::mojom::GpuInfo* GlobalState::GetGpuInfo() { if (gpu_service_) CHECK(gpu_service_.WaitForIncomingResponse()) <<"Get GPU info failed!"; return gpu_info_.get(); } -void GlobalState::GetGpuInfoCallback(mojo::GpuInfoPtr gpu_info) { +void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { CHECK(gpu_info); gpu_info_ = gpu_info.Pass(); gpu_service_.reset(); diff --git a/components/html_viewer/global_state.h b/components/html_viewer/global_state.h index 4240e44..e3405f3 100644 --- a/components/html_viewer/global_state.h +++ b/components/html_viewer/global_state.h @@ -80,7 +80,7 @@ class GlobalState { return &gpu_memory_buffer_manager_; } - const mojo::GpuInfo* GetGpuInfo(); + const mus::mojom::GpuInfo* GetGpuInfo(); MediaFactory* media_factory() { return media_factory_.get(); } @@ -88,7 +88,7 @@ class GlobalState { private: // Callback for |gpu_service_|->GetGpuInfo(). - void GetGpuInfoCallback(mojo::GpuInfoPtr gpu_info); + void GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info); // App for HTMLViewer, not the document's app. // WARNING: do not expose this. It's too easy to use the wrong one. @@ -119,8 +119,8 @@ class GlobalState { base::Thread compositor_thread_; gles2::RasterThreadHelper raster_thread_helper_; mus::MojoGpuMemoryBufferManager gpu_memory_buffer_manager_; - mojo::GpuPtr gpu_service_; - mojo::GpuInfoPtr gpu_info_; + mus::mojom::GpuPtr gpu_service_; + mus::mojom::GpuInfoPtr gpu_info_; scoped_ptr<MediaFactory> media_factory_; BlinkSettings blink_settings_; diff --git a/components/html_viewer/html_document.cc b/components/html_viewer/html_document.cc index 78f8b22..ce4f1fe 100644 --- a/components/html_viewer/html_document.cc +++ b/components/html_viewer/html_document.cc @@ -107,7 +107,7 @@ HTMLDocument::HTMLDocument(mojo::ApplicationImpl* html_document_app, factory_(factory) { connection->AddService<web_view::mojom::FrameClient>(this); connection->AddService<AxProvider>(this); - connection->AddService<mojo::ViewTreeClient>(this); + connection->AddService<mus::mojom::WindowTreeClient>(this); connection->AddService<devtools_service::DevToolsAgent>(this); if (IsTestInterfaceEnabled()) connection->AddService<TestHTMLViewer>(this); @@ -314,7 +314,7 @@ void HTMLDocument::Create( void HTMLDocument::Create( mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) { + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) { DCHECK(!transferable_state_.window_tree_delegate_impl); transferable_state_.window_tree_delegate_impl.reset( new WindowTreeDelegateImpl(this)); diff --git a/components/html_viewer/html_document.h b/components/html_viewer/html_document.h index 2172fb7..8b7aee2 100644 --- a/components/html_viewer/html_document.h +++ b/components/html_viewer/html_document.h @@ -55,7 +55,7 @@ class HTMLDocument public mojo::InterfaceFactory<web_view::mojom::FrameClient>, public mojo::InterfaceFactory<TestHTMLViewer>, public mojo::InterfaceFactory<devtools_service::DevToolsAgent>, - public mojo::InterfaceFactory<mojo::ViewTreeClient> { + public mojo::InterfaceFactory<mus::mojom::WindowTreeClient> { public: using DeleteCallback = base::Callback<void(HTMLDocument*)>; @@ -136,9 +136,10 @@ class HTMLDocument mojo::ApplicationConnection* connection, mojo::InterfaceRequest<devtools_service::DevToolsAgent> request) override; - // mojo::InterfaceFactory<mus::ViewTreeClient>: - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) override; + // mojo::InterfaceFactory<mus::WindowTreeClient>: + void Create( + mojo::ApplicationConnection* connection, + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override; scoped_ptr<mojo::AppRefCount> app_refcount_; mojo::ApplicationImpl* html_document_app_; diff --git a/components/html_viewer/html_frame_apptest.cc b/components/html_viewer/html_frame_apptest.cc index d7302be..8bda1d0 100644 --- a/components/html_viewer/html_frame_apptest.cc +++ b/components/html_viewer/html_frame_apptest.cc @@ -25,6 +25,7 @@ #include "net/test/spawned_test_server/spawned_test_server.h" #include "third_party/mojo_services/src/accessibility/public/interfaces/accessibility.mojom.h" +using mus::mojom::WindowTreeClientPtr; using mus::WindowServerTestBase; using web_view::Frame; using web_view::FrameConnection; @@ -226,7 +227,7 @@ class HTMLFrameTest : public WindowServerTestBase { return nullptr; FrameConnection* result = frame_connection.get(); FrameClient* frame_client = frame_connection->frame_client(); - ViewTreeClientPtr tree_client = frame_connection->GetViewTreeClient(); + WindowTreeClientPtr tree_client = frame_connection->GetWindowTreeClient(); frame_tree_.reset(new FrameTree( result->GetContentHandlerID(), view, tree_client.Pass(), frame_tree_delegate_.get(), frame_client, frame_connection.Pass(), diff --git a/components/html_viewer/html_widget.cc b/components/html_viewer/html_widget.cc index b1d3217..040b3aa 100644 --- a/components/html_viewer/html_widget.cc +++ b/components/html_viewer/html_widget.cc @@ -37,7 +37,7 @@ void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, DCHECK(window); mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From("mojo:mus"); - mojo::GpuPtr gpu_service; + mus::mojom::GpuPtr gpu_service; app->ConnectToService(request.Pass(), &gpu_service); web_layer_tree_view->Initialize(gpu_service.Pass(), window, widget); } diff --git a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc index f9e4c5b..b9efa5e 100644 --- a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc +++ b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc @@ -26,7 +26,7 @@ WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( const blink::WebGraphicsContext3D::Attributes& attributes, blink::WebGraphicsContext3D* share_context, blink::WebGLInfo* gl_info) { - const mojo::GpuInfo* gpu_info = global_state->GetGpuInfo(); + const mus::mojom::GpuInfo* gpu_info = global_state->GetGpuInfo(); gl_info->vendorId = gpu_info->vendor_id; gl_info->deviceId = gpu_info->device_id; gl_info->vendorInfo = gpu_info->vendor_info.To<blink::WebString>(); @@ -35,16 +35,16 @@ WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From("mojo:mus"); - mojo::GpuPtr gpu_service; + mus::mojom::GpuPtr gpu_service; app->ConnectToService(request.Pass(), &gpu_service); - mojo::CommandBufferPtr cb; + mus::mojom::CommandBufferPtr cb; gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); return new WebGraphicsContext3DCommandBufferImpl( cb.PassInterface(), active_url, attributes, share_context); } WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( - mojo::InterfacePtrInfo<mojo::CommandBuffer> command_buffer_info, + mojo::InterfacePtrInfo<mus::mojom::CommandBuffer> command_buffer_info, const GURL& active_url, const blink::WebGraphicsContext3D::Attributes& attributes, blink::WebGraphicsContext3D* share_context) { diff --git a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.h b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.h index d90d1d6..564f6f4 100644 --- a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.h +++ b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.h @@ -40,7 +40,7 @@ class WebGraphicsContext3DCommandBufferImpl private: WebGraphicsContext3DCommandBufferImpl( - mojo::InterfacePtrInfo<mojo::CommandBuffer> command_buffer_info, + mojo::InterfacePtrInfo<mus::mojom::CommandBuffer> command_buffer_info, const GURL& active_url, const blink::WebGraphicsContext3D::Attributes& attributes, blink::WebGraphicsContext3D* share_context); diff --git a/components/html_viewer/web_layer_tree_view_impl.cc b/components/html_viewer/web_layer_tree_view_impl.cc index c54081e..066666a 100644 --- a/components/html_viewer/web_layer_tree_view_impl.cc +++ b/components/html_viewer/web_layer_tree_view_impl.cc @@ -57,13 +57,13 @@ WebLayerTreeViewImpl::WebLayerTreeViewImpl( DCHECK(layer_tree_host_); } -void WebLayerTreeViewImpl::Initialize(mojo::GpuPtr gpu_service, +void WebLayerTreeViewImpl::Initialize(mus::mojom::GpuPtr gpu_service, mus::Window* window, blink::WebWidget* widget) { window_ = window; widget_ = widget; if (gpu_service) { - mojo::CommandBufferPtr cb; + mus::mojom::CommandBufferPtr cb; gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); scoped_refptr<cc::ContextProvider> context_provider( new mus::ContextProvider(cb.PassInterface().PassHandle())); diff --git a/components/html_viewer/web_layer_tree_view_impl.h b/components/html_viewer/web_layer_tree_view_impl.h index 8ca4302..9f4ea27 100644 --- a/components/html_viewer/web_layer_tree_view_impl.h +++ b/components/html_viewer/web_layer_tree_view_impl.h @@ -43,7 +43,7 @@ class WebLayerTreeViewImpl : public blink::WebLayerTreeView, cc::TaskGraphRunner* task_graph_runner); ~WebLayerTreeViewImpl() override; - void Initialize(mojo::GpuPtr gpu_service, + void Initialize(mus::mojom::GpuPtr gpu_service, mus::Window* window, blink::WebWidget* widget); diff --git a/components/mus/example/wm/window_manager_application.h b/components/mus/example/wm/window_manager_application.h index 79d45e6..fdde1cc 100644 --- a/components/mus/example/wm/window_manager_application.h +++ b/components/mus/example/wm/window_manager_application.h @@ -9,8 +9,8 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "components/mus/public/cpp/window_tree_delegate.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" #include "components/mus/public/interfaces/window_manager.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "mojo/application/public/cpp/application_delegate.h" #include "mojo/application/public/cpp/interface_factory_impl.h" @@ -49,7 +49,7 @@ class WindowManagerApplication mus::Window* root_; int window_count_; - mojo::ViewTreeHostPtr host_; + mus::mojom::WindowTreeHostPtr host_; ScopedVector<mojo::InterfaceRequest<mus::mojom::WindowManager>> requests_; DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); diff --git a/components/mus/example/wm/window_manager_apptest.cc b/components/mus/example/wm/window_manager_apptest.cc index c11c6f9..2e90af3 100644 --- a/components/mus/example/wm/window_manager_apptest.cc +++ b/components/mus/example/wm/window_manager_apptest.cc @@ -6,8 +6,8 @@ #include "components/mus/public/cpp/window.h" #include "components/mus/public/cpp/window_tree_connection.h" #include "components/mus/public/cpp/window_tree_delegate.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" #include "components/mus/public/interfaces/window_manager.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "mojo/application/public/cpp/application_impl.h" #include "mojo/application/public/cpp/application_test_base.h" @@ -25,12 +25,12 @@ class WindowManagerAppTest : public mojo::test::ApplicationTestBase, } mus::Window* OpenWindow(mus::mojom::WindowManager* window_manager) { - mojo::ViewTreeClientPtr view_tree_client; - mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client_request = - GetProxy(&view_tree_client); - window_manager->OpenWindow(view_tree_client.Pass()); + mus::mojom::WindowTreeClientPtr window_tree_client; + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> + window_tree_client_request = GetProxy(&window_tree_client); + window_manager->OpenWindow(window_tree_client.Pass()); mus::WindowTreeConnection* connection = mus::WindowTreeConnection::Create( - this, view_tree_client_request.Pass(), + this, window_tree_client_request.Pass(), mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); return connection->GetRoot(); } diff --git a/components/mus/example/wm/window_manager_impl.cc b/components/mus/example/wm/window_manager_impl.cc index e15aff6..b2098a3 100644 --- a/components/mus/example/wm/window_manager_impl.cc +++ b/components/mus/example/wm/window_manager_impl.cc @@ -28,7 +28,7 @@ WindowManagerImpl::WindowManagerImpl( WindowManagerImpl::~WindowManagerImpl() {} -void WindowManagerImpl::OpenWindow(mojo::ViewTreeClientPtr client) { +void WindowManagerImpl::OpenWindow(mus::mojom::WindowTreeClientPtr client) { mus::Window* root = state_->root(); DCHECK(root); mus::Id container_window_id = diff --git a/components/mus/example/wm/window_manager_impl.h b/components/mus/example/wm/window_manager_impl.h index c7ffd1a..fc01938 100644 --- a/components/mus/example/wm/window_manager_impl.h +++ b/components/mus/example/wm/window_manager_impl.h @@ -27,7 +27,7 @@ class WindowManagerImpl : public mus::mojom::WindowManager, private: // mus::mojom::WindowManager: - void OpenWindow(mojo::ViewTreeClientPtr client) override; + void OpenWindow(mus::mojom::WindowTreeClientPtr client) override; void CenterWindow(mus::Id window_id, mojo::SizePtr size, const WindowManagerErrorCodeCallback& callback) override; diff --git a/components/mus/gles2/command_buffer_driver.cc b/components/mus/gles2/command_buffer_driver.cc index a03ad56..8bfba33 100644 --- a/components/mus/gles2/command_buffer_driver.cc +++ b/components/mus/gles2/command_buffer_driver.cc @@ -44,16 +44,16 @@ CommandBufferDriver::~CommandBufferDriver() { } void CommandBufferDriver::Initialize( - mojo::InterfacePtrInfo<mojo::CommandBufferSyncClient> sync_client, - mojo::InterfacePtrInfo<mojo::CommandBufferLostContextObserver> + mojo::InterfacePtrInfo<mojom::CommandBufferSyncClient> sync_client, + mojo::InterfacePtrInfo<mojom::CommandBufferLostContextObserver> loss_observer, mojo::ScopedSharedBufferHandle shared_state, mojo::Array<int32_t> attribs) { sync_client_ = mojo::MakeProxy(sync_client.Pass()); loss_observer_ = mojo::MakeProxy(loss_observer.Pass()); bool success = DoInitialize(shared_state.Pass(), attribs.Pass()); - mojo::GpuCapabilitiesPtr capabilities = - success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities()) + mojom::GpuCapabilitiesPtr capabilities = + success ? mojom::GpuCapabilities::From(decoder_->GetCapabilities()) : nullptr; sync_client_->DidInitialize(success, capabilities.Pass()); } @@ -168,7 +168,7 @@ void CommandBufferDriver::Flush(int32_t put_offset) { void CommandBufferDriver::MakeProgress(int32_t last_get_offset) { // TODO(piman): handle out-of-order. sync_client_->DidMakeProgress( - mojo::CommandBufferState::From(command_buffer_->GetLastState())); + mojom::CommandBufferState::From(command_buffer_->GetLastState())); } void CommandBufferDriver::RegisterTransferBuffer( diff --git a/components/mus/gles2/command_buffer_driver.h b/components/mus/gles2/command_buffer_driver.h index 460ab5a..47d25a5 100644 --- a/components/mus/gles2/command_buffer_driver.h +++ b/components/mus/gles2/command_buffer_driver.h @@ -49,8 +49,8 @@ class CommandBufferDriver { void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); } void Initialize( - mojo::InterfacePtrInfo<mojo::CommandBufferSyncClient> sync_client, - mojo::InterfacePtrInfo<mojo::CommandBufferLostContextObserver> + mojo::InterfacePtrInfo<mojom::CommandBufferSyncClient> sync_client, + mojo::InterfacePtrInfo<mojom::CommandBufferLostContextObserver> loss_observer, mojo::ScopedSharedBufferHandle shared_state, mojo::Array<int32_t> attribs); @@ -86,8 +86,8 @@ class CommandBufferDriver { void DestroyDecoder(); scoped_ptr<Client> client_; - mojo::CommandBufferSyncClientPtr sync_client_; - mojo::CommandBufferLostContextObserverPtr loss_observer_; + mojom::CommandBufferSyncClientPtr sync_client_; + mojom::CommandBufferLostContextObserverPtr loss_observer_; scoped_ptr<gpu::CommandBufferService> command_buffer_; scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; scoped_ptr<gpu::GpuScheduler> scheduler_; diff --git a/components/mus/gles2/command_buffer_impl.cc b/components/mus/gles2/command_buffer_impl.cc index cc05053..9656199 100644 --- a/components/mus/gles2/command_buffer_impl.cc +++ b/components/mus/gles2/command_buffer_impl.cc @@ -36,7 +36,7 @@ class CommandBufferImpl::CommandBufferDriverClientImpl }; CommandBufferImpl::CommandBufferImpl( - mojo::InterfaceRequest<mojo::CommandBuffer> request, + mojo::InterfaceRequest<mus::mojom::CommandBuffer> request, scoped_refptr<GpuState> gpu_state, scoped_ptr<CommandBufferDriver> driver) : gpu_state_(gpu_state), @@ -53,9 +53,9 @@ CommandBufferImpl::CommandBufferImpl( } void CommandBufferImpl::Initialize( - mojo::CommandBufferSyncClientPtr sync_client, - mojo::CommandBufferSyncPointClientPtr sync_point_client, - mojo::CommandBufferLostContextObserverPtr loss_observer, + mus::mojom::CommandBufferSyncClientPtr sync_client, + mus::mojom::CommandBufferSyncPointClientPtr sync_point_client, + mus::mojom::CommandBufferLostContextObserverPtr loss_observer, mojo::ScopedSharedBufferHandle shared_state, mojo::Array<int32_t> attribs) { sync_point_client_ = sync_point_client.Pass(); @@ -151,8 +151,9 @@ CommandBufferImpl::~CommandBufferImpl() { } void CommandBufferImpl::BindToRequest( - mojo::InterfaceRequest<mojo::CommandBuffer> request) { - binding_.reset(new mojo::Binding<mojo::CommandBuffer>(this, request.Pass())); + mojo::InterfaceRequest<mus::mojom::CommandBuffer> request) { + binding_.reset( + new mojo::Binding<mus::mojom::CommandBuffer>(this, request.Pass())); binding_->set_connection_error_handler([this]() { OnConnectionError(); }); } diff --git a/components/mus/gles2/command_buffer_impl.h b/components/mus/gles2/command_buffer_impl.h index 4241ac3..df41095 100644 --- a/components/mus/gles2/command_buffer_impl.h +++ b/components/mus/gles2/command_buffer_impl.h @@ -21,16 +21,16 @@ class GpuState; // so that we can insert sync points without blocking on the GL driver. It // forwards most method calls to the CommandBufferDriver, which runs on the // same thread as the native viewport. -class CommandBufferImpl : public mojo::CommandBuffer { +class CommandBufferImpl : public mojom::CommandBuffer { public: CommandBufferImpl(mojo::InterfaceRequest<CommandBuffer> request, scoped_refptr<GpuState> gpu_state, scoped_ptr<CommandBufferDriver> driver); - // mojo::CommandBuffer: - void Initialize(mojo::CommandBufferSyncClientPtr sync_client, - mojo::CommandBufferSyncPointClientPtr sync_point_client, - mojo::CommandBufferLostContextObserverPtr loss_observer, + // mojom::CommandBuffer: + void Initialize(mojom::CommandBufferSyncClientPtr sync_client, + mojom::CommandBufferSyncPointClientPtr sync_point_client, + mojom::CommandBufferLostContextObserverPtr loss_observer, mojo::ScopedSharedBufferHandle shared_state, mojo::Array<int32_t> attribs) override; void SetGetBuffer(int32_t buffer) override; @@ -71,7 +71,7 @@ class CommandBufferImpl : public mojo::CommandBuffer { scoped_refptr<GpuState> gpu_state_; scoped_refptr<base::SingleThreadTaskRunner> driver_task_runner_; scoped_ptr<CommandBufferDriver> driver_; - mojo::CommandBufferSyncPointClientPtr sync_point_client_; + mojom::CommandBufferSyncPointClientPtr sync_point_client_; scoped_ptr<mojo::Binding<CommandBuffer>> binding_; CommandBufferImplObserver* observer_; base::WeakPtrFactory<CommandBufferImpl> weak_ptr_factory_; diff --git a/components/mus/gles2/command_buffer_type_conversions.cc b/components/mus/gles2/command_buffer_type_conversions.cc index d5a9f26..1bd8399 100644 --- a/components/mus/gles2/command_buffer_type_conversions.cc +++ b/components/mus/gles2/command_buffer_type_conversions.cc @@ -6,6 +6,18 @@ #include "components/mus/public/interfaces/command_buffer.mojom.h" +using mus::mojom::CommandBufferPtr; +using mus::mojom::CommandBufferState; +using mus::mojom::CommandBufferStatePtr; +using mus::mojom::GpuCapabilities; +using mus::mojom::GpuCapabilitiesPtr; +using mus::mojom::GpuInfo; +using mus::mojom::GpuInfoPtr; +using mus::mojom::GpuPerStagePrecisions; +using mus::mojom::GpuPerStagePrecisionsPtr; +using mus::mojom::GpuShaderPrecision; +using mus::mojom::GpuShaderPrecisionPtr; + namespace mojo { CommandBufferStatePtr diff --git a/components/mus/gles2/command_buffer_type_conversions.h b/components/mus/gles2/command_buffer_type_conversions.h index 4ff5f63..e20a8ff 100644 --- a/components/mus/gles2/command_buffer_type_conversions.h +++ b/components/mus/gles2/command_buffer_type_conversions.h @@ -14,59 +14,61 @@ namespace mojo { -class CommandBufferState; - template <> -struct TypeConverter<CommandBufferStatePtr, gpu::CommandBuffer::State> { - static CommandBufferStatePtr Convert(const gpu::CommandBuffer::State& input); +struct TypeConverter<mus::mojom::CommandBufferStatePtr, + gpu::CommandBuffer::State> { + static mus::mojom::CommandBufferStatePtr Convert( + const gpu::CommandBuffer::State& input); }; template <> -struct TypeConverter<gpu::CommandBuffer::State, CommandBufferStatePtr> { - static gpu::CommandBuffer::State Convert(const CommandBufferStatePtr& input); +struct TypeConverter<gpu::CommandBuffer::State, + mus::mojom::CommandBufferStatePtr> { + static gpu::CommandBuffer::State Convert( + const mus::mojom::CommandBufferStatePtr& input); }; template <> -struct TypeConverter<GpuShaderPrecisionPtr, +struct TypeConverter<mus::mojom::GpuShaderPrecisionPtr, gpu::Capabilities::ShaderPrecision> { - static GpuShaderPrecisionPtr Convert( + static mus::mojom::GpuShaderPrecisionPtr Convert( const gpu::Capabilities::ShaderPrecision& input); }; template <> struct TypeConverter<gpu::Capabilities::ShaderPrecision, - GpuShaderPrecisionPtr> { + mus::mojom::GpuShaderPrecisionPtr> { static gpu::Capabilities::ShaderPrecision Convert( - const GpuShaderPrecisionPtr& input); + const mus::mojom::GpuShaderPrecisionPtr& input); }; template <> -struct TypeConverter<GpuPerStagePrecisionsPtr, +struct TypeConverter<mus::mojom::GpuPerStagePrecisionsPtr, gpu::Capabilities::PerStagePrecisions> { - static GpuPerStagePrecisionsPtr Convert( + static mus::mojom::GpuPerStagePrecisionsPtr Convert( const gpu::Capabilities::PerStagePrecisions& input); }; template <> struct TypeConverter<gpu::Capabilities::PerStagePrecisions, - GpuPerStagePrecisionsPtr> { + mus::mojom::GpuPerStagePrecisionsPtr> { static gpu::Capabilities::PerStagePrecisions Convert( - const GpuPerStagePrecisionsPtr& input); + const mus::mojom::GpuPerStagePrecisionsPtr& input); }; template <> -struct TypeConverter<GpuCapabilitiesPtr, gpu::Capabilities> { - static GpuCapabilitiesPtr Convert(const gpu::Capabilities& input); +struct TypeConverter<mus::mojom::GpuCapabilitiesPtr, gpu::Capabilities> { + static mus::mojom::GpuCapabilitiesPtr Convert(const gpu::Capabilities& input); }; template <> -struct TypeConverter<gpu::Capabilities, GpuCapabilitiesPtr> { - static gpu::Capabilities Convert(const GpuCapabilitiesPtr& input); +struct TypeConverter<gpu::Capabilities, mus::mojom::GpuCapabilitiesPtr> { + static gpu::Capabilities Convert(const mus::mojom::GpuCapabilitiesPtr& input); }; template <> -struct TypeConverter<GpuInfoPtr, gpu::GPUInfo> { - static GpuInfoPtr Convert(const gpu::GPUInfo& input); +struct TypeConverter<mus::mojom::GpuInfoPtr, gpu::GPUInfo> { + static mus::mojom::GpuInfoPtr Convert(const gpu::GPUInfo& input); }; } // namespace mojo diff --git a/components/mus/gles2/gpu_impl.cc b/components/mus/gles2/gpu_impl.cc index 12b4042..e23add8 100644 --- a/components/mus/gles2/gpu_impl.cc +++ b/components/mus/gles2/gpu_impl.cc @@ -18,13 +18,13 @@ GpuImpl::GpuImpl(mojo::InterfaceRequest<Gpu> request, GpuImpl::~GpuImpl() {} void GpuImpl::CreateOffscreenGLES2Context( - mojo::InterfaceRequest<mojo::CommandBuffer> request) { + mojo::InterfaceRequest<mojom::CommandBuffer> request) { new CommandBufferImpl(request.Pass(), state_, make_scoped_ptr(new CommandBufferDriver(state_))); } void GpuImpl::GetGpuInfo(const GetGpuInfoCallback& callback) { - callback.Run(mojo::GpuInfo::From<gpu::GPUInfo>(state_->gpu_info())); + callback.Run(mojom::GpuInfo::From<gpu::GPUInfo>(state_->gpu_info())); } } // namespace mus diff --git a/components/mus/gles2/gpu_impl.h b/components/mus/gles2/gpu_impl.h index d5de657..41b78d9 100644 --- a/components/mus/gles2/gpu_impl.h +++ b/components/mus/gles2/gpu_impl.h @@ -17,14 +17,14 @@ namespace mus { -class GpuImpl : public mojo::Gpu { +class GpuImpl : public mojom::Gpu { public: - GpuImpl(mojo::InterfaceRequest<mojo::Gpu> request, + GpuImpl(mojo::InterfaceRequest<mojom::Gpu> request, const scoped_refptr<GpuState>& state); ~GpuImpl() override; private: - void CreateOffscreenGLES2Context(mojo::InterfaceRequest<mojo::CommandBuffer> + void CreateOffscreenGLES2Context(mojo::InterfaceRequest<mojom::CommandBuffer> command_buffer_request) override; void GetGpuInfo(const GetGpuInfoCallback& callback) override; diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc index 335dbca..5caf9f9 100644 --- a/components/mus/mus_app.cc +++ b/components/mus/mus_app.cc @@ -30,9 +30,9 @@ using mojo::ApplicationConnection; using mojo::ApplicationImpl; -using mojo::Gpu; using mojo::InterfaceRequest; -using mojo::ViewTreeHostFactory; +using mus::mojom::WindowTreeHostFactory; +using mus::mojom::Gpu; namespace mus { @@ -71,7 +71,7 @@ void MandolineUIServicesApp::Initialize(ApplicationImpl* app) { bool MandolineUIServicesApp::ConfigureIncomingConnection( ApplicationConnection* connection) { - connection->AddService<ViewTreeHostFactory>(this); + connection->AddService<WindowTreeHostFactory>(this); connection->AddService<Gpu>(this); return true; } @@ -82,12 +82,12 @@ void MandolineUIServicesApp::OnNoMoreRootConnections() { ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> tree_request, + mojo::InterfaceRequest<mojom::WindowTree> tree_request, ConnectionSpecificId creator_id, mojo::URLRequestPtr request, const ViewId& root_id, uint32_t policy_bitmask) { - mojo::ViewTreeClientPtr client; + mojom::WindowTreeClientPtr client; app_impl_->ConnectToService(request.Pass(), &client); scoped_ptr<ViewTreeImpl> service(new ViewTreeImpl( @@ -98,11 +98,11 @@ ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> tree_request, + mojo::InterfaceRequest<mojom::WindowTree> tree_request, ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask, - mojo::ViewTreeClientPtr client) { + mojom::WindowTreeClientPtr client) { scoped_ptr<ViewTreeImpl> service(new ViewTreeImpl( connection_manager, creator_id, root_id, policy_bitmask)); return new DefaultClientConnection(service.Pass(), connection_manager, @@ -111,7 +111,7 @@ ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView( void MandolineUIServicesApp::Create( ApplicationConnection* connection, - InterfaceRequest<ViewTreeHostFactory> request) { + InterfaceRequest<WindowTreeHostFactory> request) { factory_bindings_.AddBinding(this, request.Pass()); } @@ -123,9 +123,9 @@ void MandolineUIServicesApp::Create(mojo::ApplicationConnection* connection, } void MandolineUIServicesApp::CreateWindowTreeHost( - mojo::InterfaceRequest<mojo::ViewTreeHost> host, - mojo::ViewTreeHostClientPtr host_client, - mojo::ViewTreeClientPtr tree_client) { + mojo::InterfaceRequest<mojom::WindowTreeHost> host, + mojom::WindowTreeHostClientPtr host_client, + mojom::WindowTreeClientPtr tree_client) { DCHECK(connection_manager_.get()); // TODO(fsamuel): We need to make sure that only the window manager can create diff --git a/components/mus/mus_app.h b/components/mus/mus_app.h index 9ffd437..78aa444 100644 --- a/components/mus/mus_app.h +++ b/components/mus/mus_app.h @@ -9,8 +9,8 @@ #include "base/memory/scoped_ptr.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 "components/mus/public/interfaces/window_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/mus/ws/connection_manager_delegate.h" #include "mojo/application/public/cpp/app_lifetime_helper.h" #include "mojo/application/public/cpp/application_delegate.h" @@ -35,9 +35,9 @@ class SurfacesState; class MandolineUIServicesApp : public mojo::ApplicationDelegate, public ConnectionManagerDelegate, - public mojo::InterfaceFactory<mojo::ViewTreeHostFactory>, - public mojo::InterfaceFactory<mojo::Gpu>, - public mojo::ViewTreeHostFactory { + public mojo::InterfaceFactory<mojom::WindowTreeHostFactory>, + public mojo::InterfaceFactory<mojom::Gpu>, + public mojom::WindowTreeHostFactory { public: MandolineUIServicesApp(); ~MandolineUIServicesApp() override; @@ -52,34 +52,34 @@ class MandolineUIServicesApp void OnNoMoreRootConnections() override; ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> tree_request, + mojo::InterfaceRequest<mojom::WindowTree> tree_request, ConnectionSpecificId creator_id, mojo::URLRequestPtr request, const ViewId& root_id, uint32_t policy_bitmask) override; ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> tree_request, + mojo::InterfaceRequest<mojom::WindowTree> tree_request, ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask, - mojo::ViewTreeClientPtr client) override; + mojom::WindowTreeClientPtr client) override; - // mojo::InterfaceFactory<mojo::ViewTreeHostFactory>: + // mojo::InterfaceFactory<mojom::WindowTreeHostFactory>: void Create( mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ViewTreeHostFactory> request) override; + mojo::InterfaceRequest<mojom::WindowTreeHostFactory> request) override; - // mojo::InterfaceFactory<mojo::Gpu> implementation. + // mojo::InterfaceFactory<mojom::Gpu> implementation. void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::Gpu> request) override; + mojo::InterfaceRequest<mojom::Gpu> request) override; - // mojo::ViewTreeHostFactory implementation. - void CreateWindowTreeHost(mojo::InterfaceRequest<mojo::ViewTreeHost> host, - mojo::ViewTreeHostClientPtr host_client, - mojo::ViewTreeClientPtr tree_client) override; + // mojom::WindowTreeHostFactory implementation. + void CreateWindowTreeHost(mojo::InterfaceRequest<mojom::WindowTreeHost> host, + mojom::WindowTreeHostClientPtr host_client, + mojom::WindowTreeClientPtr tree_client) override; - mojo::WeakBindingSet<mojo::ViewTreeHostFactory> factory_bindings_; + mojo::WeakBindingSet<mojom::WindowTreeHostFactory> factory_bindings_; mojo::ApplicationImpl* app_impl_; scoped_ptr<ConnectionManager> connection_manager_; mojo::TracingImpl tracing_; diff --git a/components/mus/public/cpp/lib/output_surface.cc b/components/mus/public/cpp/lib/output_surface.cc index 5b195f7..66d4fb8 100644 --- a/components/mus/public/cpp/lib/output_surface.cc +++ b/components/mus/public/cpp/lib/output_surface.cc @@ -41,13 +41,13 @@ void OutputSurface::SwapBuffers(cc::CompositorFrame* frame) { // destroyed then SubmitCompositorFrame's callback will never get called. // Thus, base::Unretained is safe here. surface_->SubmitCompositorFrame( - mojo::CompositorFrame::From(*frame), + mojom::CompositorFrame::From(*frame), base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); } void OutputSurface::OnResourcesReturned( mus::WindowSurface* surface, - mojo::Array<mojo::ReturnedResourcePtr> resources) { + mojo::Array<mojom::ReturnedResourcePtr> resources) { cc::CompositorFrameAck cfa; cfa.resources = resources.To<cc::ReturnedResourceArray>(); ReclaimResources(&cfa); diff --git a/components/mus/public/cpp/lib/window.cc b/components/mus/public/cpp/lib/window.cc index 9a223b0..49154c8 100644 --- a/components/mus/public/cpp/lib/window.cc +++ b/components/mus/public/cpp/lib/window.cc @@ -88,7 +88,7 @@ class ScopedOrderChangedNotifier { public: ScopedOrderChangedNotifier(Window* window, Window* relative_window, - mojo::OrderDirection direction) + mojom::OrderDirection direction) : window_(window), relative_window_(relative_window), direction_(direction) { @@ -104,7 +104,7 @@ class ScopedOrderChangedNotifier { private: Window* window_; Window* relative_window_; - mojo::OrderDirection direction_; + mojom::OrderDirection direction_; MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier); }; @@ -113,7 +113,7 @@ class ScopedOrderChangedNotifier { bool ReorderImpl(Window::Children* children, Window* window, Window* relative, - mojo::OrderDirection direction) { + mojom::OrderDirection direction) { DCHECK(relative); DCHECK_NE(window, relative); DCHECK_EQ(window->parent(), relative->parent()); @@ -123,14 +123,14 @@ bool ReorderImpl(Window::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 == mojom::ORDER_DIRECTION_ABOVE && child_i == target_i + 1) || + (direction == mojom::ORDER_DIRECTION_BELOW && child_i + 1 == target_i)) { return false; } ScopedOrderChangedNotifier notifier(window, relative, direction); - const size_t dest_i = direction == mojo::ORDER_DIRECTION_ABOVE + const size_t dest_i = direction == mojom::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); @@ -233,9 +233,9 @@ void Window::SetVisible(bool value) { } scoped_ptr<WindowSurface> Window::RequestSurface() { - mojo::SurfacePtr surface; - mojo::SurfaceClientPtr client; - mojo::InterfaceRequest<mojo::SurfaceClient> client_request = + mojom::SurfacePtr surface; + mojom::SurfaceClientPtr client; + mojo::InterfaceRequest<mojom::SurfaceClient> client_request = GetProxy(&client); static_cast<WindowTreeClientImpl*>(connection_) ->RequestSurface(id_, GetProxy(&surface), client.Pass()); @@ -329,16 +329,16 @@ void Window::RemoveChild(Window* child) { void Window::MoveToFront() { if (!parent_ || parent_->children_.back() == this) return; - Reorder(parent_->children_.back(), mojo::ORDER_DIRECTION_ABOVE); + Reorder(parent_->children_.back(), mojom::ORDER_DIRECTION_ABOVE); } void Window::MoveToBack() { if (!parent_ || parent_->children_.front() == this) return; - Reorder(parent_->children_.front(), mojo::ORDER_DIRECTION_BELOW); + Reorder(parent_->children_.front(), mojom::ORDER_DIRECTION_BELOW); } -void Window::Reorder(Window* relative, mojo::OrderDirection direction) { +void Window::Reorder(Window* relative, mojom::OrderDirection direction) { if (!LocalReorder(relative, direction)) return; if (connection_) { @@ -378,7 +378,7 @@ Window* Window::GetChildById(Id id) { void Window::SetTextInputState(mojo::TextInputStatePtr state) { if (connection_) { static_cast<WindowTreeClientImpl*>(connection_) - ->SetViewTextInputState(id_, state.Pass()); + ->SetWindowTextInputState(id_, state.Pass()); } } @@ -400,12 +400,12 @@ bool Window::HasFocus() const { return connection_ && connection_->GetFocusedWindow() == this; } -void Window::Embed(mojo::ViewTreeClientPtr client) { - Embed(client.Pass(), mojo::ViewTree::ACCESS_POLICY_DEFAULT, +void Window::Embed(mus::mojom::WindowTreeClientPtr client) { + Embed(client.Pass(), mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT, base::Bind(&EmptyEmbedCallback)); } -void Window::Embed(mojo::ViewTreeClientPtr client, +void Window::Embed(mus::mojom::WindowTreeClientPtr client, uint32_t policy_bitmask, const EmbedCallback& callback) { if (PrepareForEmbed()) { @@ -421,8 +421,8 @@ void Window::Embed(mojo::ViewTreeClientPtr client, namespace { -mojo::ViewportMetricsPtr CreateEmptyViewportMetrics() { - mojo::ViewportMetricsPtr metrics = mojo::ViewportMetrics::New(); +mojom::ViewportMetricsPtr CreateEmptyViewportMetrics() { + mojom::ViewportMetricsPtr metrics = mojom::ViewportMetrics::New(); metrics->size_in_pixels = mojo::Size::New(); // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove it // once that's fixed. @@ -527,7 +527,7 @@ void Window::LocalRemoveChild(Window* child) { RemoveChildImpl(child, &children_); } -bool Window::LocalReorder(Window* relative, mojo::OrderDirection direction) { +bool Window::LocalReorder(Window* relative, mojom::OrderDirection direction) { return ReorderImpl(&parent_->children_, this, relative, direction); } @@ -555,8 +555,9 @@ void Window::LocalSetClientArea(const mojo::Rect& new_client_area) { OnWindowClientAreaChanged(this, old_client_area)); } -void Window::LocalSetViewportMetrics(const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) { +void Window::LocalSetViewportMetrics( + const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics) { // TODO(eseidel): We could check old_metrics against viewport_metrics_. viewport_metrics_ = new_metrics.Clone(); FOR_EACH_OBSERVER( diff --git a/components/mus/public/cpp/lib/window_private.h b/components/mus/public/cpp/lib/window_private.h index 725efc3..84d124b 100644 --- a/components/mus/public/cpp/lib/window_private.h +++ b/components/mus/public/cpp/lib/window_private.h @@ -39,15 +39,15 @@ class WindowPrivate { window_->properties_ = data; } - void LocalSetViewportMetrics(const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) { + void LocalSetViewportMetrics(const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics) { window_->LocalSetViewportMetrics(new_metrics, new_metrics); } void LocalDestroy() { window_->LocalDestroy(); } void LocalAddChild(Window* child) { window_->LocalAddChild(child); } void LocalRemoveChild(Window* child) { window_->LocalRemoveChild(child); } - void LocalReorder(Window* relative, mojo::OrderDirection direction) { + void LocalReorder(Window* relative, mojom::OrderDirection direction) { window_->LocalReorder(relative, direction); } void LocalSetBounds(const mojo::Rect& old_bounds, diff --git a/components/mus/public/cpp/lib/window_surface.cc b/components/mus/public/cpp/lib/window_surface.cc index 78c4f55..83c4be0 100644 --- a/components/mus/public/cpp/lib/window_surface.cc +++ b/components/mus/public/cpp/lib/window_surface.cc @@ -16,10 +16,10 @@ void WindowSurface::BindToThread() { bound_to_thread_ = true; surface_.Bind(surface_info_.Pass()); client_binding_.reset( - new mojo::Binding<mojo::SurfaceClient>(this, client_request_.Pass())); + new mojo::Binding<mojom::SurfaceClient>(this, client_request_.Pass())); } -void WindowSurface::SubmitCompositorFrame(mojo::CompositorFramePtr frame, +void WindowSurface::SubmitCompositorFrame(mojom::CompositorFramePtr frame, const mojo::Closure& callback) { DCHECK(bound_to_thread_); if (!surface_) @@ -28,15 +28,15 @@ void WindowSurface::SubmitCompositorFrame(mojo::CompositorFramePtr frame, } WindowSurface::WindowSurface( - mojo::InterfacePtrInfo<mojo::Surface> surface_info, - mojo::InterfaceRequest<mojo::SurfaceClient> client_request) + mojo::InterfacePtrInfo<mojom::Surface> surface_info, + mojo::InterfaceRequest<mojom::SurfaceClient> client_request) : client_(nullptr), surface_info_(surface_info.Pass()), client_request_(client_request.Pass()), bound_to_thread_(false) {} void WindowSurface::ReturnResources( - mojo::Array<mojo::ReturnedResourcePtr> resources) { + mojo::Array<mojom::ReturnedResourcePtr> resources) { if (!client_) return; client_->OnResourcesReturned(this, resources.Pass()); diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc index eec6776..a46cb414 100644 --- a/components/mus/public/cpp/lib/window_tree_client_impl.cc +++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc @@ -24,16 +24,16 @@ Id MakeTransportId(ConnectionSpecificId connection_id, // Helper called to construct a local window object from transport data. Window* AddWindowToConnection(WindowTreeClientImpl* client, Window* parent, - const mojo::ViewDataPtr& window_data) { + const mojom::WindowDataPtr& window_data) { // We don't use the cto that takes a WindowTreeConnection here, since it will // call back to the service and attempt to create a new view. Window* window = WindowPrivate::LocalCreate(); WindowPrivate private_window(window); private_window.set_connection(client); - private_window.set_id(window_data->view_id); + private_window.set_id(window_data->window_id); private_window.set_visible(window_data->visible); private_window.set_drawn(window_data->drawn); - private_window.LocalSetViewportMetrics(mojo::ViewportMetrics(), + private_window.LocalSetViewportMetrics(mojom::ViewportMetrics(), *window_data->viewport_metrics); private_window.set_properties( window_data->properties @@ -46,7 +46,7 @@ Window* AddWindowToConnection(WindowTreeClientImpl* client, } Window* BuildWindowTree(WindowTreeClientImpl* client, - const mojo::Array<mojo::ViewDataPtr>& windows, + const mojo::Array<mojom::WindowDataPtr>& windows, Window* initial_parent) { std::vector<Window*> parents; Window* root = NULL; @@ -71,7 +71,7 @@ Window* BuildWindowTree(WindowTreeClientImpl* client, WindowTreeConnection* WindowTreeConnection::Create( WindowTreeDelegate* delegate, - mojo::InterfaceRequest<mojo::ViewTreeClient> request, + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request, CreateType create_type) { WindowTreeClientImpl* client = new WindowTreeClientImpl(delegate, request.Pass()); @@ -82,7 +82,7 @@ WindowTreeConnection* WindowTreeConnection::Create( WindowTreeClientImpl::WindowTreeClientImpl( WindowTreeDelegate* delegate, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) : connection_id_(0), next_id_(1), delegate_(delegate), @@ -127,25 +127,25 @@ void WindowTreeClientImpl::WaitForEmbed() { void WindowTreeClientImpl::DestroyWindow(Id window_id) { DCHECK(tree_); - tree_->DeleteView(window_id, ActionCompletedCallback()); + tree_->DeleteWindow(window_id, ActionCompletedCallback()); } void WindowTreeClientImpl::AddChild(Id child_id, Id parent_id) { DCHECK(tree_); - tree_->AddView(parent_id, child_id, ActionCompletedCallback()); + tree_->AddWindow(parent_id, child_id, ActionCompletedCallback()); } void WindowTreeClientImpl::RemoveChild(Id child_id, Id parent_id) { DCHECK(tree_); - tree_->RemoveViewFromParent(child_id, ActionCompletedCallback()); + tree_->RemoveWindowFromParent(child_id, ActionCompletedCallback()); } void WindowTreeClientImpl::Reorder(Id window_id, Id relative_window_id, - mojo::OrderDirection direction) { + mojom::OrderDirection direction) { DCHECK(tree_); - tree_->ReorderView(window_id, relative_window_id, direction, - ActionCompletedCallback()); + tree_->ReorderWindow(window_id, relative_window_id, direction, + ActionCompletedCallback()); } bool WindowTreeClientImpl::OwnsWindow(Id id) const { @@ -154,7 +154,7 @@ bool WindowTreeClientImpl::OwnsWindow(Id id) const { void WindowTreeClientImpl::SetBounds(Id window_id, const mojo::Rect& bounds) { DCHECK(tree_); - tree_->SetViewBounds(window_id, bounds.Clone(), ActionCompletedCallback()); + tree_->SetWindowBounds(window_id, bounds.Clone(), ActionCompletedCallback()); } void WindowTreeClientImpl::SetClientArea(Id window_id, @@ -173,23 +173,23 @@ void WindowTreeClientImpl::SetFocus(Id window_id) { void WindowTreeClientImpl::SetVisible(Id window_id, bool visible) { DCHECK(tree_); - tree_->SetViewVisibility(window_id, visible, ActionCompletedCallback()); + tree_->SetWindowVisibility(window_id, visible, ActionCompletedCallback()); } void WindowTreeClientImpl::SetProperty(Id window_id, const std::string& name, const std::vector<uint8_t>& data) { DCHECK(tree_); - tree_->SetViewProperty(window_id, mojo::String(name), - mojo::Array<uint8_t>::From(data), - ActionCompletedCallback()); + tree_->SetWindowProperty(window_id, mojo::String(name), + mojo::Array<uint8_t>::From(data), + ActionCompletedCallback()); } -void WindowTreeClientImpl::SetViewTextInputState( +void WindowTreeClientImpl::SetWindowTextInputState( Id window_id, mojo::TextInputStatePtr state) { DCHECK(tree_); - tree_->SetViewTextInputState(window_id, state.Pass()); + tree_->SetWindowTextInputState(window_id, state.Pass()); } void WindowTreeClientImpl::SetImeVisibility(Id window_id, @@ -201,17 +201,17 @@ void WindowTreeClientImpl::SetImeVisibility(Id window_id, void WindowTreeClientImpl::Embed( Id window_id, - mojo::ViewTreeClientPtr client, + mus::mojom::WindowTreeClientPtr client, uint32_t policy_bitmask, - const mojo::ViewTree::EmbedCallback& callback) { + const mus::mojom::WindowTree::EmbedCallback& callback) { DCHECK(tree_); tree_->Embed(window_id, client.Pass(), policy_bitmask, callback); } void WindowTreeClientImpl::RequestSurface( Id window_id, - mojo::InterfaceRequest<mojo::Surface> surface, - mojo::SurfaceClientPtr client) { + mojo::InterfaceRequest<mojom::Surface> surface, + mojom::SurfaceClientPtr client) { DCHECK(tree_); tree_->RequestSurface(window_id, surface.Pass(), client.Pass()); } @@ -245,8 +245,8 @@ void WindowTreeClientImpl::OnRootDestroyed(Window* root) { Id WindowTreeClientImpl::CreateWindowOnServer() { DCHECK(tree_); const Id window_id = MakeTransportId(connection_id_, next_id_++); - tree_->CreateView(window_id, [this](mojo::ErrorCode code) { - OnActionCompleted(code == mojo::ERROR_CODE_NONE); + tree_->NewWindow(window_id, [this](mojom::ErrorCode code) { + OnActionCompleted(code == mojom::ERROR_CODE_NONE); }); return window_id; } @@ -279,11 +279,11 @@ ConnectionSpecificId WindowTreeClientImpl::GetConnectionId() { } //////////////////////////////////////////////////////////////////////////////// -// WindowTreeClientImpl, ViewTreeClient implementation: +// WindowTreeClientImpl, WindowTreeClient implementation: void WindowTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, - mojo::ViewDataPtr root_data, - mojo::ViewTreePtr tree, + mojom::WindowDataPtr root_data, + mus::mojom::WindowTreePtr tree, Id focused_window_id, uint32 access_policy) { if (tree) { @@ -293,7 +293,7 @@ void WindowTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, } connection_id_ = connection_id; is_embed_root_ = - (access_policy & mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT) != 0; + (access_policy & mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT) != 0; DCHECK(!root_); root_ = AddWindowToConnection(this, nullptr, root_data); @@ -335,8 +335,8 @@ void WindowTreeClientImpl::OnClientAreaChanged(uint32_t window_id, namespace { void SetViewportMetricsOnDecendants(Window* root, - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) { + const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics) { WindowPrivate(root).LocalSetViewportMetrics(old_metrics, new_metrics); const Window::Children& children = root->children(); for (size_t i = 0; i < children.size(); ++i) @@ -345,8 +345,8 @@ void SetViewportMetricsOnDecendants(Window* root, } void WindowTreeClientImpl::OnWindowViewportMetricsChanged( - mojo::ViewportMetricsPtr old_metrics, - mojo::ViewportMetricsPtr new_metrics) { + mojom::ViewportMetricsPtr old_metrics, + mojom::ViewportMetricsPtr new_metrics) { Window* window = GetRoot(); if (window) SetViewportMetricsOnDecendants(window, *old_metrics, *new_metrics); @@ -356,7 +356,7 @@ void WindowTreeClientImpl::OnWindowHierarchyChanged( Id window_id, Id new_parent_id, Id old_parent_id, - mojo::Array<mojo::ViewDataPtr> windows) { + mojo::Array<mojom::WindowDataPtr> windows) { Window* initial_parent = windows.size() ? GetWindowById(windows[0]->parent_id) : NULL; @@ -381,7 +381,7 @@ void WindowTreeClientImpl::OnWindowHierarchyChanged( void WindowTreeClientImpl::OnWindowReordered(Id window_id, Id relative_window_id, - mojo::OrderDirection direction) { + mojom::OrderDirection direction) { Window* window = GetWindowById(window_id); Window* relative_window = GetWindowById(relative_window_id); if (window && relative_window) diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.h b/components/mus/public/cpp/lib/window_tree_client_impl.h index fc9f5ee..a50b36d 100644 --- a/components/mus/public/cpp/lib/window_tree_client_impl.h +++ b/components/mus/public/cpp/lib/window_tree_client_impl.h @@ -8,7 +8,7 @@ #include "components/mus/public/cpp/types.h" #include "components/mus/public/cpp/window.h" #include "components/mus/public/cpp/window_tree_connection.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" namespace mus { @@ -17,10 +17,11 @@ class WindowTreeDelegate; // Manages the connection with the Window Server service. class WindowTreeClientImpl : public WindowTreeConnection, - public mojo::ViewTreeClient { + public mus::mojom::WindowTreeClient { public: - WindowTreeClientImpl(WindowTreeDelegate* delegate, - mojo::InterfaceRequest<mojo::ViewTreeClient> request); + WindowTreeClientImpl( + WindowTreeDelegate* delegate, + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request); ~WindowTreeClientImpl() override; // Wait for OnEmbed(), returning when done. @@ -42,7 +43,7 @@ class WindowTreeClientImpl : public WindowTreeConnection, void Reorder(Id window_id, Id relative_window_id, - mojo::OrderDirection direction); + mojom::OrderDirection direction); // Returns true if the specified window was created by this connection. bool OwnsWindow(Id id) const; @@ -54,19 +55,19 @@ class WindowTreeClientImpl : public WindowTreeConnection, void SetProperty(Id window_id, const std::string& name, const std::vector<uint8_t>& data); - void SetViewTextInputState(Id window_id, mojo::TextInputStatePtr state); + void SetWindowTextInputState(Id window_id, mojo::TextInputStatePtr state); void SetImeVisibility(Id window_id, bool visible, mojo::TextInputStatePtr state); void Embed(Id window_id, - mojo::ViewTreeClientPtr client, + mus::mojom::WindowTreeClientPtr client, uint32_t policy_bitmask, - const mojo::ViewTree::EmbedCallback& callback); + const mus::mojom::WindowTree::EmbedCallback& callback); void RequestSurface(Id window_id, - mojo::InterfaceRequest<mojo::Surface> surface, - mojo::SurfaceClientPtr client); + mojo::InterfaceRequest<mojom::Surface> surface, + mojom::SurfaceClientPtr client); void set_change_acked_callback(const mojo::Callback<void(void)>& callback) { change_acked_callback_ = callback; @@ -98,10 +99,10 @@ class WindowTreeClientImpl : public WindowTreeConnection, bool IsEmbedRoot() override; ConnectionSpecificId GetConnectionId() override; - // Overridden from ViewTreeClient: + // Overridden from WindowTreeClient: void OnEmbed(ConnectionSpecificId connection_id, - mojo::ViewDataPtr root, - mojo::ViewTreePtr tree, + mojom::WindowDataPtr root, + mojom::WindowTreePtr tree, Id focused_window_id, uint32_t access_policy) override; void OnEmbeddedAppDisconnected(Id window_id) override; @@ -113,16 +114,16 @@ class WindowTreeClientImpl : public WindowTreeConnection, mojo::RectPtr old_client_area, mojo::RectPtr new_client_area) override; void OnWindowViewportMetricsChanged( - mojo::ViewportMetricsPtr old_metrics, - mojo::ViewportMetricsPtr new_metrics) override; + mojom::ViewportMetricsPtr old_metrics, + mojom::ViewportMetricsPtr new_metrics) override; void OnWindowHierarchyChanged( Id window_id, Id new_parent_id, Id old_parent_id, - mojo::Array<mojo::ViewDataPtr> windows) override; + mojo::Array<mojom::WindowDataPtr> windows) override; void OnWindowReordered(Id window_id, Id relative_window_id, - mojo::OrderDirection direction) override; + mojom::OrderDirection direction) override; void OnWindowDeleted(Id window_id) override; void OnWindowVisibilityChanged(Id window_id, bool visible) override; void OnWindowDrawnStateChanged(Id window_id, bool drawn) override; @@ -155,8 +156,8 @@ class WindowTreeClientImpl : public WindowTreeConnection, Window* focused_window_; Window* activated_window_; - mojo::Binding<ViewTreeClient> binding_; - mojo::ViewTreePtr tree_; + mojo::Binding<WindowTreeClient> binding_; + mus::mojom::WindowTreePtr tree_; bool is_embed_root_; diff --git a/components/mus/public/cpp/lib/window_tree_host_factory.cc b/components/mus/public/cpp/lib/window_tree_host_factory.cc index 0636559..e63c604 100644 --- a/components/mus/public/cpp/lib/window_tree_host_factory.cc +++ b/components/mus/public/cpp/lib/window_tree_host_factory.cc @@ -10,11 +10,11 @@ namespace mus { -void CreateWindowTreeHost(mojo::ViewTreeHostFactory* factory, - mojo::ViewTreeHostClientPtr host_client, +void CreateWindowTreeHost(mojom::WindowTreeHostFactory* factory, + mojom::WindowTreeHostClientPtr host_client, WindowTreeDelegate* delegate, - mojo::ViewTreeHostPtr* host) { - mojo::ViewTreeClientPtr tree_client; + mojom::WindowTreeHostPtr* host) { + mojom::WindowTreeClientPtr tree_client; WindowTreeConnection::Create( delegate, GetProxy(&tree_client), WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); @@ -24,13 +24,13 @@ void CreateWindowTreeHost(mojo::ViewTreeHostFactory* factory, void CreateSingleWindowTreeHost(mojo::ApplicationImpl* app, WindowTreeDelegate* delegate, - mojo::ViewTreeHostPtr* host) { - mojo::ViewTreeHostFactoryPtr factory; + mojom::WindowTreeHostPtr* host) { + mojom::WindowTreeHostFactoryPtr factory; mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = "mojo:mus"; app->ConnectToService(request.Pass(), &factory); - CreateWindowTreeHost(factory.get(), mojo::ViewTreeHostClientPtr(), delegate, - host); + CreateWindowTreeHost(factory.get(), mojom::WindowTreeHostClientPtr(), + delegate, host); } } // namespace mus diff --git a/components/mus/public/cpp/output_surface.h b/components/mus/public/cpp/output_surface.h index f99665d..a6c627a 100644 --- a/components/mus/public/cpp/output_surface.h +++ b/components/mus/public/cpp/output_surface.h @@ -29,7 +29,7 @@ class OutputSurface : public cc::OutputSurface, public WindowSurfaceClient { // WindowSurfaceClient implementation: void OnResourcesReturned( WindowSurface* surface, - mojo::Array<mojo::ReturnedResourcePtr> resources) override; + mojo::Array<mojom::ReturnedResourcePtr> resources) override; void SwapBuffersComplete(); diff --git a/components/mus/public/cpp/tests/window_server_test_base.cc b/components/mus/public/cpp/tests/window_server_test_base.cc index 649fc24..7d32893 100644 --- a/components/mus/public/cpp/tests/window_server_test_base.cc +++ b/components/mus/public/cpp/tests/window_server_test_base.cc @@ -79,7 +79,7 @@ mojo::ApplicationDelegate* WindowServerTestBase::GetApplicationDelegate() { bool WindowServerTestBase::ConfigureIncomingConnection( mojo::ApplicationConnection* connection) { - connection->AddService<mojo::ViewTreeClient>(this); + connection->AddService<mojom::WindowTreeClient>(this); return true; } @@ -94,7 +94,7 @@ void WindowServerTestBase::OnConnectionLost(WindowTreeConnection* connection) { void WindowServerTestBase::Create( mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) { + mojo::InterfaceRequest<mojom::WindowTreeClient> request) { WindowTreeConnection::Create( this, request.Pass(), WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); diff --git a/components/mus/public/cpp/tests/window_server_test_base.h b/components/mus/public/cpp/tests/window_server_test_base.h index b46c871..cde211b 100644 --- a/components/mus/public/cpp/tests/window_server_test_base.h +++ b/components/mus/public/cpp/tests/window_server_test_base.h @@ -7,8 +7,8 @@ #include "base/memory/scoped_ptr.h" #include "components/mus/public/cpp/window_tree_delegate.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "mojo/application/public/cpp/application_delegate.h" #include "mojo/application/public/cpp/application_test_base.h" #include "mojo/application/public/cpp/interface_factory.h" @@ -23,7 +23,7 @@ class WindowServerTestBase : public mojo::test::ApplicationTestBase, public mojo::ApplicationDelegate, public WindowTreeDelegate, - public mojo::InterfaceFactory<mojo::ViewTreeClient> { + public mojo::InterfaceFactory<mojom::WindowTreeClient> { public: WindowServerTestBase(); ~WindowServerTestBase() override; @@ -64,16 +64,16 @@ class WindowServerTestBase void OnEmbed(Window* root) override; void OnConnectionLost(WindowTreeConnection* connection) override; - // InterfaceFactory<ViewTreeClient>: + // InterfaceFactory<WindowTreeClient>: void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) override; + mojo::InterfaceRequest<mojom::WindowTreeClient> request) override; // Used to receive the most recent view tree connection loaded by an embed // action. WindowTreeConnection* most_recent_connection_; private: - mojo::ViewTreeHostPtr host_; + mojom::WindowTreeHostPtr host_; // The View Manager connection held by the window manager (app running at the // root view). diff --git a/components/mus/public/cpp/tests/window_unittest.cc b/components/mus/public/cpp/tests/window_unittest.cc index 870a026..ef067ea 100644 --- a/components/mus/public/cpp/tests/window_unittest.cc +++ b/components/mus/public/cpp/tests/window_unittest.cc @@ -423,7 +423,7 @@ class OrderChangeObserver : public WindowObserver { struct Change { Window* window; Window* relative_window; - mojo::OrderDirection direction; + mojom::OrderDirection direction; }; typedef std::vector<Change> Changes; @@ -442,13 +442,13 @@ class OrderChangeObserver : public WindowObserver { // Overridden from WindowObserver: void OnWindowReordering(Window* window, Window* relative_window, - mojo::OrderDirection direction) override { + mojom::OrderDirection direction) override { OnWindowReordered(window, relative_window, direction); } void OnWindowReordered(Window* window, Window* relative_window, - mojo::OrderDirection direction) override { + mojom::OrderDirection direction) override { Change change; change.window = window; change.relative_window = relative_window; @@ -488,11 +488,11 @@ TEST_F(WindowObserverTest, Order) { ASSERT_EQ(2U, changes.size()); EXPECT_EQ(&w11, changes[0].window); EXPECT_EQ(&w13, changes[0].relative_window); - EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[0].direction); + EXPECT_EQ(mojom::ORDER_DIRECTION_ABOVE, changes[0].direction); EXPECT_EQ(&w11, changes[1].window); EXPECT_EQ(&w13, changes[1].relative_window); - EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[1].direction); + EXPECT_EQ(mojom::ORDER_DIRECTION_ABOVE, changes[1].direction); } { @@ -508,11 +508,11 @@ TEST_F(WindowObserverTest, Order) { ASSERT_EQ(2U, changes.size()); EXPECT_EQ(&w11, changes[0].window); EXPECT_EQ(&w12, changes[0].relative_window); - EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[0].direction); + EXPECT_EQ(mojom::ORDER_DIRECTION_BELOW, changes[0].direction); EXPECT_EQ(&w11, changes[1].window); EXPECT_EQ(&w12, changes[1].relative_window); - EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[1].direction); + EXPECT_EQ(mojom::ORDER_DIRECTION_BELOW, changes[1].direction); } { @@ -520,7 +520,7 @@ TEST_F(WindowObserverTest, Order) { // Move w11 above w12. // Resulting order: w12. w11, w13 - w11.Reorder(&w12, mojo::ORDER_DIRECTION_ABOVE); + w11.Reorder(&w12, mojom::ORDER_DIRECTION_ABOVE); EXPECT_EQ(&w12, w1.children().front()); EXPECT_EQ(&w13, w1.children().back()); @@ -528,11 +528,11 @@ TEST_F(WindowObserverTest, Order) { ASSERT_EQ(2U, changes.size()); EXPECT_EQ(&w11, changes[0].window); EXPECT_EQ(&w12, changes[0].relative_window); - EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[0].direction); + EXPECT_EQ(mojom::ORDER_DIRECTION_ABOVE, changes[0].direction); EXPECT_EQ(&w11, changes[1].window); EXPECT_EQ(&w12, changes[1].relative_window); - EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[1].direction); + EXPECT_EQ(mojom::ORDER_DIRECTION_ABOVE, changes[1].direction); } { @@ -540,7 +540,7 @@ TEST_F(WindowObserverTest, Order) { // Move w11 below w12. // Resulting order: w11, w12, w13 - w11.Reorder(&w12, mojo::ORDER_DIRECTION_BELOW); + w11.Reorder(&w12, mojom::ORDER_DIRECTION_BELOW); EXPECT_EQ(&w11, w1.children().front()); EXPECT_EQ(&w13, w1.children().back()); @@ -548,11 +548,11 @@ TEST_F(WindowObserverTest, Order) { ASSERT_EQ(2U, changes.size()); EXPECT_EQ(&w11, changes[0].window); EXPECT_EQ(&w12, changes[0].relative_window); - EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[0].direction); + EXPECT_EQ(mojom::ORDER_DIRECTION_BELOW, changes[0].direction); EXPECT_EQ(&w11, changes[1].window); EXPECT_EQ(&w12, changes[1].relative_window); - EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[1].direction); + EXPECT_EQ(mojom::ORDER_DIRECTION_BELOW, changes[1].direction); } } diff --git a/components/mus/public/cpp/window.h b/components/mus/public/cpp/window.h index db3be8f..5d36611 100644 --- a/components/mus/public/cpp/window.h +++ b/components/mus/public/cpp/window.h @@ -13,7 +13,7 @@ #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_tree.mojom.h" +#include "components/mus/public/interfaces/window_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" @@ -66,7 +66,9 @@ class Window { bool visible() const { return visible_; } void SetVisible(bool value); - const mojo::ViewportMetrics& viewport_metrics() { return *viewport_metrics_; } + const mojom::ViewportMetrics& viewport_metrics() { + return *viewport_metrics_; + } scoped_ptr<WindowSurface> RequestSurface(); @@ -124,7 +126,7 @@ class Window { void AddChild(Window* child); void RemoveChild(Window* child); - void Reorder(Window* relative, mojo::OrderDirection direction); + void Reorder(Window* relative, mojom::OrderDirection direction); void MoveToFront(); void MoveToBack(); @@ -139,12 +141,12 @@ class Window { void SetFocus(); bool HasFocus() const; - // Embedding. See view_tree.mojom for details. - void Embed(mojo::ViewTreeClientPtr client); + // Embedding. See window_tree.mojom for details. + void Embed(mus::mojom::WindowTreeClientPtr client); // NOTE: callback is run synchronously if Embed() is not allowed on this // Window. - void Embed(mojo::ViewTreeClientPtr client, + void Embed(mus::mojom::WindowTreeClientPtr client, uint32_t policy_bitmask, const EmbedCallback& callback); @@ -172,12 +174,12 @@ class Window { void LocalAddChild(Window* child); void LocalRemoveChild(Window* child); // Returns true if the order actually changed. - bool LocalReorder(Window* relative, mojo::OrderDirection direction); + bool LocalReorder(Window* relative, mojom::OrderDirection direction); void LocalSetBounds(const mojo::Rect& old_bounds, const mojo::Rect& new_bounds); void LocalSetClientArea(const mojo::Rect& new_client_area); - void LocalSetViewportMetrics(const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics); + void LocalSetViewportMetrics(const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics); void LocalSetDrawn(bool drawn); void LocalSetVisible(bool visible); @@ -207,7 +209,7 @@ class Window { mojo::Rect bounds_; mojo::Rect client_area_; - mojo::ViewportMetricsPtr viewport_metrics_; + mojom::ViewportMetricsPtr viewport_metrics_; bool visible_; diff --git a/components/mus/public/cpp/window_observer.h b/components/mus/public/cpp/window_observer.h index 5ab18f0..f9da327 100644 --- a/components/mus/public/cpp/window_observer.h +++ b/components/mus/public/cpp/window_observer.h @@ -40,10 +40,10 @@ class WindowObserver { virtual void OnWindowReordering(Window* window, Window* relative_window, - mojo::OrderDirection direction) {} + mojom::OrderDirection direction) {} virtual void OnWindowReordered(Window* window, Window* relative_window, - mojo::OrderDirection direction) {} + mojom::OrderDirection direction) {} virtual void OnWindowDestroying(Window* window) {} virtual void OnWindowDestroyed(Window* window) {} @@ -59,8 +59,8 @@ class WindowObserver { virtual void OnWindowViewportMetricsChanged( Window* window, - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) {} + const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics) {} virtual void OnWindowFocusChanged(Window* gained_focus, Window* lost_focus) {} diff --git a/components/mus/public/cpp/window_surface.h b/components/mus/public/cpp/window_surface.h index 284e48c..2153891 100644 --- a/components/mus/public/cpp/window_surface.h +++ b/components/mus/public/cpp/window_surface.h @@ -18,7 +18,7 @@ class Window; // A WindowSurface is wrapper to simplify submitting CompositorFrames to Views, // and receiving ReturnedResources. -class WindowSurface : public mojo::SurfaceClient { +class WindowSurface : public mojom::SurfaceClient { public: ~WindowSurface() override; @@ -26,7 +26,7 @@ class WindowSurface : public mojo::SurfaceClient { // object. void BindToThread(); - void SubmitCompositorFrame(mojo::CompositorFramePtr frame, + void SubmitCompositorFrame(mojom::CompositorFramePtr frame, const mojo::Closure& callback); void set_client(WindowSurfaceClient* client) { client_ = client; } @@ -34,18 +34,18 @@ class WindowSurface : public mojo::SurfaceClient { private: friend class Window; - WindowSurface(mojo::InterfacePtrInfo<mojo::Surface> surface_info, - mojo::InterfaceRequest<mojo::SurfaceClient> client_request); + WindowSurface(mojo::InterfacePtrInfo<mojom::Surface> surface_info, + mojo::InterfaceRequest<mojom::SurfaceClient> client_request); // SurfaceClient implementation: void ReturnResources( - mojo::Array<mojo::ReturnedResourcePtr> resources) override; + mojo::Array<mojom::ReturnedResourcePtr> resources) override; WindowSurfaceClient* client_; - mojo::InterfacePtrInfo<mojo::Surface> surface_info_; - mojo::InterfaceRequest<mojo::SurfaceClient> client_request_; - mojo::SurfacePtr surface_; - scoped_ptr<mojo::Binding<mojo::SurfaceClient>> client_binding_; + mojo::InterfacePtrInfo<mojom::Surface> surface_info_; + mojo::InterfaceRequest<mojom::SurfaceClient> client_request_; + mojom::SurfacePtr surface_; + scoped_ptr<mojo::Binding<mojom::SurfaceClient>> client_binding_; bool bound_to_thread_; }; diff --git a/components/mus/public/cpp/window_surface_client.h b/components/mus/public/cpp/window_surface_client.h index 0906c8a..54be95e 100644 --- a/components/mus/public/cpp/window_surface_client.h +++ b/components/mus/public/cpp/window_surface_client.h @@ -13,7 +13,7 @@ class WindowSurfaceClient { public: virtual void OnResourcesReturned( WindowSurface* surface, - mojo::Array<mojo::ReturnedResourcePtr> resources) = 0; + mojo::Array<mojom::ReturnedResourcePtr> resources) = 0; protected: ~WindowSurfaceClient() {} diff --git a/components/mus/public/cpp/window_tree_connection.h b/components/mus/public/cpp/window_tree_connection.h index d677b2a..b212c10 100644 --- a/components/mus/public/cpp/window_tree_connection.h +++ b/components/mus/public/cpp/window_tree_connection.h @@ -8,7 +8,7 @@ #include <string> #include "components/mus/public/cpp/types.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" #if defined(OS_WIN) @@ -41,7 +41,7 @@ class WindowTreeConnection { // the last root is destroyed or the connection to the service is broken. static WindowTreeConnection* Create( WindowTreeDelegate* delegate, - mojo::InterfaceRequest<mojo::ViewTreeClient> request, + mojo::InterfaceRequest<mojom::WindowTreeClient> request, CreateType create_type); // Returns the root of this connection. diff --git a/components/mus/public/cpp/window_tree_delegate.h b/components/mus/public/cpp/window_tree_delegate.h index 2d6874b..e93b34e 100644 --- a/components/mus/public/cpp/window_tree_delegate.h +++ b/components/mus/public/cpp/window_tree_delegate.h @@ -7,7 +7,7 @@ #include <string> -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "mojo/application/public/interfaces/service_provider.mojom.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h" diff --git a/components/mus/public/cpp/window_tree_host_factory.h b/components/mus/public/cpp/window_tree_host_factory.h index c4e0790..232f469 100644 --- a/components/mus/public/cpp/window_tree_host_factory.h +++ b/components/mus/public/cpp/window_tree_host_factory.h @@ -7,8 +7,8 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" namespace mojo { @@ -21,16 +21,16 @@ class WindowTreeDelegate; // Uses |factory| to create a new |host|, providing the supplied |host_client| // which may be null. |delegate| must not be null. -void CreateWindowTreeHost(mojo::ViewTreeHostFactory* factory, - mojo::ViewTreeHostClientPtr host_client, +void CreateWindowTreeHost(mojom::WindowTreeHostFactory* factory, + mojom::WindowTreeHostClientPtr host_client, WindowTreeDelegate* delegate, - mojo::ViewTreeHostPtr* host); + mojom::WindowTreeHostPtr* host); // Creates a single host with no client by connecting to the view manager // application. Useful only for tests and trivial UIs. void CreateSingleWindowTreeHost(mojo::ApplicationImpl* app, WindowTreeDelegate* delegate, - mojo::ViewTreeHostPtr* host); + mojom::WindowTreeHostPtr* host); } // namespace mus diff --git a/components/mus/public/interfaces/BUILD.gn b/components/mus/public/interfaces/BUILD.gn index f03d2a6..d218750 100644 --- a/components/mus/public/interfaces/BUILD.gn +++ b/components/mus/public/interfaces/BUILD.gn @@ -13,9 +13,9 @@ mojom("interfaces") { "mus_constants.mojom", "quads.mojom", "surface_id.mojom", - "view_tree.mojom", - "view_tree_host.mojom", "window_manager.mojom", + "window_tree.mojom", + "window_tree_host.mojom", ] import_dirs = [ diff --git a/components/mus/public/interfaces/command_buffer.mojom b/components/mus/public/interfaces/command_buffer.mojom index 1af78e5..240078f 100644 --- a/components/mus/public/interfaces/command_buffer.mojom +++ b/components/mus/public/interfaces/command_buffer.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mus.mojom; import "components/mus/public/interfaces/gpu_capabilities.mojom"; import "ui/mojo/geometry/geometry.mojom"; @@ -59,7 +59,7 @@ interface CommandBuffer { CreateImage(int32 id, handle memory_handle, int32 type, - Size size, + mojo.Size size, int32 format, int32 internal_format); DestroyImage(int32 id); diff --git a/components/mus/public/interfaces/compositor_frame.mojom b/components/mus/public/interfaces/compositor_frame.mojom index ff0e31d..7c7474e 100644 --- a/components/mus/public/interfaces/compositor_frame.mojom +++ b/components/mus/public/interfaces/compositor_frame.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mus.mojom; import "ui/mojo/geometry/geometry.mojom"; import "components/mus/public/interfaces/quads.mojom"; @@ -47,7 +47,7 @@ struct TransferableResource { uint32 id; ResourceFormat format; uint32 filter; - Size size; + mojo.Size size; MailboxHolder mailbox_holder; bool is_repeated; bool is_software; diff --git a/components/mus/public/interfaces/gpu.mojom b/components/mus/public/interfaces/gpu.mojom index 7c387db..643443d 100644 --- a/components/mus/public/interfaces/gpu.mojom +++ b/components/mus/public/interfaces/gpu.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mus.mojom; import "components/mus/public/interfaces/command_buffer.mojom"; diff --git a/components/mus/public/interfaces/gpu_capabilities.mojom b/components/mus/public/interfaces/gpu_capabilities.mojom index 2450139..5518583 100644 --- a/components/mus/public/interfaces/gpu_capabilities.mojom +++ b/components/mus/public/interfaces/gpu_capabilities.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mus.mojom; struct GpuShaderPrecision { int32 min_range; diff --git a/components/mus/public/interfaces/mus_constants.mojom b/components/mus/public/interfaces/mus_constants.mojom index 14bd363..f17cedb 100644 --- a/components/mus/public/interfaces/mus_constants.mojom +++ b/components/mus/public/interfaces/mus_constants.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mus.mojom; enum OrderDirection { ABOVE = 1, diff --git a/components/mus/public/interfaces/quads.mojom b/components/mus/public/interfaces/quads.mojom index b760d11..dcc4168 100644 --- a/components/mus/public/interfaces/quads.mojom +++ b/components/mus/public/interfaces/quads.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mus.mojom; import "components/mus/public/interfaces/surface_id.mojom"; import "ui/mojo/geometry/geometry.mojom"; @@ -41,8 +41,8 @@ struct RenderPassQuadState { // If nonzero, resource id of mask to use when drawing this pass. uint32 mask_resource_id; - PointF mask_uv_scale; - Size mask_texture_size; + mojo.PointF mask_uv_scale; + mojo.Size mask_texture_size; // Post-processing filters, applied to the pixels in the render pass' texture. // TODO(jamesr): Support @@ -52,7 +52,7 @@ struct RenderPassQuadState { // the render pass physical pixels. This scale is applied to the filter // parameters for pixel-moving filters. This scale should include // content-to-target-space scale, and device pixel ratio. - PointF filters_scale; + mojo.PointF filters_scale; // Post-processing filters, applied to the pixels showing through the // background of the render pass, from behind it. @@ -66,14 +66,14 @@ struct SolidColorQuadState { }; struct SurfaceQuadState { - SurfaceId surface; + mus.mojom.SurfaceId surface; }; struct TextureQuadState { uint32 resource_id; bool premultiplied_alpha; - PointF uv_top_left; - PointF uv_bottom_right; + mojo.PointF uv_top_left; + mojo.PointF uv_bottom_right; Color background_color; array<float, 4> vertex_opacity; bool y_flipped; @@ -81,8 +81,8 @@ struct TextureQuadState { }; struct TileQuadState { - RectF tex_coord_rect; - Size texture_size; + mojo.RectF tex_coord_rect; + mojo.Size texture_size; bool swizzle_contents; uint32 resource_id; bool nearest_neighbor; @@ -97,10 +97,10 @@ enum YUVColorSpace { }; struct YUVVideoQuadState { - RectF ya_tex_coord_rect; - RectF uv_tex_coord_rect; - Size ya_tex_size; - Size uv_tex_size; + mojo.RectF ya_tex_coord_rect; + mojo.RectF uv_tex_coord_rect; + mojo.Size ya_tex_size; + mojo.Size uv_tex_size; uint32 y_plane_resource_id; uint32 u_plane_resource_id; uint32 v_plane_resource_id; @@ -126,15 +126,15 @@ struct Quad { // This rect, after applying the quad_transform(), gives the geometry that // this quad should draw to. This rect lives in content space. - Rect rect; + mojo.Rect rect; // This specifies the region of the quad that is opaque. This rect lives in // content space. - Rect opaque_rect; + mojo.Rect opaque_rect; // Allows changing the rect that gets drawn to make it smaller. This value // should be clipped to |rect|. This rect lives in content space. - Rect visible_rect; + mojo.Rect visible_rect; // Allows changing the rect that gets drawn to make it smaller. This value // should be clipped to |rect|. This rect lives in content space. @@ -198,18 +198,18 @@ enum SkXfermode { }; struct SharedQuadState { - // Transforms quad rects into the target content space. - Transform quad_to_target_transform; + // mojo.Transforms quad rects into the target content space. + mojo.Transform quad_to_target_transform; // The size of the quads' originating layer in the space of the quad rects. - Size quad_layer_bounds; + mojo.Size quad_layer_bounds; // The size of the visible area in the quads' originating layer, in the space // of the quad rects. - Rect visible_quad_layer_rect; + mojo.Rect visible_quad_layer_rect; // This rect lives in the target content space. - Rect clip_rect; + mojo.Rect clip_rect; bool is_clipped; float opacity; @@ -219,9 +219,9 @@ struct SharedQuadState { struct Pass { RenderPassId id; - Rect output_rect; - Rect damage_rect; - Transform transform_to_root_target; + mojo.Rect output_rect; + mojo.Rect damage_rect; + mojo.Transform transform_to_root_target; bool has_transparent_background; array<Quad> quads; array<SharedQuadState> shared_quad_states; diff --git a/components/mus/public/interfaces/surface_id.mojom b/components/mus/public/interfaces/surface_id.mojom index 197e6f8b..7d6f657 100644 --- a/components/mus/public/interfaces/surface_id.mojom +++ b/components/mus/public/interfaces/surface_id.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mus.mojom; // A surface ID is composed of two parts, a local part and a namespace. The // local part is allocated by the client using any scheme that avoids diff --git a/components/mus/public/interfaces/view_tree.mojom b/components/mus/public/interfaces/view_tree.mojom deleted file mode 100644 index a54c94d..0000000 --- a/components/mus/public/interfaces/view_tree.mojom +++ /dev/null @@ -1,258 +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; - -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 "mojo/application/public/interfaces/service_provider.mojom"; -import "network/public/interfaces/url_loader.mojom"; -import "ui/mojo/events/input_events.mojom"; -import "ui/mojo/ime/text_input_state.mojom"; -import "ui/mojo/geometry/geometry.mojom"; - -struct ViewportMetrics { - Size size_in_pixels; - // A value of 0 indicates the real value is not yet available. - float device_pixel_ratio = 0.0; -}; - -struct ViewData { - uint32 parent_id; - uint32 view_id; - mojo.Rect bounds; - map<string, array<uint8>> properties; - // True if this view is visible. The view may not be drawn on screen (see - // drawn for specifics). - bool visible; - // True if this view is drawn on screen. A view is drawn if attached to the - // root and all ancestors (including this view) are visible. - bool drawn; - ViewportMetrics viewport_metrics; -}; - -enum ErrorCode { - NONE, - VALUE_IN_USE, - ILLEGAL_ARGUMENT, -}; - -// Views are identified by a uint32. The upper 16 bits are the connection id, -// and the lower 16 the id assigned by the client. -// -// The root view is identified with a connection id of 0, and value of 1. -interface ViewTree { - enum AccessPolicy { - DEFAULT = 0, - - // An embed root has the following abilities: - // . The app sees all the descendants of the view the app is ebmedded at, - // even those from separate connections. - // . The app is able to Embed() in all the descendants of the view the app - // is embedded at, even those from separate connections. - // Only connections originating from the ViewTreeHostFactory can grant this - // policy. - EMBED_ROOT = 1, - }; - - // Creates a new view with the specified id. It is up to the client to ensure - // the id is unique to the connection (the id need not be globally unique). - // Additionally the connection id (embedded in |view_id|) must match that of - // the connection. - // Errors: - // ERROR_CODE_VALUE_IN_USE: a view already exists with the specified id. - // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |view_id| does not - // match the connection id of the client. - // - // TODO(erg): Once we have default values in mojo, make this take a map of - // properties. - CreateView(uint32 view_id) => (ErrorCode error_code); - - // Deletes a view. This does not recurse. No hierarchy change notifications - // are sent as a result of this. Only the connection that created the view can - // delete it. - DeleteView(uint32 view_id) => (bool success); - - // Sets the specified bounds of the specified view. - SetViewBounds(uint32 view_id, mojo.Rect bounds) => (bool success); - - // Sets the client area of the specified window. Areas outside the client - // area are treated specially. - SetClientArea(uint32 window_id, Rect rect); - - // Sets the visibility of the specified view to |visible|. Connections are - // allowed to change the visibility of any view they have created, as well as - // any of their roots. - SetViewVisibility(uint32 view_id, bool visible) => (bool success); - - // Sets an individual named property. Setting an individual property to null - // deletes the property. - SetViewProperty(uint32 view_id, - string name, - array<uint8>? value) => (bool success); - - // Requests a Surface for a particular view. - RequestSurface(uint32 view_id, Surface& surface, SurfaceClient client); - - // Reparents a view. - // This fails for any of the following reasons: - // . |parent| or |child| does not identify a valid view. - // . |child| is an ancestor of |parent|. - // . |child| is already a child of |parent|. - // - // This may result in a connection getting OnWindowDeleted(). See - // RemoveViewFromParent for details. - AddView(uint32 parent, uint32 child) => (bool success); - - // Removes a view from its current parent. This fails if the view is not - // valid or the view already has no parent. - // - // Removing a view from a parent may result in OnWindowDeleted() being sent to - // other connections. For example, connection A has views 1 and 2, with 2 a - // child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets - // OnWindowDeleted(). This is done as view 2 is effectively no longer visible to - // connection B. - RemoveViewFromParent(uint32 view_id) => (bool success); - - // Reorders a view in its parent, relative to |relative_view_id| according to - // |direction|. - // Only the connection that created the view's parent can reorder its - // children. - ReorderView(uint32 view_id, - uint32 relative_view_id, - OrderDirection direction) => (bool success); - - // Returns the views comprising the tree starting at |view_id|. |view_id| is - // the first result in the return value, unless |view_id| is invalid, in which - // case an empty vector is returned. The views are visited using a depth first - // search (pre-order). - GetViewTree(uint32 view_id) => (array<ViewData> views); - - // A connection may grant access to another connection by way of Embed(). - // Embed() results in the supplied ViewTreeClient being configured with a - // root view of |view_id|. The supplied ViewTreeClient may create child - // views and do other various tree operations (including Embed()), but does - // not see nor have access to any of the views above the embed point. - // - // The caller must have created |view_id|. If not the request fails and the - // response is false. - // - // When a connection embeds a ViewTreeClient the originating connection no - // longer has privileges to access or see any of the children of the view. If - // the view had existing children the children are removed. The one exception - // is the root connection and any connections with the policy - // ACCESS_POLICY_EMBED_ROOT. - // - // A view may only have one embedding in it at a time. Subsequent calls to - // Embed() for the same view result in the currently embedded - // ViewTreeClient being removed. The embedded app is told this by way of - // OnUnembed(), which is followed by OnWindowDeleted() (as the connection no - // longer has access to the view). - // - // The embedder can detect when the embedded app disconnects by way of - // OnEmbeddedAppDisconnected(). - // - // The callback returns whether the embedding was successful, and if the - // embedding was successful and the originating connection is an embed root - // the resulting id of the new connection. - // - // policy_bitmask is a bitmask of the kAccessPolicy constants. See them for - // details. - Embed(uint32 view_id, - ViewTreeClient client, - uint32 policy_bitmask) => (bool success, uint16 connection_id); - - SetFocus(uint32 view_id); - - // Set text input state for the given view. - SetViewTextInputState(uint32 view_id, TextInputState state); - - // Set the input method editor UI (software keyboard, etc) visibility. - // If state is non-null, the specified view's text input state is updated. - // Otherwise the existing state is used. - SetImeVisibility(uint32 view_id, bool visible, TextInputState? state); -}; - -// Changes to views are not sent to the connection that originated the -// change. For example, if connection 1 changes the bounds of a view by calling -// SetBounds(), connection 1 does not receive OnWindowBoundsChanged(). -interface ViewTreeClient { - // Invoked when the client application has been embedded at |root|. - // See Embed() on ViewTree for more details. |tree| will be a handle back to - // the view manager service, unless the connection is to the root connection - // in which case it will be null. - OnEmbed(uint16 connection_id, - ViewData root, - ViewTree? tree, - uint32 focused_view, - uint32 access_policy); - - // Invoked when the application embedded at |view| is disconnected. In other - // words the embedded app closes the connection to the server. This is called - // on the connection that created |view| as well as any ancestors that have - // the embed root policy. - OnEmbeddedAppDisconnected(uint32 view); - - // Sent when another connection is embedded in the View this connection was - // previously embedded in. See Embed() for more information. - OnUnembed(); - - // Invoked when a view's bounds have changed. - OnWindowBoundsChanged(uint32 view, - mojo.Rect old_bounds, - mojo.Rect new_bounds); - - OnClientAreaChanged(uint32 window_id, - mojo.Rect old_client_area, - mojo.Rect new_client_area); - - // Invoked when the viewport metrics for the view have changed. - // Clients are expected to propagate this to the view tree. - OnWindowViewportMetricsChanged(mojo.ViewportMetrics old_metrics, - mojo.ViewportMetrics new_metrics); - - // Invoked when a change is done to the hierarchy. A value of 0 is used to - // identify a null view. For example, if the old_parent is NULL, 0 is - // supplied. - // |views| contains any views that are that the client has not been told - // about. This is not sent for hierarchy changes of views not known to this - // client or not attached to the tree. - OnWindowHierarchyChanged(uint32 view, - uint32 new_parent, - uint32 old_parent, - array<ViewData> views); - - // Invoked when the order of views within a parent changes. - OnWindowReordered(uint32 view_id, - uint32 relative_view_id, - OrderDirection direction); - - // Invoked when a view is deleted. - OnWindowDeleted(uint32 view); - - // Invoked when the visibility of the specified view changes. - OnWindowVisibilityChanged(uint32 view, bool visible); - - // Invoked when a change to the visibility of |view| or one if it's ancestors - // is done such that the drawn state changes. This is only invoked for the - // top most view of a particular connection. For example, if you have the - // hierarchy: A -> B1 -> B2 (B2 is a child of B1 and B1 a child of A), B1/B2 - // are from connection 2 and A from connection 1 with all views visible and - // drawn and the visiblity of A changes to false, then connection 2 is told - // the drawn state of B1 has changed (to false), but is not told anything - // about B2 as it's drawn state can be calculated from that of B1. - // - // NOTE: This is not invoked if OnWindowVisibilityChanged() is invoked. - OnWindowDrawnStateChanged(uint32 view, bool drawn); - - // Invoked when a view property is changed. If this change is a removal, - // |new_data| is null. - OnWindowSharedPropertyChanged(uint32 view, string name, array<uint8>? new_data); - - // Invoked when an event is targeted at the specified view. - OnWindowInputEvent(uint32 view, mojo.Event event) => (); - - OnWindowFocused(uint32 focused_view_id); -}; diff --git a/components/mus/public/interfaces/window_manager.mojom b/components/mus/public/interfaces/window_manager.mojom index c6d554c..098aaf1 100644 --- a/components/mus/public/interfaces/window_manager.mojom +++ b/components/mus/public/interfaces/window_manager.mojom @@ -4,7 +4,7 @@ module mus.mojom; -import "components/mus/public/interfaces/view_tree.mojom"; +import "components/mus/public/interfaces/window_tree.mojom"; import "ui/mojo/geometry/geometry.mojom"; enum WindowManagerErrorCode { @@ -33,7 +33,7 @@ struct Display { // created by calls to OpenWindow() from the *same connection* to the window // manager. The callback indicates success or failure. interface WindowManager { - OpenWindow(mojo.ViewTreeClient client); + OpenWindow(WindowTreeClient client); // Resizes the corresponding window to |size| and centers it in the current // context. diff --git a/components/mus/public/interfaces/window_tree.mojom b/components/mus/public/interfaces/window_tree.mojom new file mode 100644 index 0000000..d1218ad --- /dev/null +++ b/components/mus/public/interfaces/window_tree.mojom @@ -0,0 +1,259 @@ +// 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 mus.mojom; + +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 "mojo/application/public/interfaces/service_provider.mojom"; +import "network/public/interfaces/url_loader.mojom"; +import "ui/mojo/events/input_events.mojom"; +import "ui/mojo/ime/text_input_state.mojom"; +import "ui/mojo/geometry/geometry.mojom"; + +struct ViewportMetrics { + mojo.Size size_in_pixels; + // A value of 0 indicates the real value is not yet available. + float device_pixel_ratio = 0.0; +}; + +struct WindowData { + uint32 parent_id; + uint32 window_id; + mojo.Rect bounds; + map<string, array<uint8>> properties; + // True if this window is visible. The window may not be drawn on screen (see + // drawn for specifics). + bool visible; + // True if this window is drawn on screen. A window is drawn if attached to + // the root and all ancestors (including this window) are visible. + bool drawn; + ViewportMetrics viewport_metrics; +}; + +enum ErrorCode { + NONE, + VALUE_IN_USE, + ILLEGAL_ARGUMENT, +}; + +// Windows are identified by a uint32. The upper 16 bits are the connection id, +// and the lower 16 the id assigned by the client. +// +// The root window is identified with a connection id of 0, and value of 1. +interface WindowTree { + enum AccessPolicy { + DEFAULT = 0, + + // An embed root has the following abilities: + // . The app sees all the descendants of the window the app is ebmedded at, + // even those from separate connections. + // . The app is able to Embed() in all the descendants of the window the app + // is embedded at, even those from separate connections. + // Only connections originating from the WindowTreeHostFactory can grant + // this policy. + EMBED_ROOT = 1, + }; + + // Creates a new window with the specified id. It is up to the client to + // ensure the id is unique to the connection (the id need not be globally + // unique). Additionally the connection id (embedded in |window_id|) must + // match that of the connection. + // Errors: + // ERROR_CODE_VALUE_IN_USE: a window already exists with the specified id. + // ERROR_CODE_ILLEGAL_ARGUMENT: The connection part of |window_id| does not + // match the connection id of the client. + // + // TODO(erg): Once we have default values in mojo, make this take a map of + // properties. + NewWindow(uint32 window_id) => (ErrorCode error_code); + + // Deletes a window. This does not recurse. No hierarchy change notifications + // are sent as a result of this. Only the connection that created the window + // can delete it. + DeleteWindow(uint32 window_id) => (bool success); + + // Sets the specified bounds of the specified window. + SetWindowBounds(uint32 window_id, mojo.Rect bounds) => (bool success); + + // Sets the client area of the specified window. Areas outside the client + // area are treated specially. + SetClientArea(uint32 window_id, mojo.Rect rect); + + // Sets the visibility of the specified window to |visible|. Connections are + // allowed to change the visibility of any window they have created, as well + // as any of their roots. + SetWindowVisibility(uint32 window_id, bool visible) => (bool success); + + // Sets an individual named property. Setting an individual property to null + // deletes the property. + SetWindowProperty(uint32 window_id, + string name, + array<uint8>? value) => (bool success); + + // Requests a Surface for a particular window. + RequestSurface(uint32 window_id, Surface& surface, SurfaceClient client); + + // Reparents a window. + // This fails for any of the following reasons: + // . |parent| or |child| does not identify a valid window. + // . |child| is an ancestor of |parent|. + // . |child| is already a child of |parent|. + // + // This may result in a connection getting OnWindowDeleted(). See + // RemoveWindowFromParent for details. + AddWindow(uint32 parent, uint32 child) => (bool success); + + // Removes a window from its current parent. This fails if the window is not + // valid or the window already has no parent. + // + // Removing a window from a parent may result in OnWindowDeleted() being sent + // to other connections. For example, connection A has windows 1 and 2, with 2 + // a child of 1. Connection B has a root 1. If 2 is removed from 1 then B gets + // OnWindowDeleted(). This is done as window 2 is effectively no longer + // visible to connection B. + RemoveWindowFromParent(uint32 window_id) => (bool success); + + // Reorders a window in its parent, relative to |relative_window_id| according + // to |direction|. Only the connection that created the window's parent can + // reorder its children. + ReorderWindow(uint32 window_id, + uint32 relative_window_id, + OrderDirection direction) => (bool success); + + // Returns the windows comprising the tree starting at |window_id|. + // |window_id| is the first result in the return value, unless |window_id| is + // invalid, in which case an empty vector is returned. The windows are visited + // using a depth first search (pre-order). + GetWindowTree(uint32 window_id) => (array<WindowData> windows); + + // A connection may grant access to another connection by way of Embed(). + // Embed() results in the supplied WindowTreeClient being configured with a + // root window of |window_id|. The supplied WindowTreeClient may create child + // windows and do other various tree operations (including Embed()), but does + // not see nor have access to any of the windows above the embed point. + // + // The caller must have created |window_id|. If not the request fails and the + // response is false. + // + // When a connection embeds a WindowTreeClient the originating connection no + // longer has privileges to access or see any of the children of the window. + // If the window had existing children the children are removed. The one + // exception is the root connection and any connections with the policy + // ACCESS_POLICY_EMBED_ROOT. + // + // A window may only have one embedding in it at a time. Subsequent calls to + // Embed() for the same window result in the currently embedded + // WindowTreeClient being removed. The embedded app is told this by way of + // OnUnembed(), which is followed by OnWindowDeleted() (as the connection no + // longer has access to the window). + // + // The embedder can detect when the embedded app disconnects by way of + // OnEmbeddedAppDisconnected(). + // + // The callback returns whether the embedding was successful, and if the + // embedding was successful and the originating connection is an embed root + // the resulting id of the new connection. + // + // policy_bitmask is a bitmask of the kAccessPolicy constants. See them for + // details. + Embed(uint32 window_id, + WindowTreeClient client, + uint32 policy_bitmask) => (bool success, uint16 connection_id); + + SetFocus(uint32 window_id); + + // Set text input state for the given window. + SetWindowTextInputState(uint32 window_id, mojo.TextInputState state); + + // Set the input method editor UI (software keyboard, etc) visibility. + // If state is non-null, the specified window's text input state is updated. + // Otherwise the existing state is used. + SetImeVisibility(uint32 window_id, bool visible, mojo.TextInputState? state); +}; + +// Changes to windows are not sent to the connection that originated the +// change. For example, if connection 1 changes the bounds of a window by +// calling SetBounds(), connection 1 does not receive OnWindowBoundsChanged(). +interface WindowTreeClient { + // Invoked when the client application has been embedded at |root|. + // See Embed() on WindowTree for more details. |tree| will be a handle back to + // the window manager service, unless the connection is to the root connection + // in which case it will be null. + OnEmbed(uint16 connection_id, + WindowData root, + WindowTree? tree, + uint32 focused_window, + uint32 access_policy); + + // Invoked when the application embedded at |window| is disconnected. In other + // words the embedded app closes the connection to the server. This is called + // on the connection that created |window| as well as any ancestors that have + // the embed root policy. + OnEmbeddedAppDisconnected(uint32 window); + + // Sent when another connection is embedded in the Window this connection was + // previously embedded in. See Embed() for more information. + OnUnembed(); + + // Invoked when a window's bounds have changed. + OnWindowBoundsChanged(uint32 window, + mojo.Rect old_bounds, + mojo.Rect new_bounds); + + OnClientAreaChanged(uint32 window_id, + mojo.Rect old_client_area, + mojo.Rect new_client_area); + + // Invoked when the viewport metrics for the window have changed. + // Clients are expected to propagate this to the window tree. + OnWindowViewportMetricsChanged(ViewportMetrics old_metrics, + ViewportMetrics new_metrics); + + // Invoked when a change is done to the hierarchy. A value of 0 is used to + // identify a null window. For example, if the old_parent is NULL, 0 is + // supplied. + // |windows| contains any windows that are that the client has not been told + // about. This is not sent for hierarchy changes of windows not known to this + // client or not attached to the tree. + OnWindowHierarchyChanged(uint32 window, + uint32 new_parent, + uint32 old_parent, + array<WindowData> windows); + + // Invoked when the order of windows within a parent changes. + OnWindowReordered(uint32 window_id, + uint32 relative_window_id, + OrderDirection direction); + + // Invoked when a window is deleted. + OnWindowDeleted(uint32 window); + + // Invoked when the visibility of the specified window changes. + OnWindowVisibilityChanged(uint32 window, bool visible); + + // Invoked when a change to the visibility of |window| or one if it's + // ancestors is done such that the drawn state changes. This is only invoked + // for the top most window of a particular connection. For example, if you + // have the hierarchy: A -> B1 -> B2 (B2 is a child of B1 and B1 a child of + // A), B1/B2 are from connection 2 and A from connection 1 with all windows + // visible and drawn and the visiblity of A changes to false, then connection + // 2 is told the drawn state of B1 has changed (to false), but is not told + // anything about B2 as it's drawn state can be calculated from that of B1. + // + // NOTE: This is not invoked if OnWindowVisibilityChanged() is invoked. + OnWindowDrawnStateChanged(uint32 window, bool drawn); + + // Invoked when a window property is changed. If this change is a removal, + // |new_data| is null. + OnWindowSharedPropertyChanged(uint32 window, + string name, + array<uint8>? new_data); + + // Invoked when an event is targeted at the specified window. + OnWindowInputEvent(uint32 window, mojo.Event event) => (); + + OnWindowFocused(uint32 focused_window_id); +}; diff --git a/components/mus/public/interfaces/view_tree_host.mojom b/components/mus/public/interfaces/window_tree_host.mojom index 2d436bd..a7c7c55 100644 --- a/components/mus/public/interfaces/view_tree_host.mojom +++ b/components/mus/public/interfaces/window_tree_host.mojom @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mus.mojom; -import "components/mus/public/interfaces/view_tree.mojom"; +import "components/mus/public/interfaces/window_tree.mojom"; import "ui/mojo/events/input_event_constants.mojom"; import "ui/mojo/events/input_events.mojom"; import "ui/mojo/events/input_key_codes.mojom"; import "ui/mojo/geometry/geometry.mojom"; -// ViewTreeHost encapsulates a unique underlying platform window, with a tree +// WindowTreeHost encapsulates a unique underlying platform window, with a tree // of views. -interface ViewTreeHost { +interface WindowTreeHost { // Sets the size of the platform window. SetSize(mojo.Size size); @@ -20,7 +20,7 @@ interface ViewTreeHost { SetTitle(string title); // Add and remove accelerators. When accelerators are registered the - // ViewTreeHostClient receives the key event via OnAccelerator() rather than + // WindowTreeHostClient receives the key event via OnAccelerator() rather than // the focused view. The id is defined by the client and can be used to more // easily identify the accelerator's action. AddAccelerator(uint32 id, @@ -29,13 +29,13 @@ interface ViewTreeHost { RemoveAccelerator(uint32 id); }; -interface ViewTreeHostClient { +interface WindowTreeHostClient { // An accelerator registered via AddAccelerator() has been triggered. OnAccelerator(uint32 id, mojo.Event event); }; -interface ViewTreeHostFactory { - CreateWindowTreeHost(ViewTreeHost& view_tree_host, - ViewTreeHostClient? host_client, - ViewTreeClient tree_client); +interface WindowTreeHostFactory { + CreateWindowTreeHost(WindowTreeHost& window_tree_host, + WindowTreeHostClient? host_client, + WindowTreeClient tree_client); }; diff --git a/components/mus/ws/access_policy.h b/components/mus/ws/access_policy.h index cfc118f..175e1c8 100644 --- a/components/mus/ws/access_policy.h +++ b/components/mus/ws/access_policy.h @@ -19,16 +19,16 @@ class AccessPolicy { virtual ~AccessPolicy() {} // Unless otherwise mentioned all arguments have been validated. That is the - // |view| arguments are non-null unless otherwise stated (eg CanSetView() is + // |view| arguments are non-null unless otherwise stated (eg CanSetWindow() is // allowed to take a NULL view). - virtual bool CanRemoveViewFromParent(const ServerView* view) const = 0; - virtual bool CanAddView(const ServerView* parent, - const ServerView* child) const = 0; - virtual bool CanReorderView(const ServerView* view, - const ServerView* relative_view, - mojo::OrderDirection direction) const = 0; - virtual bool CanDeleteView(const ServerView* view) const = 0; - virtual bool CanGetViewTree(const ServerView* view) const = 0; + virtual bool CanRemoveWindowFromParent(const ServerView* view) const = 0; + virtual bool CanAddWindow(const ServerView* parent, + const ServerView* child) const = 0; + virtual bool CanReorderWindow(const ServerView* view, + const ServerView* relative_view, + mojom::OrderDirection direction) const = 0; + virtual bool CanDeleteWindow(const ServerView* view) const = 0; + virtual bool CanGetWindowTree(const ServerView* view) const = 0; // Used when building a view tree (GetViewTree()) to decide if we should // descend into |view|. virtual bool CanDescendIntoViewForViewTree(const ServerView* view) const = 0; @@ -36,9 +36,9 @@ class AccessPolicy { uint32_t policy_bitmask) const = 0; virtual bool CanChangeViewVisibility(const ServerView* view) const = 0; virtual bool CanSetWindowSurfaceId(const ServerView* view) const = 0; - virtual bool CanSetViewBounds(const ServerView* view) const = 0; - virtual bool CanSetViewProperties(const ServerView* view) const = 0; - virtual bool CanSetViewTextInputState(const ServerView* view) const = 0; + virtual bool CanSetWindowBounds(const ServerView* view) const = 0; + virtual bool CanSetWindowProperties(const ServerView* view) const = 0; + virtual bool CanSetWindowTextInputState(const ServerView* view) const = 0; virtual bool CanSetFocus(const ServerView* view) const = 0; virtual bool CanSetClientArea(const ServerView* window) const = 0; diff --git a/components/mus/ws/client_connection.cc b/components/mus/ws/client_connection.cc index 06fa39a2..9dc1e4e 100644 --- a/components/mus/ws/client_connection.cc +++ b/components/mus/ws/client_connection.cc @@ -10,7 +10,7 @@ namespace mus { ClientConnection::ClientConnection(scoped_ptr<ViewTreeImpl> service, - mojo::ViewTreeClient* client) + mojom::WindowTreeClient* client) : service_(service.Pass()), client_(client) {} ClientConnection::~ClientConnection() {} @@ -18,8 +18,8 @@ ClientConnection::~ClientConnection() {} DefaultClientConnection::DefaultClientConnection( scoped_ptr<ViewTreeImpl> service_impl, ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> service_request, - mojo::ViewTreeClientPtr client) + mojo::InterfaceRequest<mojom::WindowTree> service_request, + mojom::WindowTreeClientPtr client) : ClientConnection(service_impl.Pass(), client.get()), connection_manager_(connection_manager), binding_(service(), service_request.Pass()), diff --git a/components/mus/ws/client_connection.h b/components/mus/ws/client_connection.h index a455079..3aaf3aa 100644 --- a/components/mus/ws/client_connection.h +++ b/components/mus/ws/client_connection.h @@ -6,7 +6,7 @@ #define COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_ #include "base/memory/scoped_ptr.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" namespace mus { @@ -19,17 +19,17 @@ class ViewTreeImpl; class ClientConnection { public: ClientConnection(scoped_ptr<ViewTreeImpl> service, - mojo::ViewTreeClient* client); + mojom::WindowTreeClient* client); virtual ~ClientConnection(); ViewTreeImpl* service() { return service_.get(); } const ViewTreeImpl* service() const { return service_.get(); } - mojo::ViewTreeClient* client() { return client_; } + mojom::WindowTreeClient* client() { return client_; } private: scoped_ptr<ViewTreeImpl> service_; - mojo::ViewTreeClient* client_; + mojom::WindowTreeClient* client_; DISALLOW_COPY_AND_ASSIGN(ClientConnection); }; @@ -40,14 +40,14 @@ class DefaultClientConnection : public ClientConnection { DefaultClientConnection( scoped_ptr<ViewTreeImpl> service_impl, ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> service_request, - mojo::ViewTreeClientPtr client); + mojo::InterfaceRequest<mojom::WindowTree> service_request, + mojom::WindowTreeClientPtr client); ~DefaultClientConnection() override; private: ConnectionManager* connection_manager_; - mojo::Binding<mojo::ViewTree> binding_; - mojo::ViewTreeClientPtr client_; + mojo::Binding<mojom::WindowTree> binding_; + mojom::WindowTreeClientPtr client_; DISALLOW_COPY_AND_ASSIGN(DefaultClientConnection); }; diff --git a/components/mus/ws/connection_manager.cc b/components/mus/ws/connection_manager.cc index 7a80b33..09aed48 100644 --- a/components/mus/ws/connection_manager.cc +++ b/components/mus/ws/connection_manager.cc @@ -109,7 +109,7 @@ void ConnectionManager::OnHostConnectionClosed( // Get the ClientConnection by ViewTreeImpl ID. ConnectionMap::iterator service_connection_it = - connection_map_.find(it->first->GetViewTree()->id()); + connection_map_.find(it->first->GetWindowTree()->id()); DCHECK(service_connection_it != connection_map_.end()); // Tear down the associated ViewTree connection. @@ -129,7 +129,7 @@ void ConnectionManager::EmbedAtView(ConnectionSpecificId creator_id, const ViewId& view_id, uint32_t policy_bitmask, mojo::URLRequestPtr request) { - mojo::ViewTreePtr service_ptr; + mojom::WindowTreePtr service_ptr; ClientConnection* client_connection = delegate_->CreateClientConnectionForEmbedAtView( this, GetProxy(&service_ptr), creator_id, request.Pass(), view_id, @@ -140,11 +140,12 @@ 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) { - mojo::ViewTreePtr service_ptr; +ViewTreeImpl* ConnectionManager::EmbedAtView( + ConnectionSpecificId creator_id, + const ViewId& view_id, + uint32_t policy_bitmask, + mojom::WindowTreeClientPtr client) { + mojom::WindowTreePtr service_ptr; ClientConnection* client_connection = delegate_->CreateClientConnectionForEmbedAtView( this, GetProxy(&service_ptr), creator_id, view_id, policy_bitmask, @@ -198,16 +199,16 @@ bool ConnectionManager::DidConnectionMessageClient( return current_change_ && current_change_->DidMessageConnection(id); } -mojo::ViewportMetricsPtr ConnectionManager::GetViewportMetricsForView( +mojom::ViewportMetricsPtr ConnectionManager::GetViewportMetricsForView( const ServerView* view) { - ViewTreeHostImpl* host = GetViewTreeHostByView(view); + ViewTreeHostImpl* host = GetWindowTreeHostByView(view); if (host) return host->GetViewportMetrics().Clone(); if (!host_connection_map_.empty()) return host_connection_map_.begin()->first->GetViewportMetrics().Clone(); - mojo::ViewportMetricsPtr metrics = mojo::ViewportMetrics::New(); + mojom::ViewportMetricsPtr metrics = mojom::ViewportMetrics::New(); metrics->size_in_pixels = mojo::Size::New(); return metrics.Pass(); } @@ -221,13 +222,14 @@ const ViewTreeImpl* ConnectionManager::GetConnectionWithRoot( return nullptr; } -ViewTreeHostImpl* ConnectionManager::GetViewTreeHostByView( +ViewTreeHostImpl* ConnectionManager::GetWindowTreeHostByView( const ServerView* view) { return const_cast<ViewTreeHostImpl*>( - static_cast<const ConnectionManager*>(this)->GetViewTreeHostByView(view)); + static_cast<const ConnectionManager*>(this) + ->GetWindowTreeHostByView(view)); } -const ViewTreeHostImpl* ConnectionManager::GetViewTreeHostByView( +const ViewTreeHostImpl* ConnectionManager::GetWindowTreeHostByView( const ServerView* view) const { while (view && view->parent()) view = view->parent(); @@ -294,7 +296,7 @@ void ConnectionManager::ProcessViewHierarchyChanged( void ConnectionManager::ProcessViewReorder( const ServerView* view, const ServerView* relative_view, - const mojo::OrderDirection direction) { + const mojom::OrderDirection direction) { for (auto& pair : connection_map_) { pair.second->service()->ProcessViewReorder(view, relative_view, direction, IsChangeSource(pair.first)); @@ -309,8 +311,8 @@ void ConnectionManager::ProcessViewDeleted(const ViewId& view) { } void ConnectionManager::ProcessViewportMetricsChanged( - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) { + const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics) { for (auto& pair : connection_map_) { pair.second->service()->ProcessViewportMetricsChanged( old_metrics, new_metrics, IsChangeSource(pair.first)); @@ -344,7 +346,7 @@ void ConnectionManager::OnScheduleViewPaint(const ServerView* view) { } const ServerView* ConnectionManager::GetRootView(const ServerView* view) const { - const ViewTreeHostImpl* host = GetViewTreeHostByView(view); + const ViewTreeHostImpl* host = GetWindowTreeHostByView(view); return host ? host->root_view() : nullptr; } @@ -404,7 +406,7 @@ void ConnectionManager::OnWindowClientAreaChanged( void ConnectionManager::OnViewReordered(ServerView* view, ServerView* relative, - mojo::OrderDirection direction) { + mojom::OrderDirection direction) { if (!in_destructor_) SchedulePaint(view, gfx::Rect(view->bounds().size())); } @@ -439,7 +441,7 @@ void ConnectionManager::OnViewSharedPropertyChanged( void ConnectionManager::OnViewTextInputStateChanged( ServerView* view, const ui::TextInputState& state) { - ViewTreeHostImpl* host = GetViewTreeHostByView(view); + ViewTreeHostImpl* host = GetWindowTreeHostByView(view); host->UpdateTextInputState(view, state); } diff --git a/components/mus/ws/connection_manager.h b/components/mus/ws/connection_manager.h index 713deaf..da21754 100644 --- a/components/mus/ws/connection_manager.h +++ b/components/mus/ws/connection_manager.h @@ -11,8 +11,8 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/timer/timer.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/mus/surfaces/surfaces_state.h" #include "components/mus/ws/focus_controller_delegate.h" #include "components/mus/ws/ids.h" @@ -101,7 +101,7 @@ class ConnectionManager : public ServerViewDelegate, public ServerViewObserver { ViewTreeImpl* EmbedAtView(ConnectionSpecificId creator_id, const ViewId& view_id, uint32_t policy_bitmask, - mojo::ViewTreeClientPtr client); + mojom::WindowTreeClientPtr client); // Returns the connection by id. ViewTreeImpl* GetConnection(ConnectionSpecificId connection_id); @@ -133,7 +133,7 @@ class ConnectionManager : public ServerViewDelegate, public ServerViewObserver { bool DidConnectionMessageClient(ConnectionSpecificId id) const; // Returns the metrics of the viewport where the provided |view| is displayed. - mojo::ViewportMetricsPtr GetViewportMetricsForView(const ServerView* view); + mojom::ViewportMetricsPtr GetViewportMetricsForView(const ServerView* view); // Returns the ViewTreeImpl that has |id| as a root. ViewTreeImpl* GetConnectionWithRoot(const ViewId& id) { @@ -142,8 +142,8 @@ class ConnectionManager : public ServerViewDelegate, public ServerViewObserver { } const ViewTreeImpl* GetConnectionWithRoot(const ViewId& id) const; - ViewTreeHostImpl* GetViewTreeHostByView(const ServerView* view); - const ViewTreeHostImpl* GetViewTreeHostByView(const ServerView* view) const; + ViewTreeHostImpl* GetWindowTreeHostByView(const ServerView* view); + const ViewTreeHostImpl* GetWindowTreeHostByView(const ServerView* view) const; // Returns the first ancestor of |service| that is marked as an embed root. ViewTreeImpl* GetEmbedRoot(ViewTreeImpl* service); @@ -160,8 +160,8 @@ class ConnectionManager : public ServerViewDelegate, public ServerViewObserver { void ProcessClientAreaChanged(const ServerView* window, const gfx::Rect& old_client_area, const gfx::Rect& new_client_area); - void ProcessViewportMetricsChanged(const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics); + void ProcessViewportMetricsChanged(const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics); void ProcessWillChangeViewHierarchy(const ServerView* view, const ServerView* new_parent, const ServerView* old_parent); @@ -170,7 +170,7 @@ class ConnectionManager : public ServerViewDelegate, public ServerViewObserver { const ServerView* old_parent); void ProcessViewReorder(const ServerView* view, const ServerView* relative_view, - const mojo::OrderDirection direction); + const mojom::OrderDirection direction); void ProcessViewDeleted(const ViewId& view); private: @@ -218,7 +218,7 @@ class ConnectionManager : public ServerViewDelegate, public ServerViewObserver { const gfx::Rect& new_client_area) override; void OnViewReordered(ServerView* view, ServerView* relative, - mojo::OrderDirection direction) override; + mojom::OrderDirection direction) override; void OnWillChangeViewVisibility(ServerView* view) override; void OnViewSharedPropertyChanged( ServerView* view, diff --git a/components/mus/ws/connection_manager_delegate.h b/components/mus/ws/connection_manager_delegate.h index d72f363..a3b740c 100644 --- a/components/mus/ws/connection_manager_delegate.h +++ b/components/mus/ws/connection_manager_delegate.h @@ -8,7 +8,7 @@ #include <string> #include "components/mus/public/cpp/types.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" namespace mus { @@ -16,7 +16,6 @@ namespace mus { class ClientConnection; class ConnectionManager; struct ViewId; -class ViewTree; class ConnectionManagerDelegate { public: @@ -26,18 +25,18 @@ class ConnectionManagerDelegate { // ConnectionManager. virtual ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> tree_request, + mojo::InterfaceRequest<mojom::WindowTree> tree_request, ConnectionSpecificId creator_id, mojo::URLRequestPtr request, const ViewId& root_id, uint32_t policy_bitmask) = 0; virtual ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> tree_request, + mojo::InterfaceRequest<mojom::WindowTree> tree_request, ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask, - mojo::ViewTreeClientPtr client) = 0; + mojom::WindowTreeClientPtr client) = 0; protected: virtual ~ConnectionManagerDelegate() {} diff --git a/components/mus/ws/default_access_policy.cc b/components/mus/ws/default_access_policy.cc index 4c42e75..f959a9a 100644 --- a/components/mus/ws/default_access_policy.cc +++ b/components/mus/ws/default_access_policy.cc @@ -15,7 +15,7 @@ DefaultAccessPolicy::DefaultAccessPolicy(ConnectionSpecificId connection_id, DefaultAccessPolicy::~DefaultAccessPolicy() {} -bool DefaultAccessPolicy::CanRemoveViewFromParent( +bool DefaultAccessPolicy::CanRemoveWindowFromParent( const ServerView* view) const { if (!WasCreatedByThisConnection(view)) return false; // Can only unparent views we created. @@ -24,26 +24,27 @@ bool DefaultAccessPolicy::CanRemoveViewFromParent( WasCreatedByThisConnection(view->parent()); } -bool DefaultAccessPolicy::CanAddView(const ServerView* parent, - const ServerView* child) const { +bool DefaultAccessPolicy::CanAddWindow(const ServerView* parent, + const ServerView* child) const { return WasCreatedByThisConnection(child) && (delegate_->IsRootForAccessPolicy(parent->id()) || (WasCreatedByThisConnection(parent) && !delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(parent))); } -bool DefaultAccessPolicy::CanReorderView(const ServerView* view, - const ServerView* relative_view, - mojo::OrderDirection direction) const { +bool DefaultAccessPolicy::CanReorderWindow( + const ServerView* view, + const ServerView* relative_view, + mojom::OrderDirection direction) const { return WasCreatedByThisConnection(view) && WasCreatedByThisConnection(relative_view); } -bool DefaultAccessPolicy::CanDeleteView(const ServerView* view) const { +bool DefaultAccessPolicy::CanDeleteWindow(const ServerView* view) const { return WasCreatedByThisConnection(view); } -bool DefaultAccessPolicy::CanGetViewTree(const ServerView* view) const { +bool DefaultAccessPolicy::CanGetWindowTree(const ServerView* view) const { return WasCreatedByThisConnection(view) || delegate_->IsRootForAccessPolicy(view->id()) || IsDescendantOfEmbedRoot(view); @@ -59,7 +60,7 @@ bool DefaultAccessPolicy::CanDescendIntoViewForViewTree( bool DefaultAccessPolicy::CanEmbed(const ServerView* view, uint32_t policy_bitmask) const { - if (policy_bitmask != mojo::ViewTree::ACCESS_POLICY_DEFAULT) + if (policy_bitmask != mojom::WindowTree::ACCESS_POLICY_DEFAULT) return false; return WasCreatedByThisConnection(view) || (delegate_->IsViewKnownForAccessPolicy(view) && @@ -83,15 +84,15 @@ bool DefaultAccessPolicy::CanSetWindowSurfaceId(const ServerView* view) const { delegate_->IsRootForAccessPolicy(view->id()); } -bool DefaultAccessPolicy::CanSetViewBounds(const ServerView* view) const { +bool DefaultAccessPolicy::CanSetWindowBounds(const ServerView* view) const { return WasCreatedByThisConnection(view); } -bool DefaultAccessPolicy::CanSetViewProperties(const ServerView* view) const { +bool DefaultAccessPolicy::CanSetWindowProperties(const ServerView* view) const { return WasCreatedByThisConnection(view); } -bool DefaultAccessPolicy::CanSetViewTextInputState( +bool DefaultAccessPolicy::CanSetWindowTextInputState( const ServerView* view) const { return WasCreatedByThisConnection(view) || delegate_->IsRootForAccessPolicy(view->id()); diff --git a/components/mus/ws/default_access_policy.h b/components/mus/ws/default_access_policy.h index 875da48..b51641e 100644 --- a/components/mus/ws/default_access_policy.h +++ b/components/mus/ws/default_access_policy.h @@ -20,21 +20,21 @@ class DefaultAccessPolicy : public AccessPolicy { ~DefaultAccessPolicy() override; // AccessPolicy: - bool CanRemoveViewFromParent(const ServerView* view) const override; - bool CanAddView(const ServerView* parent, - const ServerView* child) const override; - bool CanReorderView(const ServerView* view, - const ServerView* relative_view, - mojo::OrderDirection direction) const override; - bool CanDeleteView(const ServerView* view) const override; - bool CanGetViewTree(const ServerView* view) const override; + bool CanRemoveWindowFromParent(const ServerView* view) const override; + bool CanAddWindow(const ServerView* parent, + const ServerView* child) const override; + bool CanReorderWindow(const ServerView* view, + const ServerView* relative_view, + mojom::OrderDirection direction) const override; + bool CanDeleteWindow(const ServerView* view) const override; + bool CanGetWindowTree(const ServerView* view) const override; bool CanDescendIntoViewForViewTree(const ServerView* view) const override; bool CanEmbed(const ServerView* view, uint32_t policy_bitmask) const override; bool CanChangeViewVisibility(const ServerView* view) const override; bool CanSetWindowSurfaceId(const ServerView* view) const override; - bool CanSetViewBounds(const ServerView* view) const override; - bool CanSetViewProperties(const ServerView* view) const override; - bool CanSetViewTextInputState(const ServerView* view) const override; + bool CanSetWindowBounds(const ServerView* view) const override; + bool CanSetWindowProperties(const ServerView* view) const override; + bool CanSetWindowTextInputState(const ServerView* view) const override; bool CanSetFocus(const ServerView* view) const override; bool CanSetClientArea(const ServerView* window) const override; bool ShouldNotifyOnHierarchyChange( diff --git a/components/mus/ws/display_manager.cc b/components/mus/ws/display_manager.cc index 4a4359e..7f7c6dc 100644 --- a/components/mus/ws/display_manager.cc +++ b/components/mus/ws/display_manager.cc @@ -186,7 +186,7 @@ void DefaultDisplayManager::SetTitle(const base::string16& title) { platform_window_->SetTitle(title); } -const mojo::ViewportMetrics& DefaultDisplayManager::GetViewportMetrics() { +const mojom::ViewportMetrics& DefaultDisplayManager::GetViewportMetrics() { return metrics_; } @@ -240,7 +240,7 @@ void DefaultDisplayManager::UpdateMetrics(const gfx::Size& size, if (metrics_.size_in_pixels.To<gfx::Size>() == size && metrics_.device_pixel_ratio == device_pixel_ratio) return; - mojo::ViewportMetrics old_metrics; + mojom::ViewportMetrics old_metrics; old_metrics.size_in_pixels = metrics_.size_in_pixels.Clone(); old_metrics.device_pixel_ratio = metrics_.device_pixel_ratio; diff --git a/components/mus/ws/display_manager.h b/components/mus/ws/display_manager.h index e7b0d0f..5256fa4 100644 --- a/components/mus/ws/display_manager.h +++ b/components/mus/ws/display_manager.h @@ -11,7 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/surfaces/top_level_display_client.h" #include "components/mus/ws/display_manager_delegate.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h" @@ -64,7 +64,7 @@ class DisplayManager { virtual void SetTitle(const base::string16& title) = 0; - virtual const mojo::ViewportMetrics& GetViewportMetrics() = 0; + virtual const mojom::ViewportMetrics& GetViewportMetrics() = 0; virtual void UpdateTextInputState(const ui::TextInputState& state) = 0; virtual void SetImeVisibility(bool visible) = 0; @@ -95,7 +95,7 @@ class DefaultDisplayManager : public DisplayManager, void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; void SetViewportSize(const gfx::Size& size) override; void SetTitle(const base::string16& title) override; - const mojo::ViewportMetrics& GetViewportMetrics() override; + const mojom::ViewportMetrics& GetViewportMetrics() override; void UpdateTextInputState(const ui::TextInputState& state) override; void SetImeVisibility(bool visible) override; @@ -131,7 +131,7 @@ class DefaultDisplayManager : public DisplayManager, scoped_refptr<SurfacesState> surfaces_state_; DisplayManagerDelegate* delegate_; - mojo::ViewportMetrics metrics_; + mojom::ViewportMetrics metrics_; gfx::Rect dirty_rect_; base::Timer draw_timer_; bool frame_pending_; diff --git a/components/mus/ws/display_manager_delegate.h b/components/mus/ws/display_manager_delegate.h index 3b2c2fd..18d4e3d 100644 --- a/components/mus/ws/display_manager_delegate.h +++ b/components/mus/ws/display_manager_delegate.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_MUS_WS_DISPLAY_MANAGER_DELEGATE_H_ #define COMPONENTS_MUS_WS_DISPLAY_MANAGER_DELEGATE_H_ -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/ws/ids.h" namespace cc { @@ -32,8 +32,8 @@ class DisplayManagerDelegate { // Signals that the metrics of this display's viewport has changed. virtual void OnViewportMetricsChanged( - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) = 0; + const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics) = 0; virtual void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) = 0; diff --git a/components/mus/ws/ids.h b/components/mus/ws/ids.h index a788359..fef524a 100644 --- a/components/mus/ws/ids.h +++ b/components/mus/ws/ids.h @@ -16,25 +16,25 @@ const ConnectionSpecificId kInvalidConnectionId = 0; // Adds a bit of type safety to view ids. struct ViewId { - ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId view_id) - : connection_id(connection_id), view_id(view_id) {} - ViewId() : connection_id(0), view_id(0) {} + ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId window_id) + : connection_id(connection_id), window_id(window_id) {} + ViewId() : connection_id(0), window_id(0) {} bool operator==(const ViewId& other) const { - return other.connection_id == connection_id && other.view_id == view_id; + return other.connection_id == connection_id && other.window_id == window_id; } bool operator!=(const ViewId& other) const { return !(*this == other); } bool operator<(const ViewId& other) const { if (connection_id == other.connection_id) - return view_id < other.view_id; + return window_id < other.window_id; return connection_id < other.connection_id; } ConnectionSpecificId connection_id; - ConnectionSpecificId view_id; + ConnectionSpecificId window_id; }; inline ViewId ViewIdFromTransportId(Id id) { @@ -42,7 +42,7 @@ inline ViewId ViewIdFromTransportId(Id id) { } inline Id ViewIdToTransportId(const ViewId& id) { - return (id.connection_id << 16) | id.view_id; + return (id.connection_id << 16) | id.window_id; } // Returns a ViewId that is reserved to indicate no view. That is, no view will diff --git a/components/mus/ws/server_view.cc b/components/mus/ws/server_view.cc index 8de69ef..9f11a6d 100644 --- a/components/mus/ws/server_view.cc +++ b/components/mus/ws/server_view.cc @@ -46,8 +46,8 @@ void ServerView::RemoveObserver(ServerViewObserver* observer) { observers_.RemoveObserver(observer); } -void ServerView::Bind(mojo::InterfaceRequest<mojo::Surface> request, - mojo::SurfaceClientPtr client) { +void ServerView::Bind(mojo::InterfaceRequest<mojom::Surface> request, + mojom::SurfaceClientPtr client) { GetOrCreateSurface()->Bind(request.Pass(), client.Pass()); } @@ -59,7 +59,7 @@ void ServerView::Add(ServerView* child) { if (child->parent() == this) { if (children_.size() == 1) return; // Already in the right position. - Reorder(child, children_.back(), mojo::ORDER_DIRECTION_ABOVE); + Reorder(child, children_.back(), mojom::ORDER_DIRECTION_ABOVE); return; } @@ -91,17 +91,17 @@ void ServerView::Remove(ServerView* child) { void ServerView::Reorder(ServerView* child, ServerView* relative, - mojo::OrderDirection direction) { + mojom::OrderDirection direction) { // We assume validation checks happened else where. DCHECK(child); DCHECK(child->parent() == this); DCHECK_GT(children_.size(), 1u); children_.erase(std::find(children_.begin(), children_.end(), child)); Views::iterator i = std::find(children_.begin(), children_.end(), relative); - if (direction == mojo::ORDER_DIRECTION_ABOVE) { + if (direction == mojom::ORDER_DIRECTION_ABOVE) { DCHECK(i != children_.end()); children_.insert(++i, child); - } else if (direction == mojo::ORDER_DIRECTION_BELOW) { + } else if (direction == mojom::ORDER_DIRECTION_BELOW) { DCHECK(i != children_.end()); children_.insert(i, child); } @@ -152,12 +152,12 @@ std::vector<ServerView*> ServerView::GetChildren() { return children_; } -ServerView* ServerView::GetChildView(const ViewId& view_id) { - if (id_ == view_id) +ServerView* ServerView::GetChildView(const ViewId& window_id) { + if (id_ == window_id) return this; for (ServerView* child : children_) { - ServerView* view = child->GetChildView(view_id); + ServerView* view = child->GetChildView(window_id); if (view) return view; } @@ -259,7 +259,7 @@ void ServerView::BuildDebugInfo(const std::string& depth, std::string* result) const { *result += base::StringPrintf( "%sid=%d,%d visible=%s bounds=%d,%d %dx%d" PRIu64 "\n", depth.c_str(), - static_cast<int>(id_.connection_id), static_cast<int>(id_.view_id), + static_cast<int>(id_.connection_id), static_cast<int>(id_.window_id), visible_ ? "true" : "false", bounds_.x(), bounds_.y(), bounds_.width(), bounds_.height()); for (const ServerView* child : children_) diff --git a/components/mus/ws/server_view.h b/components/mus/ws/server_view.h index ae9da52..f4a95d3 100644 --- a/components/mus/ws/server_view.h +++ b/components/mus/ws/server_view.h @@ -10,7 +10,7 @@ #include "base/logging.h" #include "base/observer_list.h" #include "components/mus/public/interfaces/compositor_frame.mojom.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/ws/ids.h" #include "components/mus/ws/server_view_surface.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" @@ -43,8 +43,8 @@ class ServerView { // Binds the provided |request| to |this| object. If an interface is already // bound to this ServerView then the old connection is closed first. - void Bind(mojo::InterfaceRequest<mojo::Surface> request, - mojo::SurfaceClientPtr client); + void Bind(mojo::InterfaceRequest<mojom::Surface> request, + mojom::SurfaceClientPtr client); const ViewId& id() const { return id_; } @@ -52,7 +52,7 @@ class ServerView { void Remove(ServerView* child); void Reorder(ServerView* child, ServerView* relative, - mojo::OrderDirection direction); + mojom::OrderDirection direction); const gfx::Rect& bounds() const { return bounds_; } // Sets the bounds. If the size changes this implicitly resets the client diff --git a/components/mus/ws/server_view_observer.h b/components/mus/ws/server_view_observer.h index fe2d75f..81c058a 100644 --- a/components/mus/ws/server_view_observer.h +++ b/components/mus/ws/server_view_observer.h @@ -52,7 +52,7 @@ class ServerViewObserver { virtual void OnViewReordered(ServerView* view, ServerView* relative, - mojo::OrderDirection direction) {} + mojom::OrderDirection direction) {} virtual void OnWillChangeViewVisibility(ServerView* view) {} virtual void OnViewVisibilityChanged(ServerView* view) {} diff --git a/components/mus/ws/server_view_surface.cc b/components/mus/ws/server_view_surface.cc index 18c2ff9..35b7c52 100644 --- a/components/mus/ws/server_view_surface.cc +++ b/components/mus/ws/server_view_surface.cc @@ -40,7 +40,7 @@ ServerViewSurface::~ServerViewSurface() { } void ServerViewSurface::Bind(mojo::InterfaceRequest<Surface> request, - mojo::SurfaceClientPtr client) { + mojom::SurfaceClientPtr client) { if (binding_.is_bound()) { // Destroy frame surfaces submitted by the old client before replacing // client_, so those surfaces will be returned to the old client. @@ -52,7 +52,7 @@ void ServerViewSurface::Bind(mojo::InterfaceRequest<Surface> request, } void ServerViewSurface::SubmitCompositorFrame( - mojo::CompositorFramePtr frame, + mojom::CompositorFramePtr frame, const SubmitCompositorFrameCallback& callback) { gfx::Size frame_size = frame->passes[0]->output_rect.To<gfx::Rect>().size(); if (!surface_id_.is_null()) { @@ -73,14 +73,14 @@ void ServerViewSurface::SubmitCompositorFrame( } scoped_ptr<cc::CompositorFrame> ServerViewSurface::ConvertCompositorFrame( - const mojo::CompositorFramePtr& input) { + const mojom::CompositorFramePtr& input) { referenced_view_ids_.clear(); return ConvertToCompositorFrame(input, this); } bool ServerViewSurface::ConvertSurfaceDrawQuad( - const mojo::QuadPtr& input, - const mojo::CompositorFrameMetadataPtr& metadata, + const mojom::QuadPtr& input, + const mojom::CompositorFrameMetadataPtr& metadata, cc::SharedQuadState* sqs, cc::RenderPass* render_pass) { Id id = static_cast<Id>( @@ -105,7 +105,7 @@ void ServerViewSurface::ReturnResources( if (!client_) return; client_->ReturnResources( - mojo::Array<mojo::ReturnedResourcePtr>::From(resources)); + mojo::Array<mojom::ReturnedResourcePtr>::From(resources)); } } // namespace mus diff --git a/components/mus/ws/server_view_surface.h b/components/mus/ws/server_view_surface.h index f743e6f..5bfec39 100644 --- a/components/mus/ws/server_view_surface.h +++ b/components/mus/ws/server_view_surface.h @@ -20,7 +20,7 @@ class ServerView; class SurfacesState; // Server side representation of a ViewSurface. -class ServerViewSurface : public mojo::Surface, +class ServerViewSurface : public mojom::Surface, public cc::SurfaceFactoryClient, public mojo::CustomSurfaceConverter { public: @@ -29,11 +29,11 @@ class ServerViewSurface : public mojo::Surface, ~ServerViewSurface() override; void Bind(mojo::InterfaceRequest<Surface> request, - mojo::SurfaceClientPtr client); + mojom::SurfaceClientPtr client); - // mojo::Surface: + // mojom::Surface: void SubmitCompositorFrame( - mojo::CompositorFramePtr frame, + mojom::CompositorFramePtr frame, const SubmitCompositorFrameCallback& callback) override; // Returns the set of views referenced by the last CompositorFrame submitted @@ -45,16 +45,16 @@ class ServerViewSurface : public mojo::Surface, const cc::SurfaceId& id() const { return surface_id_; } private: - // Takes a mojo::CompositorFrame |input|, and converts it into a + // Takes a mojom::CompositorFrame |input|, and converts it into a // cc::CompositorFrame. Along the way, this conversion ensures that a // CompositorFrame of this view can only refer to views within its subtree. // Views referenced in |input| are stored in |referenced_view_ids_|. scoped_ptr<cc::CompositorFrame> ConvertCompositorFrame( - const mojo::CompositorFramePtr& input); + const mojom::CompositorFramePtr& input); // Overriden from CustomSurfaceConverter: - bool ConvertSurfaceDrawQuad(const mojo::QuadPtr& input, - const mojo::CompositorFrameMetadataPtr& metadata, + bool ConvertSurfaceDrawQuad(const mojom::QuadPtr& input, + const mojom::CompositorFrameMetadataPtr& metadata, cc::SharedQuadState* sqs, cc::RenderPass* render_pass) override; @@ -75,7 +75,7 @@ class ServerViewSurface : public mojo::Surface, cc::SurfaceIdAllocator surface_id_allocator_; cc::SurfaceFactory surface_factory_; - mojo::SurfaceClientPtr client_; + mojom::SurfaceClientPtr client_; mojo::Binding<Surface> binding_; DISALLOW_COPY_AND_ASSIGN(ServerViewSurface); diff --git a/components/mus/ws/test_change_tracker.cc b/components/mus/ws/test_change_tracker.cc index 4e4f09b..330e636 100644 --- a/components/mus/ws/test_change_tracker.cc +++ b/components/mus/ws/test_change_tracker.cc @@ -10,7 +10,6 @@ #include "mojo/common/common_type_converters.h" using mojo::Array; -using mojo::ViewDataPtr; using mojo::String; namespace mus { @@ -27,8 +26,8 @@ std::string RectToString(const mojo::Rect& rect) { rect.height); } -std::string DirectionToString(mojo::OrderDirection direction) { - return direction == mojo::ORDER_DIRECTION_ABOVE ? "above" : "below"; +std::string DirectionToString(mojom::OrderDirection direction) { + return direction == mojom::ORDER_DIRECTION_ABOVE ? "above" : "below"; } std::string ChangeToDescription1(const Change& change) { @@ -38,7 +37,7 @@ std::string ChangeToDescription1(const Change& change) { case CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED: return base::StringPrintf("OnEmbeddedAppDisconnected view=%s", - ViewIdToString(change.view_id).c_str()); + ViewIdToString(change.window_id).c_str()); case CHANGE_TYPE_UNEMBED: return "OnUnembed"; @@ -46,7 +45,7 @@ std::string ChangeToDescription1(const Change& change) { case CHANGE_TYPE_NODE_BOUNDS_CHANGED: return base::StringPrintf( "BoundsChanged view=%s old_bounds=%s new_bounds=%s", - ViewIdToString(change.view_id).c_str(), + ViewIdToString(change.window_id).c_str(), RectToString(change.bounds).c_str(), RectToString(change.bounds2).c_str()); @@ -57,38 +56,38 @@ std::string ChangeToDescription1(const Change& change) { case CHANGE_TYPE_NODE_HIERARCHY_CHANGED: return base::StringPrintf( "HierarchyChanged view=%s new_parent=%s old_parent=%s", - ViewIdToString(change.view_id).c_str(), - ViewIdToString(change.view_id2).c_str(), - ViewIdToString(change.view_id3).c_str()); + ViewIdToString(change.window_id).c_str(), + ViewIdToString(change.window_id2).c_str(), + ViewIdToString(change.window_id3).c_str()); case CHANGE_TYPE_NODE_REORDERED: return base::StringPrintf("Reordered view=%s relative=%s direction=%s", - ViewIdToString(change.view_id).c_str(), - ViewIdToString(change.view_id2).c_str(), + ViewIdToString(change.window_id).c_str(), + ViewIdToString(change.window_id2).c_str(), DirectionToString(change.direction).c_str()); case CHANGE_TYPE_NODE_DELETED: return base::StringPrintf("ViewDeleted view=%s", - ViewIdToString(change.view_id).c_str()); + ViewIdToString(change.window_id).c_str()); case CHANGE_TYPE_NODE_VISIBILITY_CHANGED: return base::StringPrintf("VisibilityChanged view=%s visible=%s", - ViewIdToString(change.view_id).c_str(), + ViewIdToString(change.window_id).c_str(), change.bool_value ? "true" : "false"); case CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED: return base::StringPrintf("DrawnStateChanged view=%s drawn=%s", - ViewIdToString(change.view_id).c_str(), + ViewIdToString(change.window_id).c_str(), change.bool_value ? "true" : "false"); case CHANGE_TYPE_INPUT_EVENT: return base::StringPrintf("InputEvent view=%s event_action=%d", - ViewIdToString(change.view_id).c_str(), + ViewIdToString(change.window_id).c_str(), change.event_action); case CHANGE_TYPE_PROPERTY_CHANGED: return base::StringPrintf("PropertyChanged view=%s key=%s value=%s", - ViewIdToString(change.view_id).c_str(), + ViewIdToString(change.window_id).c_str(), change.property_key.c_str(), change.property_value.c_str()); @@ -98,7 +97,7 @@ std::string ChangeToDescription1(const Change& change) { case CHANGE_TYPE_FOCUSED: return base::StringPrintf("Focused id=%s", - ViewIdToString(change.view_id).c_str()); + ViewIdToString(change.window_id).c_str()); } return std::string(); } @@ -138,10 +137,10 @@ std::string ChangeViewDescription(const std::vector<Change>& changes) { return base::JoinString(view_strings, ","); } -TestView ViewDataToTestView(const ViewDataPtr& data) { +TestView WindowDataToTestView(const mojom::WindowDataPtr& data) { TestView view; view.parent_id = data->parent_id; - view.view_id = data->view_id; + view.window_id = data->window_id; view.visible = data->visible; view.drawn = data->drawn; view.properties = @@ -149,20 +148,20 @@ TestView ViewDataToTestView(const ViewDataPtr& data) { return view; } -void ViewDatasToTestViews(const Array<ViewDataPtr>& data, - std::vector<TestView>* test_views) { +void WindowDatasToTestViews(const Array<mojom::WindowDataPtr>& data, + std::vector<TestView>* test_views) { for (size_t i = 0; i < data.size(); ++i) - test_views->push_back(ViewDataToTestView(data[i])); + test_views->push_back(WindowDataToTestView(data[i])); } Change::Change() : type(CHANGE_TYPE_EMBED), connection_id(0), - view_id(0), - view_id2(0), - view_id3(0), + window_id(0), + window_id2(0), + window_id3(0), event_action(0), - direction(mojo::ORDER_DIRECTION_ABOVE), + direction(mojom::ORDER_DIRECTION_ABOVE), bool_value(false) {} Change::~Change() {} @@ -172,27 +171,27 @@ TestChangeTracker::TestChangeTracker() : delegate_(NULL) {} TestChangeTracker::~TestChangeTracker() {} void TestChangeTracker::OnEmbed(ConnectionSpecificId connection_id, - ViewDataPtr root) { + mojom::WindowDataPtr root) { Change change; change.type = CHANGE_TYPE_EMBED; change.connection_id = connection_id; - change.views.push_back(ViewDataToTestView(root)); + change.views.push_back(WindowDataToTestView(root)); AddChange(change); } -void TestChangeTracker::OnEmbeddedAppDisconnected(Id view_id) { +void TestChangeTracker::OnEmbeddedAppDisconnected(Id window_id) { Change change; change.type = CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED; - change.view_id = view_id; + change.window_id = window_id; AddChange(change); } -void TestChangeTracker::OnWindowBoundsChanged(Id view_id, +void TestChangeTracker::OnWindowBoundsChanged(Id window_id, mojo::RectPtr old_bounds, mojo::RectPtr new_bounds) { Change change; change.type = CHANGE_TYPE_NODE_BOUNDS_CHANGED; - change.view_id = view_id; + change.window_id = window_id; change.bounds.x = old_bounds->x; change.bounds.y = old_bounds->y; change.bounds.width = old_bounds->width; @@ -211,75 +210,76 @@ void TestChangeTracker::OnUnembed() { } void TestChangeTracker::OnWindowViewportMetricsChanged( - mojo::ViewportMetricsPtr old_metrics, - mojo::ViewportMetricsPtr new_metrics) { + mojom::ViewportMetricsPtr old_metrics, + mojom::ViewportMetricsPtr new_metrics) { Change change; change.type = CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED; // NOT IMPLEMENTED AddChange(change); } -void TestChangeTracker::OnWindowHierarchyChanged(Id view_id, - Id new_parent_id, - Id old_parent_id, - Array<ViewDataPtr> views) { +void TestChangeTracker::OnWindowHierarchyChanged( + Id window_id, + Id new_parent_id, + Id old_parent_id, + Array<mojom::WindowDataPtr> views) { Change change; change.type = CHANGE_TYPE_NODE_HIERARCHY_CHANGED; - change.view_id = view_id; - change.view_id2 = new_parent_id; - change.view_id3 = old_parent_id; - ViewDatasToTestViews(views, &change.views); + change.window_id = window_id; + change.window_id2 = new_parent_id; + change.window_id3 = old_parent_id; + WindowDatasToTestViews(views, &change.views); AddChange(change); } -void TestChangeTracker::OnWindowReordered(Id view_id, - Id relative_view_id, - mojo::OrderDirection direction) { +void TestChangeTracker::OnWindowReordered(Id window_id, + Id relative_window_id, + mojom::OrderDirection direction) { Change change; change.type = CHANGE_TYPE_NODE_REORDERED; - change.view_id = view_id; - change.view_id2 = relative_view_id; + change.window_id = window_id; + change.window_id2 = relative_window_id; change.direction = direction; AddChange(change); } -void TestChangeTracker::OnWindowDeleted(Id view_id) { +void TestChangeTracker::OnWindowDeleted(Id window_id) { Change change; change.type = CHANGE_TYPE_NODE_DELETED; - change.view_id = view_id; + change.window_id = window_id; AddChange(change); } -void TestChangeTracker::OnWindowVisibilityChanged(Id view_id, bool visible) { +void TestChangeTracker::OnWindowVisibilityChanged(Id window_id, bool visible) { Change change; change.type = CHANGE_TYPE_NODE_VISIBILITY_CHANGED; - change.view_id = view_id; + change.window_id = window_id; change.bool_value = visible; AddChange(change); } -void TestChangeTracker::OnWindowDrawnStateChanged(Id view_id, bool drawn) { +void TestChangeTracker::OnWindowDrawnStateChanged(Id window_id, bool drawn) { Change change; change.type = CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED; - change.view_id = view_id; + change.window_id = window_id; change.bool_value = drawn; AddChange(change); } -void TestChangeTracker::OnWindowInputEvent(Id view_id, mojo::EventPtr event) { +void TestChangeTracker::OnWindowInputEvent(Id window_id, mojo::EventPtr event) { Change change; change.type = CHANGE_TYPE_INPUT_EVENT; - change.view_id = view_id; + change.window_id = window_id; change.event_action = event->action; AddChange(change); } -void TestChangeTracker::OnWindowSharedPropertyChanged(Id view_id, +void TestChangeTracker::OnWindowSharedPropertyChanged(Id window_id, String name, Array<uint8_t> data) { Change change; change.type = CHANGE_TYPE_PROPERTY_CHANGED; - change.view_id = view_id; + change.window_id = window_id; change.property_key = name; if (data.is_null()) change.property_value = "NULL"; @@ -288,10 +288,10 @@ void TestChangeTracker::OnWindowSharedPropertyChanged(Id view_id, AddChange(change); } -void TestChangeTracker::OnWindowFocused(Id view_id) { +void TestChangeTracker::OnWindowFocused(Id window_id) { Change change; change.type = CHANGE_TYPE_FOCUSED; - change.view_id = view_id; + change.window_id = window_id; AddChange(change); } @@ -314,15 +314,15 @@ TestView::~TestView() {} std::string TestView::ToString() const { return base::StringPrintf("view=%s parent=%s", - ViewIdToString(view_id).c_str(), + ViewIdToString(window_id).c_str(), ViewIdToString(parent_id).c_str()); } std::string TestView::ToString2() const { return base::StringPrintf( - "view=%s parent=%s visible=%s drawn=%s", ViewIdToString(view_id).c_str(), - ViewIdToString(parent_id).c_str(), visible ? "true" : "false", - drawn ? "true" : "false"); + "view=%s parent=%s visible=%s drawn=%s", + ViewIdToString(window_id).c_str(), ViewIdToString(parent_id).c_str(), + visible ? "true" : "false", drawn ? "true" : "false"); } } // namespace mus diff --git a/components/mus/ws/test_change_tracker.h b/components/mus/ws/test_change_tracker.h index aa025719b..18e4db6 100644 --- a/components/mus/ws/test_change_tracker.h +++ b/components/mus/ws/test_change_tracker.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "components/mus/public/cpp/types.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" #include "ui/mojo/geometry/geometry.mojom.h" @@ -34,7 +34,7 @@ enum ChangeType { CHANGE_TYPE_FOCUSED, }; -// TODO(sky): consider nuking and converting directly to ViewData. +// TODO(sky): consider nuking and converting directly to WindowData. struct TestView { TestView(); ~TestView(); @@ -46,7 +46,7 @@ struct TestView { std::string ToString2() const; Id parent_id; - Id view_id; + Id window_id; bool visible; bool drawn; std::map<std::string, std::vector<uint8_t>> properties; @@ -61,14 +61,14 @@ struct Change { ChangeType type; ConnectionSpecificId connection_id; std::vector<TestView> views; - Id view_id; - Id view_id2; - Id view_id3; + Id window_id; + Id window_id2; + Id window_id3; mojo::Rect bounds; mojo::Rect bounds2; int32_t event_action; mojo::String embed_url; - mojo::OrderDirection direction; + mojom::OrderDirection direction; bool bool_value; std::string property_key; std::string property_value; @@ -90,9 +90,9 @@ std::string SingleViewDescription(const std::vector<TestView>& views); // if change.size() != 1. std::string ChangeViewDescription(const std::vector<Change>& changes); -// Converts ViewDatas to TestViews. -void ViewDatasToTestViews(const mojo::Array<mojo::ViewDataPtr>& data, - std::vector<TestView>* test_views); +// Converts WindowDatas to TestViews. +void WindowDatasToTestViews(const mojo::Array<mojom::WindowDataPtr>& data, + std::vector<TestView>* test_views); // TestChangeTracker is used to record ViewTreeClient functions. It notifies // a delegate any time a change is added. @@ -117,29 +117,29 @@ 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(ConnectionSpecificId connection_id, mojom::WindowDataPtr root); + void OnEmbeddedAppDisconnected(Id window_id); void OnUnembed(); - void OnWindowBoundsChanged(Id view_id, + void OnWindowBoundsChanged(Id window_id, mojo::RectPtr old_bounds, mojo::RectPtr new_bounds); - void OnWindowViewportMetricsChanged(mojo::ViewportMetricsPtr old_bounds, - mojo::ViewportMetricsPtr new_bounds); - void OnWindowHierarchyChanged(Id view_id, + void OnWindowViewportMetricsChanged(mojom::ViewportMetricsPtr old_bounds, + mojom::ViewportMetricsPtr new_bounds); + void OnWindowHierarchyChanged(Id window_id, Id new_parent_id, Id old_parent_id, - mojo::Array<mojo::ViewDataPtr> views); - void OnWindowReordered(Id view_id, - Id relative_view_id, - mojo::OrderDirection direction); - void OnWindowDeleted(Id view_id); - void OnWindowVisibilityChanged(Id view_id, bool visible); - void OnWindowDrawnStateChanged(Id view_id, bool drawn); - void OnWindowInputEvent(Id view_id, mojo::EventPtr event); - void OnWindowSharedPropertyChanged(Id view_id, + mojo::Array<mojom::WindowDataPtr> views); + void OnWindowReordered(Id window_id, + Id relative_window_id, + mojom::OrderDirection direction); + void OnWindowDeleted(Id window_id); + void OnWindowVisibilityChanged(Id window_id, bool visible); + void OnWindowDrawnStateChanged(Id window_id, bool drawn); + void OnWindowInputEvent(Id window_id, mojo::EventPtr event); + void OnWindowSharedPropertyChanged(Id window_id, mojo::String name, mojo::Array<uint8_t> data); - void OnWindowFocused(Id view_id); + void OnWindowFocused(Id window_id); void DelegateEmbed(const mojo::String& url); private: diff --git a/components/mus/ws/view_manager_client_apptest.cc b/components/mus/ws/view_manager_client_apptest.cc index 7dd8738..c019028 100644 --- a/components/mus/ws/view_manager_client_apptest.cc +++ b/components/mus/ws/view_manager_client_apptest.cc @@ -131,7 +131,7 @@ class OrderChangeObserver : public WindowObserver { // Overridden from WindowObserver: void OnWindowReordered(Window* window, Window* relative_window, - mojo::OrderDirection direction) override { + mojom::OrderDirection direction) override { DCHECK_EQ(window, window_); EXPECT_TRUE(WindowServerTestBase::QuitRunLoop()); } @@ -203,7 +203,7 @@ class WindowServerTest : public WindowServerTestBase { // a response is received, or a timeout. On success the new WindowServer is // returned. EmbedResult Embed(Window* window) { - return Embed(window, mojo::ViewTree::ACCESS_POLICY_DEFAULT); + return Embed(window, mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT); } EmbedResult Embed(Window* window, uint32_t access_policy_bitmask) { @@ -223,13 +223,14 @@ class WindowServerTest : public WindowServerTestBase { } // Establishes a connection to this application and asks for a - // ViewTreeClient. - mojo::ViewTreeClientPtr ConnectToApplicationAndGetWindowServerClient() { + // WindowTreeClient. + mus::mojom::WindowTreeClientPtr + ConnectToApplicationAndGetWindowServerClient() { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From(application_impl()->url()); scoped_ptr<mojo::ApplicationConnection> connection = application_impl()->ConnectToApplication(request.Pass()); - mojo::ViewTreeClientPtr client; + mus::mojom::WindowTreeClientPtr client; connection->ConnectToService(&client); return client.Pass(); } @@ -822,7 +823,8 @@ TEST_F(WindowServerTest, EmbedRootSeesHierarchyChanged) { window_manager()->GetRoot()->AddChild(embed_window); WindowTreeConnection* vm2 = - Embed(embed_window, mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT).connection; + Embed(embed_window, mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT) + .connection; Window* vm2_v1 = vm2->CreateWindow(); vm2->GetRoot()->AddChild(vm2_v1); @@ -840,7 +842,7 @@ TEST_F(WindowServerTest, EmbedFromEmbedRoot) { // Give the connection embedded at |embed_window| embed root powers. const EmbedResult result1 = - Embed(embed_window, mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT); + Embed(embed_window, mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT); WindowTreeConnection* vm2 = result1.connection; EXPECT_EQ(result1.connection_id, vm2->GetConnectionId()); Window* vm2_v1 = vm2->CreateWindow(); diff --git a/components/mus/ws/view_tree_apptest.cc b/components/mus/ws/view_tree_apptest.cc index 08c7be4..f035d27 100644 --- a/components/mus/ws/view_tree_apptest.cc +++ b/components/mus/ws/view_tree_apptest.cc @@ -6,8 +6,8 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/mus/ws/ids.h" #include "components/mus/ws/test_change_tracker.h" #include "mojo/application/public/cpp/application_delegate.h" @@ -18,21 +18,18 @@ using mojo::ApplicationConnection; using mojo::ApplicationDelegate; using mojo::Array; using mojo::Callback; -using mojo::ERROR_CODE_NONE; -using mojo::ErrorCode; using mojo::EventPtr; using mojo::InterfaceRequest; -using mojo::ORDER_DIRECTION_ABOVE; -using mojo::ORDER_DIRECTION_BELOW; -using mojo::OrderDirection; using mojo::RectPtr; using mojo::ServiceProvider; using mojo::ServiceProviderPtr; using mojo::String; -using mojo::ViewDataPtr; -using mojo::ViewTree; -using mojo::ViewTreeClient; -using mojo::ViewportMetricsPtr; +using mus::mojom::ERROR_CODE_NONE; +using mus::mojom::ErrorCode; +using mus::mojom::ViewportMetricsPtr; +using mus::mojom::WindowDataPtr; +using mus::mojom::WindowTree; +using mus::mojom::WindowTreeClient; namespace mus { @@ -40,11 +37,12 @@ namespace { // Creates an id used for transport from the specified parameters. Id BuildViewId(ConnectionSpecificId connection_id, - ConnectionSpecificId view_id) { - return (connection_id << 16) | view_id; + ConnectionSpecificId window_id) { + return (connection_id << 16) | window_id; } -// Callback function from ViewTree functions. ---------------------------------- +// Callback function from WindowTree functions. +// ---------------------------------- void BoolResultCallback(base::RunLoop* run_loop, bool* result_cache, @@ -60,10 +58,10 @@ void ErrorCodeResultCallback(base::RunLoop* run_loop, run_loop->Quit(); } -void ViewTreeResultCallback(base::RunLoop* run_loop, - std::vector<TestView>* views, - Array<ViewDataPtr> results) { - ViewDatasToTestViews(results, views); +void WindowTreeResultCallback(base::RunLoop* run_loop, + std::vector<TestView>* views, + Array<WindowDataPtr> results) { + WindowDatasToTestViews(results, views); run_loop->Quit(); } @@ -78,7 +76,7 @@ void EmbedCallbackImpl(base::RunLoop* run_loop, // ----------------------------------------------------------------------------- bool EmbedUrl(mojo::ApplicationImpl* app, - ViewTree* vm, + WindowTree* vm, const String& url, Id root_id) { bool result = false; @@ -88,81 +86,82 @@ bool EmbedUrl(mojo::ApplicationImpl* app, request->url = mojo::String::From(url); scoped_ptr<ApplicationConnection> connection = app->ConnectToApplication(request.Pass()); - mojo::ViewTreeClientPtr client; + mojom::WindowTreeClientPtr client; connection->ConnectToService(&client); - vm->Embed(root_id, client.Pass(), mojo::ViewTree::ACCESS_POLICY_DEFAULT, + vm->Embed(root_id, client.Pass(), mojom::WindowTree::ACCESS_POLICY_DEFAULT, base::Bind(&EmbedCallbackImpl, &run_loop, &result)); } run_loop.Run(); return result; } -bool Embed(ViewTree* vm, Id root_id, mojo::ViewTreeClientPtr client) { +bool Embed(WindowTree* vm, Id root_id, mojom::WindowTreeClientPtr client) { bool result = false; base::RunLoop run_loop; { - vm->Embed(root_id, client.Pass(), mojo::ViewTree::ACCESS_POLICY_DEFAULT, + vm->Embed(root_id, client.Pass(), mojom::WindowTree::ACCESS_POLICY_DEFAULT, base::Bind(&EmbedCallbackImpl, &run_loop, &result)); } run_loop.Run(); return result; } -ErrorCode CreateViewWithErrorCode(ViewTree* vm, Id view_id) { +ErrorCode NewWindowWithErrorCode(WindowTree* vm, Id window_id) { ErrorCode result = ERROR_CODE_NONE; base::RunLoop run_loop; - vm->CreateView(view_id, - base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); + vm->NewWindow(window_id, + base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); run_loop.Run(); return result; } -bool AddView(ViewTree* vm, Id parent, Id child) { +bool AddWindow(WindowTree* vm, Id parent, Id child) { bool result = false; base::RunLoop run_loop; - vm->AddView(parent, child, - base::Bind(&BoolResultCallback, &run_loop, &result)); + vm->AddWindow(parent, child, + base::Bind(&BoolResultCallback, &run_loop, &result)); run_loop.Run(); return result; } -bool RemoveViewFromParent(ViewTree* vm, Id view_id) { +bool RemoveWindowFromParent(WindowTree* vm, Id window_id) { bool result = false; base::RunLoop run_loop; - vm->RemoveViewFromParent(view_id, - base::Bind(&BoolResultCallback, &run_loop, &result)); + vm->RemoveWindowFromParent( + window_id, base::Bind(&BoolResultCallback, &run_loop, &result)); run_loop.Run(); return result; } -bool ReorderView(ViewTree* vm, - Id view_id, - Id relative_view_id, - OrderDirection direction) { +bool ReorderWindow(WindowTree* vm, + Id window_id, + Id relative_window_id, + mojom::OrderDirection direction) { bool result = false; base::RunLoop run_loop; - vm->ReorderView(view_id, relative_view_id, direction, - base::Bind(&BoolResultCallback, &run_loop, &result)); + vm->ReorderWindow(window_id, relative_window_id, direction, + base::Bind(&BoolResultCallback, &run_loop, &result)); run_loop.Run(); return result; } -void GetViewTree(ViewTree* vm, Id view_id, std::vector<TestView>* views) { +void GetWindowTree(WindowTree* vm, Id window_id, std::vector<TestView>* views) { base::RunLoop run_loop; - vm->GetViewTree(view_id, - base::Bind(&ViewTreeResultCallback, &run_loop, views)); + vm->GetWindowTree(window_id, + base::Bind(&WindowTreeResultCallback, &run_loop, views)); run_loop.Run(); } -bool DeleteView(ViewTree* vm, Id view_id) { +bool DeleteWindow(WindowTree* vm, Id window_id) { base::RunLoop run_loop; bool result = false; - vm->DeleteView(view_id, base::Bind(&BoolResultCallback, &run_loop, &result)); + vm->DeleteWindow(window_id, + base::Bind(&BoolResultCallback, &run_loop, &result)); run_loop.Run(); return result; } -bool SetViewBounds(ViewTree* vm, Id view_id, int x, int y, int w, int h) { +bool SetWindowBounds(WindowTree* vm, Id window_id, int x, int y, int w, int h) { base::RunLoop run_loop; bool result = false; RectPtr rect(mojo::Rect::New()); @@ -170,32 +169,32 @@ bool SetViewBounds(ViewTree* vm, Id view_id, int x, int y, int w, int h) { rect->y = y; rect->width = w; rect->height = h; - vm->SetViewBounds(view_id, rect.Pass(), - base::Bind(&BoolResultCallback, &run_loop, &result)); + vm->SetWindowBounds(window_id, rect.Pass(), + base::Bind(&BoolResultCallback, &run_loop, &result)); run_loop.Run(); return result; } -bool SetViewVisibility(ViewTree* vm, Id view_id, bool visible) { +bool SetWindowVisibility(WindowTree* vm, Id window_id, bool visible) { base::RunLoop run_loop; bool result = false; - vm->SetViewVisibility(view_id, visible, - base::Bind(&BoolResultCallback, &run_loop, &result)); + vm->SetWindowVisibility(window_id, visible, + base::Bind(&BoolResultCallback, &run_loop, &result)); run_loop.Run(); return result; } -bool SetViewProperty(ViewTree* vm, - Id view_id, - const std::string& name, - const std::vector<uint8_t>* data) { +bool SetWindowProperty(WindowTree* vm, + Id window_id, + const std::string& name, + const std::vector<uint8_t>* data) { base::RunLoop run_loop; bool result = false; Array<uint8_t> mojo_data; if (data) mojo_data = Array<uint8_t>::From(*data); - vm->SetViewProperty(view_id, name, mojo_data.Pass(), - base::Bind(&BoolResultCallback, &run_loop, &result)); + vm->SetWindowProperty(window_id, name, mojo_data.Pass(), + base::Bind(&BoolResultCallback, &run_loop, &result)); run_loop.Run(); return result; } @@ -205,11 +204,11 @@ bool SetViewProperty(ViewTree* vm, // Waits for all messages to be received by |vm|. This is done by attempting to // create a bogus view. When we get the response we know all messages have been // processed. -bool WaitForAllMessages(ViewTree* vm) { +bool WaitForAllMessages(WindowTree* vm) { ErrorCode result = ERROR_CODE_NONE; base::RunLoop run_loop; - vm->CreateView(ViewIdToTransportId(InvalidViewId()), - base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); + vm->NewWindow(ViewIdToTransportId(InvalidViewId()), + base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); run_loop.Run(); return result != ERROR_CODE_NONE; } @@ -227,24 +226,24 @@ 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 { +// A WindowTreeClient implementation that logs all changes to a tracker. +class TestWindowTreeClientImpl : public mojom::WindowTreeClient, + public TestChangeTracker::Delegate { public: - explicit TestViewTreeClientImpl(mojo::ApplicationImpl* app) - : binding_(this), app_(app), connection_id_(0), root_view_id_(0) { + explicit TestWindowTreeClientImpl(mojo::ApplicationImpl* app) + : binding_(this), app_(app), connection_id_(0), root_window_id_(0) { tracker_.set_delegate(this); } - void Bind(mojo::InterfaceRequest<mojo::ViewTreeClient> request) { + void Bind(mojo::InterfaceRequest<mojom::WindowTreeClient> request) { binding_.Bind(request.Pass()); } - mojo::ViewTree* tree() { return tree_.get(); } + mojom::WindowTree* tree() { return tree_.get(); } TestChangeTracker* tracker() { return &tracker_; } // Runs a nested MessageLoop until |count| changes (calls to - // ViewTreeClient functions) have been received. + // WindowTreeClient functions) have been received. void WaitForChangeCount(size_t count) { if (tracker_.changes()->size() >= count) return; @@ -269,17 +268,17 @@ class TestViewTreeClientImpl : public mojo::ViewTreeClient, return binding_.WaitForIncomingMethodCall(); } - Id CreateView(ConnectionSpecificId view_id) { + Id NewWindow(ConnectionSpecificId window_id) { ErrorCode result = ERROR_CODE_NONE; base::RunLoop run_loop; - Id id = BuildViewId(connection_id_, view_id); - tree()->CreateView( - id, base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); + Id id = BuildViewId(connection_id_, window_id); + tree()->NewWindow(id, + base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); run_loop.Run(); return result == ERROR_CODE_NONE ? id : 0; } - void set_root_view(Id root_view_id) { root_view_id_ = root_view_id; } + void set_root_view(Id root_window_id) { root_window_id_ = root_window_id; } private: // Used when running a nested MessageLoop. @@ -299,32 +298,32 @@ class TestViewTreeClientImpl : public mojo::ViewTreeClient, } } - // ViewTreeClient: + // WindowTreeClient: void OnEmbed(ConnectionSpecificId connection_id, - ViewDataPtr root, - mojo::ViewTreePtr tree, - Id focused_view_id, + WindowDataPtr root, + mojom::WindowTreePtr tree, + Id focused_window_id, uint32_t access_policy) override { - // TODO(sky): add coverage of |focused_view_id|. + // TODO(sky): add coverage of |focused_window_id|. tree_ = tree.Pass(); connection_id_ = connection_id; tracker()->OnEmbed(connection_id, root.Pass()); if (embed_run_loop_) embed_run_loop_->Quit(); } - void OnEmbeddedAppDisconnected(Id view_id) override { - tracker()->OnEmbeddedAppDisconnected(view_id); + void OnEmbeddedAppDisconnected(Id window_id) override { + tracker()->OnEmbeddedAppDisconnected(window_id); } void OnUnembed() override { tracker()->OnUnembed(); } - void OnWindowBoundsChanged(Id view_id, + void OnWindowBoundsChanged(Id window_id, RectPtr old_bounds, RectPtr new_bounds) override { // The bounds of the root may change during startup on Android at random // times. As this doesn't matter, and shouldn't impact test exepctations, // it is ignored. - if (view_id == root_view_id_) + if (window_id == root_window_id_) return; - tracker()->OnWindowBoundsChanged(view_id, old_bounds.Pass(), + tracker()->OnWindowBoundsChanged(window_id, old_bounds.Pass(), new_bounds.Pass()); } void OnClientAreaChanged(uint32_t window_id, @@ -338,14 +337,14 @@ class TestViewTreeClientImpl : public mojo::ViewTreeClient, void OnWindowHierarchyChanged(Id view, Id new_parent, Id old_parent, - Array<ViewDataPtr> views) override { + Array<WindowDataPtr> views) override { tracker()->OnWindowHierarchyChanged(view, new_parent, old_parent, views.Pass()); } - void OnWindowReordered(Id view_id, - Id relative_view_id, - OrderDirection direction) override { - tracker()->OnWindowReordered(view_id, relative_view_id, direction); + void OnWindowReordered(Id window_id, + Id relative_window_id, + mojom::OrderDirection direction) override { + tracker()->OnWindowReordered(window_id, relative_window_id, direction); } void OnWindowDeleted(Id view) override { tracker()->OnWindowDeleted(view); } void OnWindowVisibilityChanged(uint32_t view, bool visible) override { @@ -354,7 +353,7 @@ class TestViewTreeClientImpl : public mojo::ViewTreeClient, void OnWindowDrawnStateChanged(uint32_t view, bool drawn) override { tracker()->OnWindowDrawnStateChanged(view, drawn); } - void OnWindowInputEvent(Id view_id, + void OnWindowInputEvent(Id window_id, EventPtr event, const Callback<void()>& callback) override { // Don't log input events as none of the tests care about them and they @@ -367,11 +366,11 @@ class TestViewTreeClientImpl : public mojo::ViewTreeClient, tracker_.OnWindowSharedPropertyChanged(view, name, new_data.Pass()); } // TODO(sky): add testing coverage. - void OnWindowFocused(uint32_t focused_view_id) override {} + void OnWindowFocused(uint32_t focused_window_id) override {} TestChangeTracker tracker_; - mojo::ViewTreePtr tree_; + mojom::WindowTreePtr tree_; // If non-null we're waiting for OnEmbed() using this RunLoop. scoped_ptr<base::RunLoop> embed_run_loop_; @@ -380,24 +379,25 @@ class TestViewTreeClientImpl : public mojo::ViewTreeClient, // be encountered. scoped_ptr<WaitState> wait_state_; - mojo::Binding<ViewTreeClient> binding_; + mojo::Binding<WindowTreeClient> binding_; mojo::ApplicationImpl* app_; Id connection_id_; - Id root_view_id_; + Id root_window_id_; - DISALLOW_COPY_AND_ASSIGN(TestViewTreeClientImpl); + DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClientImpl); }; // ----------------------------------------------------------------------------- -// InterfaceFactory for vending TestViewTreeClientImpls. -class ViewTreeClientFactory : public mojo::InterfaceFactory<ViewTreeClient> { +// InterfaceFactory for vending TestWindowTreeClientImpls. +class WindowTreeClientFactory + : public mojo::InterfaceFactory<WindowTreeClient> { public: - explicit ViewTreeClientFactory(mojo::ApplicationImpl* app) : app_(app) {} - ~ViewTreeClientFactory() override {} + explicit WindowTreeClientFactory(mojo::ApplicationImpl* app) : app_(app) {} + ~WindowTreeClientFactory() override {} // Runs a nested MessageLoop until a new instance has been created. - scoped_ptr<TestViewTreeClientImpl> WaitForInstance() { + scoped_ptr<TestWindowTreeClientImpl> WaitForInstance() { if (!client_impl_.get()) { DCHECK(!run_loop_.get()); run_loop_.reset(new base::RunLoop); @@ -408,30 +408,30 @@ class ViewTreeClientFactory : public mojo::InterfaceFactory<ViewTreeClient> { } private: - // InterfaceFactory<ViewTreeClient>: + // InterfaceFactory<WindowTreeClient>: void Create(ApplicationConnection* connection, - InterfaceRequest<ViewTreeClient> request) override { - client_impl_.reset(new TestViewTreeClientImpl(app_)); + InterfaceRequest<WindowTreeClient> request) override { + client_impl_.reset(new TestWindowTreeClientImpl(app_)); client_impl_->Bind(request.Pass()); if (run_loop_.get()) run_loop_->Quit(); } mojo::ApplicationImpl* app_; - scoped_ptr<TestViewTreeClientImpl> client_impl_; + scoped_ptr<TestWindowTreeClientImpl> client_impl_; scoped_ptr<base::RunLoop> run_loop_; - DISALLOW_COPY_AND_ASSIGN(ViewTreeClientFactory); + DISALLOW_COPY_AND_ASSIGN(WindowTreeClientFactory); }; } // namespace -class ViewTreeAppTest : public mojo::test::ApplicationTestBase, - public ApplicationDelegate { +class WindowTreeAppTest : public mojo::test::ApplicationTestBase, + public ApplicationDelegate { public: - ViewTreeAppTest() - : connection_id_1_(0), connection_id_2_(0), root_view_id_(0) {} - ~ViewTreeAppTest() override {} + WindowTreeAppTest() + : connection_id_1_(0), connection_id_2_(0), root_window_id_(0) {} + ~WindowTreeAppTest() override {} protected: // Returns the changes from the various connections. @@ -441,15 +441,15 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, // Various connections. |vm1()|, being the first connection, has special // permissions (it's treated as the window manager). - ViewTree* vm1() { return vm_client1_->tree(); } - ViewTree* vm2() { return vm_client2_->tree(); } - ViewTree* vm3() { return vm_client3_->tree(); } + WindowTree* vm1() { return vm_client1_->tree(); } + WindowTree* vm2() { return vm_client2_->tree(); } + WindowTree* 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(); } + TestWindowTreeClientImpl* vm_client1() { return vm_client1_.get(); } + TestWindowTreeClientImpl* vm_client2() { return vm_client2_.get(); } + TestWindowTreeClientImpl* vm_client3() { return vm_client3_.get(); } - Id root_view_id() const { return root_view_id_; } + Id root_window_id() const { return root_window_id_; } int connection_id_1() const { return connection_id_1_; } int connection_id_2() const { return connection_id_2_; } @@ -460,13 +460,13 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, EstablishConnectionViaEmbed(vm1(), root_id, &connection_id_2_); ASSERT_GT(connection_id_2_, 0); ASSERT_TRUE(vm_client2_.get() != nullptr); - vm_client2_->set_root_view(root_view_id_); + vm_client2_->set_root_view(root_window_id_); } void EstablishSecondConnection(bool create_initial_view) { Id view_1_1 = 0; if (create_initial_view) { - view_1_1 = vm_client1()->CreateView(1); + view_1_1 = vm_client1()->NewWindow(1); ASSERT_TRUE(view_1_1); } ASSERT_NO_FATAL_FAILURE( @@ -478,27 +478,30 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, } } - void EstablishThirdConnection(ViewTree* owner, Id root_id) { + void EstablishThirdConnection(WindowTree* owner, Id root_id) { ASSERT_TRUE(vm_client3_.get() == nullptr); vm_client3_ = EstablishConnectionViaEmbed(owner, root_id, nullptr); ASSERT_TRUE(vm_client3_.get() != nullptr); - vm_client3_->set_root_view(root_view_id_); + vm_client3_->set_root_view(root_window_id_); } - scoped_ptr<TestViewTreeClientImpl> WaitForViewTreeClient() { + scoped_ptr<TestWindowTreeClientImpl> WaitForWindowTreeClient() { return client_factory_->WaitForInstance(); } // Establishes a new connection by way of Embed() on the specified - // ViewTree. - scoped_ptr<TestViewTreeClientImpl> - EstablishConnectionViaEmbed(ViewTree* owner, Id root_id, int* connection_id) { + // WindowTree. + scoped_ptr<TestWindowTreeClientImpl> EstablishConnectionViaEmbed( + WindowTree* owner, + Id root_id, + int* connection_id) { return EstablishConnectionViaEmbedWithPolicyBitmask( - owner, root_id, mojo::ViewTree::ACCESS_POLICY_DEFAULT, connection_id); + owner, root_id, mojom::WindowTree::ACCESS_POLICY_DEFAULT, + connection_id); } - scoped_ptr<TestViewTreeClientImpl> - EstablishConnectionViaEmbedWithPolicyBitmask(ViewTree* owner, + scoped_ptr<TestWindowTreeClientImpl> + EstablishConnectionViaEmbedWithPolicyBitmask(WindowTree* owner, Id root_id, uint32_t policy_bitmask, int* connection_id) { @@ -507,7 +510,7 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, ADD_FAILURE() << "Embed() failed"; return nullptr; } - scoped_ptr<TestViewTreeClientImpl> client = + scoped_ptr<TestWindowTreeClientImpl> client = client_factory_->WaitForInstance(); if (!client.get()) { ADD_FAILURE() << "WaitForInstance failed"; @@ -526,19 +529,19 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, ApplicationDelegate* GetApplicationDelegate() override { return this; } void SetUp() override { ApplicationTestBase::SetUp(); - client_factory_.reset(new ViewTreeClientFactory(application_impl())); + client_factory_.reset(new WindowTreeClientFactory(application_impl())); mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From("mojo:mus"); - mojo::ViewTreeHostFactoryPtr factory; + mojom::WindowTreeHostFactoryPtr factory; application_impl()->ConnectToService(request.Pass(), &factory); - mojo::ViewTreeClientPtr tree_client_ptr; - vm_client1_.reset(new TestViewTreeClientImpl(application_impl())); + mojom::WindowTreeClientPtr tree_client_ptr; + vm_client1_.reset(new TestWindowTreeClientImpl(application_impl())); vm_client1_->Bind(GetProxy(&tree_client_ptr)); factory->CreateWindowTreeHost(GetProxy(&host_), - mojo::ViewTreeHostClientPtr(), + mojom::WindowTreeHostClientPtr(), tree_client_ptr.Pass()); // Next we should get an embed call on the "window manager" client. @@ -552,8 +555,8 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, ASSERT_GT((*changes1())[0].connection_id, 0); connection_id_1_ = (*changes1())[0].connection_id; ASSERT_FALSE((*changes1())[0].views.empty()); - root_view_id_ = (*changes1())[0].views[0].view_id; - vm_client1_->set_root_view(root_view_id_); + root_window_id_ = (*changes1())[0].views[0].window_id; + vm_client1_->set_root_view(root_window_id_); changes1()->clear(); } @@ -563,23 +566,23 @@ class ViewTreeAppTest : public mojo::test::ApplicationTestBase, return true; } - scoped_ptr<TestViewTreeClientImpl> vm_client1_; - scoped_ptr<TestViewTreeClientImpl> vm_client2_; - scoped_ptr<TestViewTreeClientImpl> vm_client3_; + scoped_ptr<TestWindowTreeClientImpl> vm_client1_; + scoped_ptr<TestWindowTreeClientImpl> vm_client2_; + scoped_ptr<TestWindowTreeClientImpl> vm_client3_; - mojo::ViewTreeHostPtr host_; + mojom::WindowTreeHostPtr host_; private: - scoped_ptr<ViewTreeClientFactory> client_factory_; + scoped_ptr<WindowTreeClientFactory> client_factory_; int connection_id_1_; int connection_id_2_; - Id root_view_id_; + Id root_window_id_; - MOJO_DISALLOW_COPY_AND_ASSIGN(ViewTreeAppTest); + MOJO_DISALLOW_COPY_AND_ASSIGN(WindowTreeAppTest); }; // Verifies two clients/connections get different ids. -TEST_F(ViewTreeAppTest, TwoClientsGetDifferentConnectionIds) { +TEST_F(WindowTreeAppTest, TwoClientsGetDifferentConnectionIds) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); ASSERT_EQ(1u, changes2()->size()); @@ -587,15 +590,15 @@ TEST_F(ViewTreeAppTest, TwoClientsGetDifferentConnectionIds) { } // Verifies when Embed() is invoked any child views are removed. -TEST_F(ViewTreeAppTest, ViewsRemovedWhenEmbedding) { +TEST_F(WindowTreeAppTest, ViewsRemovedWhenEmbedding) { // Two views 1 and 2. 2 is parented to 1. - Id view_1_1 = vm_client1()->CreateView(1); + Id view_1_1 = vm_client1()->NewWindow(1); ASSERT_TRUE(view_1_1); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); - Id view_1_2 = vm_client1()->CreateView(2); + Id view_1_2 = vm_client1()->NewWindow(2); ASSERT_TRUE(view_1_2); - ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_2)); + ASSERT_TRUE(AddWindow(vm1(), view_1_1, view_1_2)); ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); ASSERT_EQ(1u, changes2()->size()); @@ -606,7 +609,7 @@ TEST_F(ViewTreeAppTest, ViewsRemovedWhenEmbedding) { // Embed() removed view 2. { std::vector<TestView> views; - GetViewTree(vm1(), view_1_2, &views); + GetWindowTree(vm1(), view_1_2, &views); EXPECT_EQ(ViewParentToString(view_1_2, kNullParentId), SingleViewDescription(views)); } @@ -614,22 +617,22 @@ TEST_F(ViewTreeAppTest, ViewsRemovedWhenEmbedding) { // vm2 should not see view 2. { std::vector<TestView> views; - GetViewTree(vm2(), view_1_1, &views); + GetWindowTree(vm2(), view_1_1, &views); EXPECT_EQ(ViewParentToString(view_1_1, kNullParentId), SingleViewDescription(views)); } { std::vector<TestView> views; - GetViewTree(vm2(), view_1_2, &views); + GetWindowTree(vm2(), view_1_2, &views); EXPECT_TRUE(views.empty()); } // Views 3 and 4 in connection 2. - Id view_2_3 = vm_client2()->CreateView(3); - Id view_2_4 = vm_client2()->CreateView(4); + Id view_2_3 = vm_client2()->NewWindow(3); + Id view_2_4 = vm_client2()->NewWindow(4); ASSERT_TRUE(view_2_3); ASSERT_TRUE(view_2_4); - ASSERT_TRUE(AddView(vm2(), view_2_3, view_2_4)); + ASSERT_TRUE(AddWindow(vm2(), view_2_3, view_2_4)); // Connection 3 rooted at 2. ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_3)); @@ -637,12 +640,12 @@ TEST_F(ViewTreeAppTest, ViewsRemovedWhenEmbedding) { // View 4 should no longer have a parent. { std::vector<TestView> views; - GetViewTree(vm2(), view_2_3, &views); + GetWindowTree(vm2(), view_2_3, &views); EXPECT_EQ(ViewParentToString(view_2_3, kNullParentId), SingleViewDescription(views)); views.clear(); - GetViewTree(vm2(), view_2_4, &views); + GetWindowTree(vm2(), view_2_4, &views); EXPECT_EQ(ViewParentToString(view_2_4, kNullParentId), SingleViewDescription(views)); } @@ -650,7 +653,7 @@ TEST_F(ViewTreeAppTest, ViewsRemovedWhenEmbedding) { // And view 4 should not be visible to connection 3. { std::vector<TestView> views; - GetViewTree(vm3(), view_2_3, &views); + GetWindowTree(vm3(), view_2_3, &views); EXPECT_EQ(ViewParentToString(view_2_3, kNullParentId), SingleViewDescription(views)); } @@ -658,25 +661,25 @@ TEST_F(ViewTreeAppTest, ViewsRemovedWhenEmbedding) { // Verifies once Embed() has been invoked the parent connection can't see any // children. -TEST_F(ViewTreeAppTest, CantAccessChildrenOfEmbeddedView) { +TEST_F(WindowTreeAppTest, CantAccessChildrenOfEmbeddedView) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - Id view_2_2 = vm_client2()->CreateView(2); + Id view_2_2 = vm_client2()->NewWindow(2); ASSERT_TRUE(view_2_2); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); - Id view_3_3 = vm_client3()->CreateView(3); + Id view_3_3 = vm_client3()->NewWindow(3); ASSERT_TRUE(view_3_3); - ASSERT_TRUE(AddView(vm3(), view_2_2, view_3_3)); + ASSERT_TRUE(AddWindow(vm3(), view_2_2, view_3_3)); // Even though 3 is a child of 2 connection 2 can't see 3 as it's from a // different connection. { std::vector<TestView> views; - GetViewTree(vm2(), view_2_2, &views); + GetWindowTree(vm2(), view_2_2, &views); EXPECT_EQ(ViewParentToString(view_2_2, view_1_1), SingleViewDescription(views)); } @@ -684,14 +687,14 @@ TEST_F(ViewTreeAppTest, CantAccessChildrenOfEmbeddedView) { // Connection 2 shouldn't be able to get view 3 at all. { std::vector<TestView> views; - GetViewTree(vm2(), view_3_3, &views); + GetWindowTree(vm2(), view_3_3, &views); EXPECT_TRUE(views.empty()); } // Connection 1 should be able to see it all (its the root). { std::vector<TestView> views; - GetViewTree(vm1(), view_1_1, &views); + GetWindowTree(vm1(), view_1_1, &views); ASSERT_EQ(3u, views.size()); EXPECT_EQ(ViewParentToString(view_1_1, kNullParentId), views[0].ToString()); EXPECT_EQ(ViewParentToString(view_2_2, view_1_1), views[1].ToString()); @@ -700,84 +703,84 @@ TEST_F(ViewTreeAppTest, CantAccessChildrenOfEmbeddedView) { } // Verifies once Embed() has been invoked the parent can't mutate the children. -TEST_F(ViewTreeAppTest, CantModifyChildrenOfEmbeddedView) { +TEST_F(WindowTreeAppTest, CantModifyChildrenOfEmbeddedView) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - Id view_2_2 = vm_client2()->CreateView(2); + Id view_2_2 = vm_client2()->NewWindow(2); ASSERT_TRUE(view_2_2); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); - Id view_2_3 = vm_client2()->CreateView(3); + Id view_2_3 = vm_client2()->NewWindow(3); ASSERT_TRUE(view_2_3); // Connection 2 shouldn't be able to add anything to the view anymore. - ASSERT_FALSE(AddView(vm2(), view_2_2, view_2_3)); + ASSERT_FALSE(AddWindow(vm2(), view_2_2, view_2_3)); // Create view 3 in connection 3 and add it to view 3. - Id view_3_3 = vm_client3()->CreateView(3); + Id view_3_3 = vm_client3()->NewWindow(3); ASSERT_TRUE(view_3_3); - ASSERT_TRUE(AddView(vm3(), view_2_2, view_3_3)); + ASSERT_TRUE(AddWindow(vm3(), view_2_2, view_3_3)); // Connection 2 shouldn't be able to remove view 3. - ASSERT_FALSE(RemoveViewFromParent(vm2(), view_3_3)); + ASSERT_FALSE(RemoveWindowFromParent(vm2(), view_3_3)); } // Verifies client gets a valid id. -TEST_F(ViewTreeAppTest, CreateView) { - Id view_1_1 = vm_client1()->CreateView(1); +TEST_F(WindowTreeAppTest, NewWindow) { + Id view_1_1 = vm_client1()->NewWindow(1); ASSERT_TRUE(view_1_1); EXPECT_TRUE(changes1()->empty()); // Can't create a view with the same id. - ASSERT_EQ(mojo::ERROR_CODE_VALUE_IN_USE, - CreateViewWithErrorCode(vm1(), view_1_1)); + ASSERT_EQ(mojom::ERROR_CODE_VALUE_IN_USE, + NewWindowWithErrorCode(vm1(), view_1_1)); EXPECT_TRUE(changes1()->empty()); // Can't create a view with a bogus connection id. EXPECT_EQ( - mojo::ERROR_CODE_ILLEGAL_ARGUMENT, - CreateViewWithErrorCode(vm1(), BuildViewId(connection_id_1() + 1, 1))); + mojom::ERROR_CODE_ILLEGAL_ARGUMENT, + NewWindowWithErrorCode(vm1(), BuildViewId(connection_id_1() + 1, 1))); EXPECT_TRUE(changes1()->empty()); } -// Verifies AddView fails when view is already in position. -TEST_F(ViewTreeAppTest, AddViewWithNoChange) { - Id view_1_2 = vm_client1()->CreateView(2); - Id view_1_3 = vm_client1()->CreateView(3); +// Verifies AddWindow fails when view is already in position. +TEST_F(WindowTreeAppTest, AddWindowWithNoChange) { + Id view_1_2 = vm_client1()->NewWindow(2); + Id view_1_3 = vm_client1()->NewWindow(3); ASSERT_TRUE(view_1_2); ASSERT_TRUE(view_1_3); ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); // Make 3 a child of 2. - ASSERT_TRUE(AddView(vm1(), view_1_2, view_1_3)); + ASSERT_TRUE(AddWindow(vm1(), view_1_2, view_1_3)); // Try again, this should fail. - EXPECT_FALSE(AddView(vm1(), view_1_2, view_1_3)); + EXPECT_FALSE(AddWindow(vm1(), view_1_2, view_1_3)); } -// Verifies AddView fails when view is already in position. -TEST_F(ViewTreeAppTest, AddAncestorFails) { - Id view_1_2 = vm_client1()->CreateView(2); - Id view_1_3 = vm_client1()->CreateView(3); +// Verifies AddWindow fails when view is already in position. +TEST_F(WindowTreeAppTest, AddAncestorFails) { + Id view_1_2 = vm_client1()->NewWindow(2); + Id view_1_3 = vm_client1()->NewWindow(3); ASSERT_TRUE(view_1_2); ASSERT_TRUE(view_1_3); ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); // Make 3 a child of 2. - ASSERT_TRUE(AddView(vm1(), view_1_2, view_1_3)); + ASSERT_TRUE(AddWindow(vm1(), view_1_2, view_1_3)); // Try to make 2 a child of 3, this should fail since 2 is an ancestor of 3. - EXPECT_FALSE(AddView(vm1(), view_1_3, view_1_2)); + EXPECT_FALSE(AddWindow(vm1(), view_1_3, view_1_2)); } // Verifies adding to root sends right notifications. -TEST_F(ViewTreeAppTest, AddToRoot) { - Id view_1_21 = vm_client1()->CreateView(21); - Id view_1_3 = vm_client1()->CreateView(3); +TEST_F(WindowTreeAppTest, AddToRoot) { + Id view_1_21 = vm_client1()->NewWindow(21); + Id view_1_3 = vm_client1()->NewWindow(3); ASSERT_TRUE(view_1_21); ASSERT_TRUE(view_1_3); @@ -786,32 +789,32 @@ TEST_F(ViewTreeAppTest, AddToRoot) { changes2()->clear(); // Make 3 a child of 21. - ASSERT_TRUE(AddView(vm1(), view_1_21, view_1_3)); + ASSERT_TRUE(AddWindow(vm1(), view_1_21, view_1_3)); // Make 21 a child of 1. - ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_21)); + ASSERT_TRUE(AddWindow(vm1(), view_1_1, view_1_21)); // Connection 2 should not be told anything (because the view is from a // different connection). Create a view to ensure we got a response from // the server. - ASSERT_TRUE(vm_client2()->CreateView(100)); + ASSERT_TRUE(vm_client2()->NewWindow(100)); EXPECT_TRUE(changes2()->empty()); } // Verifies HierarchyChanged is correctly sent for various adds/removes. -TEST_F(ViewTreeAppTest, ViewHierarchyChangedViews) { +TEST_F(WindowTreeAppTest, ViewHierarchyChangedViews) { // 1,2->1,11. - Id view_1_2 = vm_client1()->CreateView(2); + Id view_1_2 = vm_client1()->NewWindow(2); ASSERT_TRUE(view_1_2); - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_2, true)); - Id view_1_11 = vm_client1()->CreateView(11); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_2, true)); + Id view_1_11 = vm_client1()->NewWindow(11); ASSERT_TRUE(view_1_11); - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_11, true)); - ASSERT_TRUE(AddView(vm1(), view_1_2, view_1_11)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_11, true)); + ASSERT_TRUE(AddWindow(vm1(), view_1_2, view_1_11)); Id view_1_1 = BuildViewId(connection_id_1(), 1); ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_1, true)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_1, true)); ASSERT_TRUE(WaitForAllMessages(vm2())); changes2()->clear(); @@ -819,7 +822,7 @@ TEST_F(ViewTreeAppTest, ViewHierarchyChangedViews) { // 1,1->1,2->1,11 { // Client 2 should not get anything (1,2 is from another connection). - ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_2)); + ASSERT_TRUE(AddWindow(vm1(), view_1_1, view_1_2)); ASSERT_TRUE(WaitForAllMessages(vm2())); EXPECT_TRUE(changes2()->empty()); } @@ -828,7 +831,7 @@ TEST_F(ViewTreeAppTest, ViewHierarchyChangedViews) { { // Client 2 is now connected to the root, so it should have gotten a drawn // notification. - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); vm_client2_->WaitForChangeCount(1u); EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_1) + " drawn=true", SingleChangeToDescription(*changes2())); @@ -839,19 +842,19 @@ TEST_F(ViewTreeAppTest, ViewHierarchyChangedViews) { // Client 2 is no longer connected to the root, should get drawn state // changed. changes2()->clear(); - ASSERT_TRUE(RemoveViewFromParent(vm1(), view_1_1)); + ASSERT_TRUE(RemoveWindowFromParent(vm1(), view_1_1)); vm_client2_->WaitForChangeCount(1); EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_1) + " drawn=false", SingleChangeToDescription(*changes2())); } // 1,1->1,2->1,11->1,111. - Id view_1_111 = vm_client1()->CreateView(111); + Id view_1_111 = vm_client1()->NewWindow(111); ASSERT_TRUE(view_1_111); - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_111, true)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_111, true)); { changes2()->clear(); - ASSERT_TRUE(AddView(vm1(), view_1_11, view_1_111)); + ASSERT_TRUE(AddWindow(vm1(), view_1_11, view_1_111)); ASSERT_TRUE(WaitForAllMessages(vm2())); EXPECT_TRUE(changes2()->empty()); } @@ -859,35 +862,35 @@ TEST_F(ViewTreeAppTest, ViewHierarchyChangedViews) { // 0,1->1,1->1,2->1,11->1,111 { changes2()->clear(); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); vm_client2_->WaitForChangeCount(1); EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_1) + " drawn=true", SingleChangeToDescription(*changes2())); } } -TEST_F(ViewTreeAppTest, ViewHierarchyChangedAddingKnownToUnknown) { +TEST_F(WindowTreeAppTest, ViewHierarchyChangedAddingKnownToUnknown) { // Create the following structure: root -> 1 -> 11 and 2->21 (2 has no // parent). ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - Id view_2_11 = vm_client2()->CreateView(11); - Id view_2_2 = vm_client2()->CreateView(2); - Id view_2_21 = vm_client2()->CreateView(21); + Id view_2_11 = vm_client2()->NewWindow(11); + Id view_2_2 = vm_client2()->NewWindow(2); + Id view_2_21 = vm_client2()->NewWindow(21); ASSERT_TRUE(view_2_11); ASSERT_TRUE(view_2_2); ASSERT_TRUE(view_2_21); // Set up the hierarchy. - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_11)); - ASSERT_TRUE(AddView(vm2(), view_2_2, view_2_21)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_11)); + ASSERT_TRUE(AddWindow(vm2(), view_2_2, view_2_21)); // Remove 11, should result in a hierarchy change for the root. { changes1()->clear(); - ASSERT_TRUE(RemoveViewFromParent(vm2(), view_2_11)); + ASSERT_TRUE(RemoveWindowFromParent(vm2(), view_2_11)); vm_client1_->WaitForChangeCount(1); EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_11) + @@ -898,7 +901,7 @@ TEST_F(ViewTreeAppTest, ViewHierarchyChangedAddingKnownToUnknown) { // Add 2 to 1. { changes1()->clear(); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); vm_client1_->WaitForChangeCount(1); EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + IdToString(view_1_1) + " old_parent=null", @@ -909,17 +912,17 @@ TEST_F(ViewTreeAppTest, ViewHierarchyChangedAddingKnownToUnknown) { } } -TEST_F(ViewTreeAppTest, ReorderView) { +TEST_F(WindowTreeAppTest, ReorderWindow) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); - Id view_2_1 = vm_client2()->CreateView(1); - Id view_2_2 = vm_client2()->CreateView(2); - Id view_2_3 = vm_client2()->CreateView(3); - Id view_1_4 = vm_client1()->CreateView(4); // Peer to 1,1 - Id view_1_5 = vm_client1()->CreateView(5); // Peer to 1,1 - Id view_2_6 = vm_client2()->CreateView(6); // Child of 1,2. - Id view_2_7 = vm_client2()->CreateView(7); // Unparented. - Id view_2_8 = vm_client2()->CreateView(8); // Unparented. + Id view_2_1 = vm_client2()->NewWindow(1); + Id view_2_2 = vm_client2()->NewWindow(2); + Id view_2_3 = vm_client2()->NewWindow(3); + Id view_1_4 = vm_client1()->NewWindow(4); // Peer to 1,1 + Id view_1_5 = vm_client1()->NewWindow(5); // Peer to 1,1 + Id view_2_6 = vm_client2()->NewWindow(6); // Child of 1,2. + Id view_2_7 = vm_client2()->NewWindow(7); // Unparented. + Id view_2_8 = vm_client2()->NewWindow(8); // Unparented. ASSERT_TRUE(view_2_1); ASSERT_TRUE(view_2_2); ASSERT_TRUE(view_2_3); @@ -929,16 +932,17 @@ TEST_F(ViewTreeAppTest, ReorderView) { ASSERT_TRUE(view_2_7); ASSERT_TRUE(view_2_8); - ASSERT_TRUE(AddView(vm2(), view_2_1, view_2_2)); - ASSERT_TRUE(AddView(vm2(), view_2_2, view_2_6)); - ASSERT_TRUE(AddView(vm2(), view_2_1, view_2_3)); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_4)); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_5)); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_2_1)); + ASSERT_TRUE(AddWindow(vm2(), view_2_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_2_2, view_2_6)); + ASSERT_TRUE(AddWindow(vm2(), view_2_1, view_2_3)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_4)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_5)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_2_1)); { changes1()->clear(); - ASSERT_TRUE(ReorderView(vm2(), view_2_2, view_2_3, ORDER_DIRECTION_ABOVE)); + ASSERT_TRUE( + ReorderWindow(vm2(), view_2_2, view_2_3, mojom::ORDER_DIRECTION_ABOVE)); vm_client1_->WaitForChangeCount(1); EXPECT_EQ("Reordered view=" + IdToString(view_2_2) + " relative=" + @@ -948,7 +952,8 @@ TEST_F(ViewTreeAppTest, ReorderView) { { changes1()->clear(); - ASSERT_TRUE(ReorderView(vm2(), view_2_2, view_2_3, ORDER_DIRECTION_BELOW)); + ASSERT_TRUE( + ReorderWindow(vm2(), view_2_2, view_2_3, mojom::ORDER_DIRECTION_BELOW)); vm_client1_->WaitForChangeCount(1); EXPECT_EQ("Reordered view=" + IdToString(view_2_2) + " relative=" + @@ -957,34 +962,38 @@ TEST_F(ViewTreeAppTest, ReorderView) { } // view2 is already below view3. - EXPECT_FALSE(ReorderView(vm2(), view_2_2, view_2_3, ORDER_DIRECTION_BELOW)); + EXPECT_FALSE( + ReorderWindow(vm2(), view_2_2, view_2_3, mojom::ORDER_DIRECTION_BELOW)); // view4 & 5 are unknown to connection2_. - EXPECT_FALSE(ReorderView(vm2(), view_1_4, view_1_5, ORDER_DIRECTION_ABOVE)); + EXPECT_FALSE( + ReorderWindow(vm2(), view_1_4, view_1_5, mojom::ORDER_DIRECTION_ABOVE)); // view6 & view3 have different parents. - EXPECT_FALSE(ReorderView(vm1(), view_2_3, view_2_6, ORDER_DIRECTION_ABOVE)); + EXPECT_FALSE( + ReorderWindow(vm1(), view_2_3, view_2_6, mojom::ORDER_DIRECTION_ABOVE)); // Non-existent view-ids - EXPECT_FALSE(ReorderView(vm1(), BuildViewId(connection_id_1(), 27), - BuildViewId(connection_id_1(), 28), - ORDER_DIRECTION_ABOVE)); + EXPECT_FALSE(ReorderWindow(vm1(), BuildViewId(connection_id_1(), 27), + BuildViewId(connection_id_1(), 28), + mojom::ORDER_DIRECTION_ABOVE)); // view7 & view8 are un-parented. - EXPECT_FALSE(ReorderView(vm1(), view_2_7, view_2_8, ORDER_DIRECTION_ABOVE)); + EXPECT_FALSE( + ReorderWindow(vm1(), view_2_7, view_2_8, mojom::ORDER_DIRECTION_ABOVE)); } -// Verifies DeleteView works. -TEST_F(ViewTreeAppTest, DeleteView) { +// Verifies DeleteWindow works. +TEST_F(WindowTreeAppTest, DeleteWindow) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - Id view_2_2 = vm_client2()->CreateView(2); + Id view_2_2 = vm_client2()->NewWindow(2); ASSERT_TRUE(view_2_2); // Make 2 a child of 1. { changes1()->clear(); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); vm_client1_->WaitForChangeCount(1); EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + IdToString(view_1_1) + " old_parent=null", @@ -995,7 +1004,7 @@ TEST_F(ViewTreeAppTest, DeleteView) { { changes1()->clear(); changes2()->clear(); - ASSERT_TRUE(DeleteView(vm2(), view_2_2)); + ASSERT_TRUE(DeleteWindow(vm2(), view_2_2)); EXPECT_TRUE(changes2()->empty()); vm_client1_->WaitForChangeCount(1); @@ -1004,24 +1013,24 @@ TEST_F(ViewTreeAppTest, DeleteView) { } } -// Verifies DeleteView isn't allowed from a separate connection. -TEST_F(ViewTreeAppTest, DeleteViewFromAnotherConnectionDisallowed) { +// Verifies DeleteWindow isn't allowed from a separate connection. +TEST_F(WindowTreeAppTest, DeleteWindowFromAnotherConnectionDisallowed) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); - EXPECT_FALSE(DeleteView(vm2(), BuildViewId(connection_id_1(), 1))); + EXPECT_FALSE(DeleteWindow(vm2(), BuildViewId(connection_id_1(), 1))); } // Verifies if a view was deleted and then reused that other clients are // properly notified. -TEST_F(ViewTreeAppTest, ReuseDeletedViewId) { +TEST_F(WindowTreeAppTest, ReuseDeletedViewId) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - Id view_2_2 = vm_client2()->CreateView(2); + Id view_2_2 = vm_client2()->NewWindow(2); ASSERT_TRUE(view_2_2); // Add 2 to 1. { changes1()->clear(); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); vm_client1_->WaitForChangeCount(1); EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + IdToString(view_1_1) + " old_parent=null", @@ -1033,7 +1042,7 @@ TEST_F(ViewTreeAppTest, ReuseDeletedViewId) { // Delete 2. { changes1()->clear(); - ASSERT_TRUE(DeleteView(vm2(), view_2_2)); + ASSERT_TRUE(DeleteWindow(vm2(), view_2_2)); vm_client1_->WaitForChangeCount(1); EXPECT_EQ("ViewDeleted view=" + IdToString(view_2_2), @@ -1041,11 +1050,11 @@ TEST_F(ViewTreeAppTest, ReuseDeletedViewId) { } // Create 2 again, and add it back to 1. Should get the same notification. - view_2_2 = vm_client2()->CreateView(2); + view_2_2 = vm_client2()->NewWindow(2); ASSERT_TRUE(view_2_2); { changes1()->clear(); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); vm_client1_->WaitForChangeCount(1); EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + @@ -1056,44 +1065,44 @@ TEST_F(ViewTreeAppTest, ReuseDeletedViewId) { } } -// Assertions for GetViewTree. -TEST_F(ViewTreeAppTest, GetViewTree) { +// Assertions for GetWindowTree. +TEST_F(WindowTreeAppTest, GetWindowTree) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); // Create 11 in first connection and make it a child of 1. - Id view_1_11 = vm_client1()->CreateView(11); + Id view_1_11 = vm_client1()->NewWindow(11); ASSERT_TRUE(view_1_11); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); - ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_11)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), view_1_1, view_1_11)); // Create two views in second connection, 2 and 3, both children of 1. - Id view_2_2 = vm_client2()->CreateView(2); - Id view_2_3 = vm_client2()->CreateView(3); + Id view_2_2 = vm_client2()->NewWindow(2); + Id view_2_3 = vm_client2()->NewWindow(3); ASSERT_TRUE(view_2_2); ASSERT_TRUE(view_2_3); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_3)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_3)); - // Verifies GetViewTree() on the root. The root connection sees all. + // Verifies GetWindowTree() on the root. The root connection sees all. { std::vector<TestView> views; - GetViewTree(vm1(), root_view_id(), &views); + GetWindowTree(vm1(), root_window_id(), &views); ASSERT_EQ(5u, views.size()); - EXPECT_EQ(ViewParentToString(root_view_id(), kNullParentId), + EXPECT_EQ(ViewParentToString(root_window_id(), kNullParentId), views[0].ToString()); - EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()), + EXPECT_EQ(ViewParentToString(view_1_1, root_window_id()), views[1].ToString()); EXPECT_EQ(ViewParentToString(view_1_11, view_1_1), views[2].ToString()); EXPECT_EQ(ViewParentToString(view_2_2, view_1_1), views[3].ToString()); EXPECT_EQ(ViewParentToString(view_2_3, view_1_1), views[4].ToString()); } - // Verifies GetViewTree() on the view 1,1 from vm2(). vm2() sees 1,1 as 1,1 + // Verifies GetWindowTree() on the view 1,1 from vm2(). vm2() sees 1,1 as 1,1 // is vm2()'s root and vm2() sees all the views it created. { std::vector<TestView> views; - GetViewTree(vm2(), view_1_1, &views); + GetWindowTree(vm2(), view_1_1, &views); ASSERT_EQ(3u, views.size()); EXPECT_EQ(ViewParentToString(view_1_1, kNullParentId), views[0].ToString()); EXPECT_EQ(ViewParentToString(view_2_2, view_1_1), views[1].ToString()); @@ -1103,20 +1112,20 @@ TEST_F(ViewTreeAppTest, GetViewTree) { // Connection 2 shouldn't be able to get the root tree. { std::vector<TestView> views; - GetViewTree(vm2(), root_view_id(), &views); + GetWindowTree(vm2(), root_window_id(), &views); ASSERT_EQ(0u, views.size()); } } -TEST_F(ViewTreeAppTest, SetViewBounds) { - Id view_1_1 = vm_client1()->CreateView(1); +TEST_F(WindowTreeAppTest, SetWindowBounds) { + Id view_1_1 = vm_client1()->NewWindow(1); ASSERT_TRUE(view_1_1); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); changes2()->clear(); - ASSERT_TRUE(SetViewBounds(vm1(), view_1_1, 0, 0, 100, 100)); + ASSERT_TRUE(SetWindowBounds(vm1(), view_1_1, 0, 0, 100, 100)); vm_client2_->WaitForChangeCount(1); EXPECT_EQ("BoundsChanged view=" + IdToString(view_1_1) + @@ -1125,14 +1134,14 @@ TEST_F(ViewTreeAppTest, SetViewBounds) { // Should not be possible to change the bounds of a view created by another // connection. - ASSERT_FALSE(SetViewBounds(vm2(), view_1_1, 0, 0, 0, 0)); + ASSERT_FALSE(SetWindowBounds(vm2(), view_1_1, 0, 0, 0, 0)); } -// Verify AddView fails when trying to manipulate views in other roots. -TEST_F(ViewTreeAppTest, CantMoveViewsFromOtherRoot) { +// Verify AddWindow fails when trying to manipulate views in other roots. +TEST_F(WindowTreeAppTest, CantMoveViewsFromOtherRoot) { // Create 1 and 2 in the first connection. - Id view_1_1 = vm_client1()->CreateView(1); - Id view_1_2 = vm_client1()->CreateView(2); + Id view_1_1 = vm_client1()->NewWindow(1); + Id view_1_2 = vm_client1()->NewWindow(2); ASSERT_TRUE(view_1_1); ASSERT_TRUE(view_1_2); @@ -1140,87 +1149,87 @@ TEST_F(ViewTreeAppTest, CantMoveViewsFromOtherRoot) { // Try to move 2 to be a child of 1 from connection 2. This should fail as 2 // should not be able to access 1. - ASSERT_FALSE(AddView(vm2(), view_1_1, view_1_2)); + ASSERT_FALSE(AddWindow(vm2(), view_1_1, view_1_2)); // Try to reparent 1 to the root. A connection is not allowed to reparent its // roots. - ASSERT_FALSE(AddView(vm2(), root_view_id(), view_1_1)); + ASSERT_FALSE(AddWindow(vm2(), root_window_id(), view_1_1)); } -// Verify RemoveViewFromParent fails for views that are descendants of the +// Verify RemoveWindowFromParent fails for views that are descendants of the // roots. -TEST_F(ViewTreeAppTest, CantRemoveViewsInOtherRoots) { +TEST_F(WindowTreeAppTest, CantRemoveWindowsInOtherRoots) { // Create 1 and 2 in the first connection and parent both to the root. - Id view_1_1 = vm_client1()->CreateView(1); - Id view_1_2 = vm_client1()->CreateView(2); + Id view_1_1 = vm_client1()->NewWindow(1); + Id view_1_2 = vm_client1()->NewWindow(2); ASSERT_TRUE(view_1_1); ASSERT_TRUE(view_1_2); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_2)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_2)); // Establish the second connection and give it the root 1. ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); // Connection 2 should not be able to remove view 2 or 1 from its parent. - ASSERT_FALSE(RemoveViewFromParent(vm2(), view_1_2)); - ASSERT_FALSE(RemoveViewFromParent(vm2(), view_1_1)); + ASSERT_FALSE(RemoveWindowFromParent(vm2(), view_1_2)); + ASSERT_FALSE(RemoveWindowFromParent(vm2(), view_1_1)); // Create views 10 and 11 in 2. - Id view_2_10 = vm_client2()->CreateView(10); - Id view_2_11 = vm_client2()->CreateView(11); + Id view_2_10 = vm_client2()->NewWindow(10); + Id view_2_11 = vm_client2()->NewWindow(11); ASSERT_TRUE(view_2_10); ASSERT_TRUE(view_2_11); // Parent 11 to 10. - ASSERT_TRUE(AddView(vm2(), view_2_10, view_2_11)); + ASSERT_TRUE(AddWindow(vm2(), view_2_10, view_2_11)); // Remove 11 from 10. - ASSERT_TRUE(RemoveViewFromParent(vm2(), view_2_11)); + ASSERT_TRUE(RemoveWindowFromParent(vm2(), view_2_11)); // Verify nothing was actually removed. { std::vector<TestView> views; - GetViewTree(vm1(), root_view_id(), &views); + GetWindowTree(vm1(), root_window_id(), &views); ASSERT_EQ(3u, views.size()); - EXPECT_EQ(ViewParentToString(root_view_id(), kNullParentId), + EXPECT_EQ(ViewParentToString(root_window_id(), kNullParentId), views[0].ToString()); - EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()), + EXPECT_EQ(ViewParentToString(view_1_1, root_window_id()), views[1].ToString()); - EXPECT_EQ(ViewParentToString(view_1_2, root_view_id()), + EXPECT_EQ(ViewParentToString(view_1_2, root_window_id()), views[2].ToString()); } } -// Verify GetViewTree fails for views that are not descendants of the roots. -TEST_F(ViewTreeAppTest, CantGetViewTreeOfOtherRoots) { +// Verify GetWindowTree fails for views that are not descendants of the roots. +TEST_F(WindowTreeAppTest, CantGetWindowTreeOfOtherRoots) { // Create 1 and 2 in the first connection and parent both to the root. - Id view_1_1 = vm_client1()->CreateView(1); - Id view_1_2 = vm_client1()->CreateView(2); + Id view_1_1 = vm_client1()->NewWindow(1); + Id view_1_2 = vm_client1()->NewWindow(2); ASSERT_TRUE(view_1_1); ASSERT_TRUE(view_1_2); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_2)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_2)); ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); std::vector<TestView> views; // Should get nothing for the root. - GetViewTree(vm2(), root_view_id(), &views); + GetWindowTree(vm2(), root_window_id(), &views); ASSERT_TRUE(views.empty()); // Should get nothing for view 2. - GetViewTree(vm2(), view_1_2, &views); + GetWindowTree(vm2(), view_1_2, &views); ASSERT_TRUE(views.empty()); // Should get view 1 if asked for. - GetViewTree(vm2(), view_1_1, &views); + GetWindowTree(vm2(), view_1_1, &views); ASSERT_EQ(1u, views.size()); EXPECT_EQ(ViewParentToString(view_1_1, kNullParentId), views[0].ToString()); } -TEST_F(ViewTreeAppTest, EmbedWithSameViewId) { +TEST_F(WindowTreeAppTest, EmbedWithSameViewId) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); changes2()->clear(); @@ -1238,12 +1247,12 @@ TEST_F(ViewTreeAppTest, EmbedWithSameViewId) { // Connection2 has no root. Verify it can't see view 1,1 anymore. { std::vector<TestView> views; - GetViewTree(vm2(), view_1_1, &views); + GetWindowTree(vm2(), view_1_1, &views); EXPECT_TRUE(views.empty()); } } -TEST_F(ViewTreeAppTest, EmbedWithSameViewId2) { +TEST_F(WindowTreeAppTest, EmbedWithSameViewId2) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); changes2()->clear(); @@ -1255,9 +1264,9 @@ TEST_F(ViewTreeAppTest, EmbedWithSameViewId2) { changes2()->clear(); // Create a view in the third connection and parent it to the root. - Id view_3_1 = vm_client3()->CreateView(1); + Id view_3_1 = vm_client3()->NewWindow(1); ASSERT_TRUE(view_3_1); - ASSERT_TRUE(AddView(vm3(), view_1_1, view_3_1)); + ASSERT_TRUE(AddWindow(vm3(), view_1_1, view_3_1)); // Connection 1 should have been told about the add (it owns the view). { @@ -1272,7 +1281,7 @@ TEST_F(ViewTreeAppTest, EmbedWithSameViewId2) { changes3()->clear(); // We should get a new connection for the new embedding. - scoped_ptr<TestViewTreeClientImpl> connection4( + scoped_ptr<TestWindowTreeClientImpl> connection4( EstablishConnectionViaEmbed(vm1(), view_1_1, nullptr)); ASSERT_TRUE(connection4.get()); EXPECT_EQ("[" + ViewParentToString(view_1_1, kNullParentId) + "]", @@ -1288,7 +1297,7 @@ TEST_F(ViewTreeAppTest, EmbedWithSameViewId2) { // vm3() has no root. Verify it can't see view 1,1 anymore. { std::vector<TestView> views; - GetViewTree(vm3(), view_1_1, &views); + GetWindowTree(vm3(), view_1_1, &views); EXPECT_TRUE(views.empty()); } @@ -1296,7 +1305,7 @@ TEST_F(ViewTreeAppTest, EmbedWithSameViewId2) { // vm3() can no longer see 1,1. { std::vector<TestView> views; - GetViewTree(vm1(), view_1_1, &views); + GetWindowTree(vm1(), view_1_1, &views); ASSERT_EQ(1u, views.size()); EXPECT_EQ(ViewParentToString(view_1_1, kNullParentId), views[0].ToString()); } @@ -1304,66 +1313,66 @@ TEST_F(ViewTreeAppTest, EmbedWithSameViewId2) { // Verify vm3() can still see the view it created 3,1. { std::vector<TestView> views; - GetViewTree(vm3(), view_3_1, &views); + GetWindowTree(vm3(), view_3_1, &views); ASSERT_EQ(1u, views.size()); EXPECT_EQ(ViewParentToString(view_3_1, kNullParentId), views[0].ToString()); } } -// Assertions for SetViewVisibility. -TEST_F(ViewTreeAppTest, SetViewVisibility) { +// Assertions for SetWindowVisibility. +TEST_F(WindowTreeAppTest, SetWindowVisibility) { // Create 1 and 2 in the first connection and parent both to the root. - Id view_1_1 = vm_client1()->CreateView(1); - Id view_1_2 = vm_client1()->CreateView(2); + Id view_1_1 = vm_client1()->NewWindow(1); + Id view_1_2 = vm_client1()->NewWindow(2); ASSERT_TRUE(view_1_1); ASSERT_TRUE(view_1_2); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); { std::vector<TestView> views; - GetViewTree(vm1(), root_view_id(), &views); + GetWindowTree(vm1(), root_window_id(), &views); ASSERT_EQ(2u, views.size()); - EXPECT_EQ(ViewParentToString(root_view_id(), kNullParentId) + + EXPECT_EQ(ViewParentToString(root_window_id(), kNullParentId) + " visible=true drawn=true", views[0].ToString2()); - EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()) + + EXPECT_EQ(ViewParentToString(view_1_1, root_window_id()) + " visible=false drawn=false", views[1].ToString2()); } // Show all the views. - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_1, true)); - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_2, true)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_1, true)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_2, true)); { std::vector<TestView> views; - GetViewTree(vm1(), root_view_id(), &views); + GetWindowTree(vm1(), root_window_id(), &views); ASSERT_EQ(2u, views.size()); - EXPECT_EQ(ViewParentToString(root_view_id(), kNullParentId) + + EXPECT_EQ(ViewParentToString(root_window_id(), kNullParentId) + " visible=true drawn=true", views[0].ToString2()); - EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()) + + EXPECT_EQ(ViewParentToString(view_1_1, root_window_id()) + " visible=true drawn=true", views[1].ToString2()); } // Hide 1. - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_1, false)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_1, false)); { std::vector<TestView> views; - GetViewTree(vm1(), view_1_1, &views); + GetWindowTree(vm1(), view_1_1, &views); ASSERT_EQ(1u, views.size()); - EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()) + + EXPECT_EQ(ViewParentToString(view_1_1, root_window_id()) + " visible=false drawn=false", views[0].ToString2()); } // Attach 2 to 1. - ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_2)); + ASSERT_TRUE(AddWindow(vm1(), view_1_1, view_1_2)); { std::vector<TestView> views; - GetViewTree(vm1(), view_1_1, &views); + GetWindowTree(vm1(), view_1_1, &views); ASSERT_EQ(2u, views.size()); - EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()) + + EXPECT_EQ(ViewParentToString(view_1_1, root_window_id()) + " visible=false drawn=false", views[0].ToString2()); EXPECT_EQ( @@ -1372,12 +1381,12 @@ TEST_F(ViewTreeAppTest, SetViewVisibility) { } // Show 1. - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_1, true)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_1, true)); { std::vector<TestView> views; - GetViewTree(vm1(), view_1_1, &views); + GetWindowTree(vm1(), view_1_1, &views); ASSERT_EQ(2u, views.size()); - EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()) + + EXPECT_EQ(ViewParentToString(view_1_1, root_window_id()) + " visible=true drawn=true", views[0].ToString2()); EXPECT_EQ( @@ -1386,31 +1395,31 @@ TEST_F(ViewTreeAppTest, SetViewVisibility) { } } -// Assertions for SetViewVisibility sending notifications. -TEST_F(ViewTreeAppTest, SetViewVisibilityNotifications) { +// Assertions for SetWindowVisibility sending notifications. +TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) { // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root. - Id view_1_1 = vm_client1()->CreateView(1); + Id view_1_1 = vm_client1()->NewWindow(1); ASSERT_TRUE(view_1_1); - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_1, true)); - Id view_1_2 = vm_client1()->CreateView(2); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_1, true)); + Id view_1_2 = vm_client1()->NewWindow(2); ASSERT_TRUE(view_1_2); - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_2, true)); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); - ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_2)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_2, true)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), view_1_1, view_1_2)); // Establish the second connection at 1,2. ASSERT_NO_FATAL_FAILURE(EstablishSecondConnectionWithRoot(view_1_2)); // Add 2,3 as a child of 1,2. - Id view_2_3 = vm_client2()->CreateView(3); + Id view_2_3 = vm_client2()->NewWindow(3); ASSERT_TRUE(view_2_3); - ASSERT_TRUE(SetViewVisibility(vm2(), view_2_3, true)); - ASSERT_TRUE(AddView(vm2(), view_1_2, view_2_3)); + ASSERT_TRUE(SetWindowVisibility(vm2(), view_2_3, true)); + ASSERT_TRUE(AddWindow(vm2(), view_1_2, view_2_3)); WaitForAllMessages(vm1()); changes2()->clear(); // Hide 1,2 from connection 1. Connection 2 should see this. - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_2, false)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_2, false)); { vm_client2_->WaitForChangeCount(1); EXPECT_EQ( @@ -1420,7 +1429,7 @@ TEST_F(ViewTreeAppTest, SetViewVisibilityNotifications) { changes1()->clear(); // Show 1,2 from connection 2, connection 1 should be notified. - ASSERT_TRUE(SetViewVisibility(vm2(), view_1_2, true)); + ASSERT_TRUE(SetWindowVisibility(vm2(), view_1_2, true)); { vm_client1_->WaitForChangeCount(1); EXPECT_EQ( @@ -1430,7 +1439,7 @@ TEST_F(ViewTreeAppTest, SetViewVisibilityNotifications) { changes2()->clear(); // Hide 1,1, connection 2 should be told the draw state changed. - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_1, false)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_1, false)); { vm_client2_->WaitForChangeCount(1); EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_2) + " drawn=false", @@ -1439,7 +1448,7 @@ TEST_F(ViewTreeAppTest, SetViewVisibilityNotifications) { changes2()->clear(); // Show 1,1 from connection 1. Connection 2 should see this. - ASSERT_TRUE(SetViewVisibility(vm1(), view_1_1, true)); + ASSERT_TRUE(SetWindowVisibility(vm1(), view_1_1, true)); { vm_client2_->WaitForChangeCount(1); EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_2) + " drawn=true", @@ -1448,7 +1457,7 @@ TEST_F(ViewTreeAppTest, SetViewVisibilityNotifications) { // Change visibility of 2,3, connection 1 should see this. changes1()->clear(); - ASSERT_TRUE(SetViewVisibility(vm2(), view_2_3, false)); + ASSERT_TRUE(SetWindowVisibility(vm2(), view_2_3, false)); { vm_client1_->WaitForChangeCount(1); EXPECT_EQ( @@ -1458,7 +1467,7 @@ TEST_F(ViewTreeAppTest, SetViewVisibilityNotifications) { changes2()->clear(); // Remove 1,1 from the root, connection 2 should see drawn state changed. - ASSERT_TRUE(RemoveViewFromParent(vm1(), view_1_1)); + ASSERT_TRUE(RemoveWindowFromParent(vm1(), view_1_1)); { vm_client2_->WaitForChangeCount(1); EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_2) + " drawn=false", @@ -1467,7 +1476,7 @@ TEST_F(ViewTreeAppTest, SetViewVisibilityNotifications) { changes2()->clear(); // Add 1,1 back to the root, connection 2 should see drawn state changed. - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); { vm_client2_->WaitForChangeCount(1); EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_2) + " drawn=true", @@ -1475,27 +1484,27 @@ TEST_F(ViewTreeAppTest, SetViewVisibilityNotifications) { } } -TEST_F(ViewTreeAppTest, SetViewProperty) { - Id view_1_1 = vm_client1()->CreateView(1); +TEST_F(WindowTreeAppTest, SetWindowProperty) { + Id view_1_1 = vm_client1()->NewWindow(1); ASSERT_TRUE(view_1_1); ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); changes2()->clear(); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); { std::vector<TestView> views; - GetViewTree(vm1(), root_view_id(), &views); + GetWindowTree(vm1(), root_window_id(), &views); ASSERT_EQ(2u, views.size()); - EXPECT_EQ(root_view_id(), views[0].view_id); - EXPECT_EQ(view_1_1, views[1].view_id); + EXPECT_EQ(root_window_id(), views[0].window_id); + EXPECT_EQ(view_1_1, views[1].window_id); ASSERT_EQ(0u, views[1].properties.size()); } // Set properties on 1. changes2()->clear(); std::vector<uint8_t> one(1, '1'); - ASSERT_TRUE(SetViewProperty(vm1(), view_1_1, "one", &one)); + ASSERT_TRUE(SetWindowProperty(vm1(), view_1_1, "one", &one)); { vm_client2_->WaitForChangeCount(1); EXPECT_EQ( @@ -1506,7 +1515,7 @@ TEST_F(ViewTreeAppTest, SetViewProperty) { // Test that our properties exist in the view tree { std::vector<TestView> views; - GetViewTree(vm1(), view_1_1, &views); + GetWindowTree(vm1(), view_1_1, &views); ASSERT_EQ(1u, views.size()); ASSERT_EQ(1u, views[0].properties.size()); EXPECT_EQ(one, views[0].properties["one"]); @@ -1514,7 +1523,7 @@ TEST_F(ViewTreeAppTest, SetViewProperty) { changes2()->clear(); // Set back to null. - ASSERT_TRUE(SetViewProperty(vm1(), view_1_1, "one", NULL)); + ASSERT_TRUE(SetWindowProperty(vm1(), view_1_1, "one", NULL)); { vm_client2_->WaitForChangeCount(1); EXPECT_EQ( @@ -1523,13 +1532,13 @@ TEST_F(ViewTreeAppTest, SetViewProperty) { } } -TEST_F(ViewTreeAppTest, OnEmbeddedAppDisconnected) { +TEST_F(WindowTreeAppTest, OnEmbeddedAppDisconnected) { // Create connection 2 and 3. ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - Id view_2_2 = vm_client2()->CreateView(2); + Id view_2_2 = vm_client2()->NewWindow(2); ASSERT_TRUE(view_2_2); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); changes2()->clear(); ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); @@ -1551,17 +1560,17 @@ TEST_F(ViewTreeAppTest, OnEmbeddedAppDisconnected) { // Verifies when the parent of an Embed() is destroyed the embedded app gets // a ViewDeleted (and doesn't trigger a DCHECK). -TEST_F(ViewTreeAppTest, OnParentOfEmbedDisconnects) { +TEST_F(WindowTreeAppTest, OnParentOfEmbedDisconnects) { // Create connection 2 and 3. ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); - Id view_2_2 = vm_client2()->CreateView(2); - Id view_2_3 = vm_client2()->CreateView(3); + ASSERT_TRUE(AddWindow(vm1(), root_window_id(), view_1_1)); + Id view_2_2 = vm_client2()->NewWindow(2); + Id view_2_3 = vm_client2()->NewWindow(3); ASSERT_TRUE(view_2_2); ASSERT_TRUE(view_2_3); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); - ASSERT_TRUE(AddView(vm2(), view_2_2, view_2_3)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_2_2, view_2_3)); changes2()->clear(); ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_3)); changes3()->clear(); @@ -1573,29 +1582,29 @@ TEST_F(ViewTreeAppTest, OnParentOfEmbedDisconnects) { SingleChangeToDescription(*changes3())); } -// Verifies ViewTreeImpl doesn't incorrectly erase from its internal -// map when a view from another connection with the same view_id is removed. -TEST_F(ViewTreeAppTest, DontCleanMapOnDestroy) { +// Verifies WindowTreeImpl doesn't incorrectly erase from its internal +// map when a view from another connection with the same window_id is removed. +TEST_F(WindowTreeAppTest, DontCleanMapOnDestroy) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - ASSERT_TRUE(vm_client2()->CreateView(1)); + ASSERT_TRUE(vm_client2()->NewWindow(1)); changes1()->clear(); vm_client2_.reset(); vm_client1_->WaitForChangeCount(1); EXPECT_EQ("OnEmbeddedAppDisconnected view=" + IdToString(view_1_1), SingleChangeToDescription(*changes1())); std::vector<TestView> views; - GetViewTree(vm1(), view_1_1, &views); + GetWindowTree(vm1(), view_1_1, &views); EXPECT_FALSE(views.empty()); } -// Verifies Embed() works when supplying a ViewTreeClient. -TEST_F(ViewTreeAppTest, EmbedSupplyingViewTreeClient) { - ASSERT_TRUE(vm_client1()->CreateView(1)); +// Verifies Embed() works when supplying a WindowTreeClient. +TEST_F(WindowTreeAppTest, EmbedSupplyingWindowTreeClient) { + ASSERT_TRUE(vm_client1()->NewWindow(1)); - TestViewTreeClientImpl client2(application_impl()); - mojo::ViewTreeClientPtr client2_ptr; - mojo::Binding<ViewTreeClient> client2_binding(&client2, &client2_ptr); + TestWindowTreeClientImpl client2(application_impl()); + mojom::WindowTreeClientPtr client2_ptr; + mojo::Binding<WindowTreeClient> client2_binding(&client2, &client2_ptr); ASSERT_TRUE( Embed(vm1(), BuildViewId(connection_id_1(), 1), client2_ptr.Pass())); client2.WaitForOnEmbed(); @@ -1603,18 +1612,18 @@ TEST_F(ViewTreeAppTest, EmbedSupplyingViewTreeClient) { SingleChangeToDescription(*client2.tracker()->changes())); } -TEST_F(ViewTreeAppTest, EmbedFailsFromOtherConnection) { +TEST_F(WindowTreeAppTest, EmbedFailsFromOtherConnection) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - Id view_2_2 = vm_client2()->CreateView(2); + Id view_2_2 = vm_client2()->NewWindow(2); ASSERT_TRUE(view_2_2); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); - Id view_3_3 = vm_client3()->CreateView(3); + Id view_3_3 = vm_client3()->NewWindow(3); ASSERT_TRUE(view_3_3); - ASSERT_TRUE(AddView(vm3(), view_2_2, view_3_3)); + ASSERT_TRUE(AddWindow(vm3(), view_2_2, view_3_3)); // 2 should not be able to embed in view_3_3 as view_3_3 was not created by // 2. @@ -1623,13 +1632,13 @@ TEST_F(ViewTreeAppTest, EmbedFailsFromOtherConnection) { } // Verifies Embed() from window manager on another connections view works. -TEST_F(ViewTreeAppTest, EmbedFromOtherConnection) { +TEST_F(WindowTreeAppTest, EmbedFromOtherConnection) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id view_1_1 = BuildViewId(connection_id_1(), 1); - Id view_2_2 = vm_client2()->CreateView(2); + Id view_2_2 = vm_client2()->NewWindow(2); ASSERT_TRUE(view_2_2); - ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); + ASSERT_TRUE(AddWindow(vm2(), view_1_1, view_2_2)); changes2()->clear(); @@ -1640,31 +1649,32 @@ TEST_F(ViewTreeAppTest, EmbedFromOtherConnection) { EXPECT_EQ(std::string(), SingleChangeToDescription(*changes2())); } -TEST_F(ViewTreeAppTest, CantEmbedFromConnectionRoot) { +TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) { // Shouldn't be able to embed into the root. ASSERT_FALSE(EmbedUrl(application_impl(), vm1(), application_impl()->url(), - root_view_id())); + root_window_id())); - // Even though the call above failed a ViewTreeClient was obtained. We need to + // Even though the call above failed a WindowTreeClient was obtained. We need + // to // wait for it else we throw off the next connect. - WaitForViewTreeClient(); + WaitForWindowTreeClient(); // Don't allow a connection to embed into its own root. ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); EXPECT_FALSE(EmbedUrl(application_impl(), vm2(), application_impl()->url(), BuildViewId(connection_id_1(), 1))); - // Need to wait for a ViewTreeClient for same reason as above. - WaitForViewTreeClient(); + // Need to wait for a WindowTreeClient for same reason as above. + WaitForWindowTreeClient(); - Id view_1_2 = vm_client1()->CreateView(2); + Id view_1_2 = vm_client1()->NewWindow(2); ASSERT_TRUE(view_1_2); - ASSERT_TRUE(AddView(vm1(), BuildViewId(connection_id_1(), 1), view_1_2)); + ASSERT_TRUE(AddWindow(vm1(), BuildViewId(connection_id_1(), 1), view_1_2)); ASSERT_TRUE(vm_client3_.get() == nullptr); vm_client3_ = EstablishConnectionViaEmbedWithPolicyBitmask( - vm1(), view_1_2, mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT, nullptr); + vm1(), view_1_2, mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, nullptr); ASSERT_TRUE(vm_client3_.get() != nullptr); - vm_client3_->set_root_view(root_view_id()); + vm_client3_->set_root_view(root_window_id()); // view_1_2 is vm3's root, so even though v3 is an embed root it should not // be able to Embed into itself. @@ -1673,7 +1683,7 @@ TEST_F(ViewTreeAppTest, CantEmbedFromConnectionRoot) { } // TODO(sky): need to better track changes to initial connection. For example, -// that SetBounsdViews/AddView and the like don't result in messages to the +// that SetBounsdViews/AddWindow and the like don't result in messages to the // originating connection. // TODO(sky): make sure coverage of what was diff --git a/components/mus/ws/view_tree_host_connection.cc b/components/mus/ws/view_tree_host_connection.cc index 23ee9f2..a387f6c 100644 --- a/components/mus/ws/view_tree_host_connection.cc +++ b/components/mus/ws/view_tree_host_connection.cc @@ -36,7 +36,7 @@ void ViewTreeHostConnection::CloseConnection() { delete this; } -ViewTreeImpl* ViewTreeHostConnection::GetViewTree() { +ViewTreeImpl* ViewTreeHostConnection::GetWindowTree() { return tree_; } @@ -47,9 +47,9 @@ void ViewTreeHostConnection::OnDisplayClosed() { } ViewTreeHostConnectionImpl::ViewTreeHostConnectionImpl( - mojo::InterfaceRequest<mojo::ViewTreeHost> request, + mojo::InterfaceRequest<mojom::WindowTreeHost> request, scoped_ptr<ViewTreeHostImpl> host_impl, - mojo::ViewTreeClientPtr client, + mojom::WindowTreeClientPtr client, ConnectionManager* manager) : ViewTreeHostConnection(host_impl.Pass(), manager), binding_(view_tree_host(), request.Pass()), @@ -61,7 +61,7 @@ void ViewTreeHostConnectionImpl::OnDisplayInitialized() { connection_manager()->AddHost(this); set_view_tree(connection_manager()->EmbedAtView( kInvalidConnectionId, view_tree_host()->root_view()->id(), - mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT, client_.Pass())); + mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, client_.Pass())); } } // namespace mus diff --git a/components/mus/ws/view_tree_host_connection.h b/components/mus/ws/view_tree_host_connection.h index 62f4d93..6bcf444 100644 --- a/components/mus/ws/view_tree_host_connection.h +++ b/components/mus/ws/view_tree_host_connection.h @@ -6,7 +6,7 @@ #define COMPONENTS_MUS_WS_VIEW_TREE_HOST_CONNECTION_H_ #include "base/memory/scoped_ptr.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/mus/ws/view_tree_host_delegate.h" #include "components/mus/ws/view_tree_host_impl.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" @@ -46,7 +46,7 @@ class ViewTreeHostConnection : public ViewTreeHostDelegate { // ViewTreeHostDelegate: void OnDisplayInitialized() override; void OnDisplayClosed() override; - ViewTreeImpl* GetViewTree() override; + ViewTreeImpl* GetWindowTree() override; private: scoped_ptr<ViewTreeHostImpl> host_; @@ -60,10 +60,11 @@ class ViewTreeHostConnection : public ViewTreeHostDelegate { // Live implementation of ViewTreeHostConnection. class ViewTreeHostConnectionImpl : public ViewTreeHostConnection { public: - ViewTreeHostConnectionImpl(mojo::InterfaceRequest<mojo::ViewTreeHost> request, - scoped_ptr<ViewTreeHostImpl> host_impl, - mojo::ViewTreeClientPtr client, - ConnectionManager* connection_manager); + ViewTreeHostConnectionImpl( + mojo::InterfaceRequest<mojom::WindowTreeHost> request, + scoped_ptr<ViewTreeHostImpl> host_impl, + mojom::WindowTreeClientPtr client, + ConnectionManager* connection_manager); private: ~ViewTreeHostConnectionImpl() override; @@ -71,8 +72,8 @@ class ViewTreeHostConnectionImpl : public ViewTreeHostConnection { // ViewTreeHostDelegate: void OnDisplayInitialized() override; - mojo::Binding<mojo::ViewTreeHost> binding_; - mojo::ViewTreeClientPtr client_; + mojo::Binding<mojom::WindowTreeHost> binding_; + mojom::WindowTreeClientPtr client_; DISALLOW_COPY_AND_ASSIGN(ViewTreeHostConnectionImpl); }; diff --git a/components/mus/ws/view_tree_host_delegate.h b/components/mus/ws/view_tree_host_delegate.h index 2551b87..8c153b6 100644 --- a/components/mus/ws/view_tree_host_delegate.h +++ b/components/mus/ws/view_tree_host_delegate.h @@ -10,7 +10,8 @@ namespace mus { class ViewTreeImpl; // A ViewTreeHostDelegate interface is implemented by an object that -// has the ViewTreeImpl that is associated with the ViewTreeHostImpl that holds +// has the WindowTreeImpl that is associated with the ViewTreeHostImpl that +// holds // a pointer to this object. Typically, a ViewTreeHostDelegate will also manage // the lifetime of the ViewTreeHostImpl and will delete the object when it gets // informed of when the Display of the root is closed. @@ -23,8 +24,8 @@ class ViewTreeHostDelegate { // Called when the window associated with the root is closed. virtual void OnDisplayClosed() = 0; - // Returns the ViewTreeImpl associated with the delegate. - virtual ViewTreeImpl* GetViewTree() = 0; + // Returns the WindowTreeImpl associated with the delegate. + virtual ViewTreeImpl* GetWindowTree() = 0; protected: virtual ~ViewTreeHostDelegate() {} diff --git a/components/mus/ws/view_tree_host_impl.cc b/components/mus/ws/view_tree_host_impl.cc index 636711d..fa72a5b 100644 --- a/components/mus/ws/view_tree_host_impl.cc +++ b/components/mus/ws/view_tree_host_impl.cc @@ -17,7 +17,7 @@ namespace mus { ViewTreeHostImpl::ViewTreeHostImpl( - mojo::ViewTreeHostClientPtr client, + mojom::WindowTreeHostClientPtr client, ConnectionManager* connection_manager, mojo::ApplicationImpl* app_impl, const scoped_refptr<GpuState>& gpu_state, @@ -26,9 +26,8 @@ ViewTreeHostImpl::ViewTreeHostImpl( connection_manager_(connection_manager), client_(client.Pass()), event_dispatcher_(this), - display_manager_(DisplayManager::Create(app_impl, - gpu_state, - surfaces_state)), + display_manager_( + DisplayManager::Create(app_impl, gpu_state, surfaces_state)), focus_controller_(new FocusController(this)) { display_manager_->Init(this); if (client_) { @@ -45,8 +44,8 @@ void ViewTreeHostImpl::Init(ViewTreeHostDelegate* delegate) { delegate_->OnDisplayInitialized(); } -ViewTreeImpl* ViewTreeHostImpl::GetViewTree() { - return delegate_ ? delegate_->GetViewTree() : nullptr; +ViewTreeImpl* ViewTreeHostImpl::GetWindowTree() { + return delegate_ ? delegate_->GetWindowTree() : nullptr; } bool ViewTreeHostImpl::IsViewAttachedToRoot(const ServerView* view) const { @@ -62,7 +61,7 @@ bool ViewTreeHostImpl::SchedulePaintIfInViewport(const ServerView* view, return false; } -const mojo::ViewportMetrics& ViewTreeHostImpl::GetViewportMetrics() const { +const mojom::ViewportMetrics& ViewTreeHostImpl::GetViewportMetrics() const { return display_manager_->GetViewportMetrics(); } @@ -157,8 +156,8 @@ void ViewTreeHostImpl::OnDisplayClosed() { } void ViewTreeHostImpl::OnViewportMetricsChanged( - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) { + const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics) { if (!root_) { root_.reset(connection_manager_->CreateServerView( RootViewId(connection_manager_->GetAndAdvanceNextHostId()))); @@ -228,7 +227,7 @@ void ViewTreeHostImpl::OnFocusChanged(ServerView* old_focused_view, } // Ensure that we always notify the root connection of a focus change. - ViewTreeImpl* root_tree = GetViewTree(); + ViewTreeImpl* root_tree = GetWindowTree(); if (root_tree != owning_connection_old && root_tree != embedded_connection_old && root_tree != owning_connection_new && diff --git a/components/mus/ws/view_tree_host_impl.h b/components/mus/ws/view_tree_host_impl.h index 5d6968c..c57c97f 100644 --- a/components/mus/ws/view_tree_host_impl.h +++ b/components/mus/ws/view_tree_host_impl.h @@ -7,7 +7,7 @@ #include "base/memory/scoped_ptr.h" #include "components/mus/public/cpp/types.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/mus/ws/display_manager.h" #include "components/mus/ws/event_dispatcher.h" #include "components/mus/ws/focus_controller_delegate.h" @@ -34,13 +34,13 @@ class ViewTreeImpl; // closes the associated window, then this object and related state will be // deleted. class ViewTreeHostImpl : public DisplayManagerDelegate, - public mojo::ViewTreeHost, + public mojom::WindowTreeHost, public FocusControllerDelegate { public: // 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, + ViewTreeHostImpl(mojom::WindowTreeHostClientPtr client, ConnectionManager* connection_manager, mojo::ApplicationImpl* app_impl, const scoped_refptr<GpuState>& gpu_state, @@ -50,9 +50,9 @@ class ViewTreeHostImpl : public DisplayManagerDelegate, // Initializes state that depends on the existence of a ViewTreeHostImpl. void Init(ViewTreeHostDelegate* delegate); - ViewTreeImpl* GetViewTree(); + ViewTreeImpl* GetWindowTree(); - mojo::ViewTreeHostClient* client() const { return client_.get(); } + mojom::WindowTreeHostClient* client() const { return client_.get(); } cc::SurfaceId surface_id() const { return surface_id_; } @@ -66,7 +66,7 @@ class ViewTreeHostImpl : public DisplayManagerDelegate, const gfx::Rect& bounds); // Returns the metrics for this viewport. - const mojo::ViewportMetrics& GetViewportMetrics() const; + const mojom::ViewportMetrics& GetViewportMetrics() const; ConnectionManager* connection_manager() { return connection_manager_; } @@ -100,8 +100,8 @@ class ViewTreeHostImpl : public DisplayManagerDelegate, void OnEvent(mojo::EventPtr event) override; void OnDisplayClosed() override; void OnViewportMetricsChanged( - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics) override; + const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics) override; void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) override; // FocusControllerDelegate: @@ -110,7 +110,7 @@ class ViewTreeHostImpl : public DisplayManagerDelegate, ViewTreeHostDelegate* delegate_; ConnectionManager* const connection_manager_; - mojo::ViewTreeHostClientPtr client_; + mojom::WindowTreeHostClientPtr client_; EventDispatcher event_dispatcher_; scoped_ptr<ServerView> root_; scoped_ptr<DisplayManager> display_manager_; diff --git a/components/mus/ws/view_tree_impl.cc b/components/mus/ws/view_tree_impl.cc index c32ca12..4831412 100644 --- a/components/mus/ws/view_tree_impl.cc +++ b/components/mus/ws/view_tree_impl.cc @@ -21,12 +21,10 @@ using mojo::Array; using mojo::Callback; using mojo::InterfaceRequest; -using mojo::OrderDirection; using mojo::Rect; using mojo::ServiceProvider; using mojo::ServiceProviderPtr; using mojo::String; -using mojo::ViewDataPtr; namespace mus { @@ -47,7 +45,8 @@ ViewTreeImpl::ViewTreeImpl(ConnectionManager* connection_manager, is_embed_root_ = true; } else { access_policy_.reset(new DefaultAccessPolicy(id_, this)); - is_embed_root_ = (policy_bitmask & ViewTree::ACCESS_POLICY_EMBED_ROOT) != 0; + is_embed_root_ = + (policy_bitmask & WindowTree::ACCESS_POLICY_EMBED_ROOT) != 0; } } @@ -55,7 +54,8 @@ ViewTreeImpl::~ViewTreeImpl() { DestroyViews(); } -void ViewTreeImpl::Init(mojo::ViewTreeClient* client, mojo::ViewTreePtr tree) { +void ViewTreeImpl::Init(mojom::WindowTreeClient* client, + mojom::WindowTreePtr tree) { DCHECK(!client_); client_ = client; std::vector<const ServerView*> to_send; @@ -70,15 +70,15 @@ void ViewTreeImpl::Init(mojo::ViewTreeClient* client, mojo::ViewTreePtr tree) { const Id focused_view_transport_id( ViewIdToTransportId(focused_view ? focused_view->id() : ViewId())); - client->OnEmbed(id_, ViewToViewData(to_send.front()), tree.Pass(), + client->OnEmbed(id_, ViewToWindowData(to_send.front()), tree.Pass(), focused_view_transport_id, - is_embed_root_ ? ViewTree::ACCESS_POLICY_EMBED_ROOT - : ViewTree::ACCESS_POLICY_DEFAULT); + is_embed_root_ ? WindowTree::ACCESS_POLICY_EMBED_ROOT + : WindowTree::ACCESS_POLICY_DEFAULT); } const ServerView* ViewTreeImpl::GetView(const ViewId& id) const { if (id_ == id.connection_id) { - ViewMap::const_iterator i = view_map_.find(id.view_id); + ViewMap::const_iterator i = view_map_.find(id.window_id); return i == view_map_.end() ? NULL : i->second; } return connection_manager_->GetView(id); @@ -90,7 +90,7 @@ bool ViewTreeImpl::IsRoot(const ViewId& id) const { ViewTreeHostImpl* ViewTreeImpl::GetHost() { return root_.get() - ? connection_manager_->GetViewTreeHostByView(GetView(*root_)) + ? connection_manager_->GetWindowTreeHostByView(GetView(*root_)) : nullptr; } @@ -101,7 +101,7 @@ void ViewTreeImpl::OnWillDestroyViewTreeImpl(ViewTreeImpl* connection) { connection->root_ ? connection->GetView(*connection->root_) : nullptr; if (connection_root && ((connection_root->id().connection_id == id_ && - view_map_.count(connection_root->id().view_id) > 0) || + view_map_.count(connection_root->id().window_id) > 0) || (is_embed_root_ && IsViewKnown(connection_root)))) { client()->OnEmbeddedAppDisconnected( ViewIdToTransportId(*connection->root_)); @@ -110,21 +110,22 @@ void ViewTreeImpl::OnWillDestroyViewTreeImpl(ViewTreeImpl* connection) { root_.reset(); } -mojo::ErrorCode ViewTreeImpl::CreateView(const ViewId& view_id) { - if (view_id.connection_id != id_) - return mojo::ERROR_CODE_ILLEGAL_ARGUMENT; - if (view_map_.find(view_id.view_id) != view_map_.end()) - return mojo::ERROR_CODE_VALUE_IN_USE; - view_map_[view_id.view_id] = connection_manager_->CreateServerView(view_id); - known_views_.insert(ViewIdToTransportId(view_id)); - return mojo::ERROR_CODE_NONE; +mojom::ErrorCode ViewTreeImpl::NewWindow(const ViewId& window_id) { + if (window_id.connection_id != id_) + return mojom::ERROR_CODE_ILLEGAL_ARGUMENT; + if (view_map_.find(window_id.window_id) != view_map_.end()) + return mojom::ERROR_CODE_VALUE_IN_USE; + view_map_[window_id.window_id] = + connection_manager_->CreateServerView(window_id); + known_views_.insert(ViewIdToTransportId(window_id)); + return mojom::ERROR_CODE_NONE; } -bool ViewTreeImpl::AddView(const ViewId& parent_id, const ViewId& child_id) { +bool ViewTreeImpl::AddWindow(const ViewId& parent_id, const ViewId& child_id) { ServerView* parent = GetView(parent_id); ServerView* child = GetView(child_id); if (parent && child && child->parent() != parent && - !child->Contains(parent) && access_policy_->CanAddView(parent, child)) { + !child->Contains(parent) && access_policy_->CanAddWindow(parent, child)) { ConnectionManager::ScopedChange change(this, connection_manager_, false); parent->Add(child); return true; @@ -132,17 +133,17 @@ bool ViewTreeImpl::AddView(const ViewId& parent_id, const ViewId& child_id) { return false; } -std::vector<const ServerView*> ViewTreeImpl::GetViewTree( - const ViewId& view_id) const { - const ServerView* view = GetView(view_id); +std::vector<const ServerView*> ViewTreeImpl::GetWindowTree( + const ViewId& window_id) const { + const ServerView* view = GetView(window_id); std::vector<const ServerView*> views; if (view) - GetViewTreeImpl(view, &views); + GetWindowTreeImpl(view, &views); return views; } -bool ViewTreeImpl::SetViewVisibility(const ViewId& view_id, bool visible) { - ServerView* view = GetView(view_id); +bool ViewTreeImpl::SetWindowVisibility(const ViewId& window_id, bool visible) { + ServerView* view = GetView(window_id); if (!view || view->visible() == visible || !access_policy_->CanChangeViewVisibility(view)) { return false; @@ -152,27 +153,27 @@ bool ViewTreeImpl::SetViewVisibility(const ViewId& view_id, bool visible) { return true; } -bool ViewTreeImpl::Embed(const ViewId& view_id, - mojo::ViewTreeClientPtr client, +bool ViewTreeImpl::Embed(const ViewId& window_id, + mojom::WindowTreeClientPtr client, uint32_t policy_bitmask, ConnectionSpecificId* connection_id) { *connection_id = kInvalidConnectionId; - if (!client.get() || !CanEmbed(view_id, policy_bitmask)) + if (!client.get() || !CanEmbed(window_id, policy_bitmask)) return false; - PrepareForEmbed(view_id); + PrepareForEmbed(window_id); ViewTreeImpl* new_connection = connection_manager_->EmbedAtView( - id_, view_id, policy_bitmask, client.Pass()); + id_, window_id, policy_bitmask, client.Pass()); if (is_embed_root_) *connection_id = new_connection->id(); return true; } -void ViewTreeImpl::Embed(const ViewId& view_id, mojo::URLRequestPtr request) { - if (!CanEmbed(view_id, ViewTree::ACCESS_POLICY_DEFAULT)) +void ViewTreeImpl::Embed(const ViewId& window_id, mojo::URLRequestPtr request) { + if (!CanEmbed(window_id, WindowTree::ACCESS_POLICY_DEFAULT)) return; - PrepareForEmbed(view_id); + PrepareForEmbed(window_id); connection_manager_->EmbedAtView( - id_, view_id, mojo::ViewTree::ACCESS_POLICY_DEFAULT, request.Pass()); + id_, window_id, mojom::WindowTree::ACCESS_POLICY_DEFAULT, request.Pass()); } void ViewTreeImpl::ProcessViewBoundsChanged(const ServerView* view, @@ -198,8 +199,8 @@ void ViewTreeImpl::ProcessClientAreaChanged(const ServerView* window, } void ViewTreeImpl::ProcessViewportMetricsChanged( - const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics, + const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics, bool originated_change) { client()->OnWindowViewportMetricsChanged(old_metrics.Clone(), new_metrics.Clone()); @@ -263,13 +264,13 @@ void ViewTreeImpl::ProcessViewHierarchyChanged(const ServerView* view, const ViewId old_parent_id(old_parent ? old_parent->id() : ViewId()); client()->OnWindowHierarchyChanged( ViewIdToTransportId(view->id()), ViewIdToTransportId(new_parent_id), - ViewIdToTransportId(old_parent_id), ViewsToViewDatas(to_send)); + ViewIdToTransportId(old_parent_id), ViewsToWindowDatas(to_send)); connection_manager_->OnConnectionMessagedClient(id_); } void ViewTreeImpl::ProcessViewReorder(const ServerView* view, const ServerView* relative_view, - OrderDirection direction, + mojom::OrderDirection direction, bool originated_change) { if (originated_change || !IsViewKnown(view) || !IsViewKnown(relative_view)) return; @@ -282,7 +283,7 @@ void ViewTreeImpl::ProcessViewReorder(const ServerView* view, void ViewTreeImpl::ProcessViewDeleted(const ViewId& view, bool originated_change) { if (view.connection_id == id_) - view_map_.erase(view.view_id); + view_map_.erase(view.window_id); const bool in_known = known_views_.erase(ViewIdToTransportId(view)) > 0; @@ -334,16 +335,16 @@ bool ViewTreeImpl::IsViewKnown(const ServerView* view) const { return known_views_.count(ViewIdToTransportId(view->id())) > 0; } -bool ViewTreeImpl::CanReorderView(const ServerView* view, - const ServerView* relative_view, - OrderDirection direction) const { +bool ViewTreeImpl::CanReorderWindow(const ServerView* view, + const ServerView* relative_view, + mojom::OrderDirection direction) const { if (!view || !relative_view) return false; if (!view->parent() || view->parent() != relative_view->parent()) return false; - if (!access_policy_->CanReorderView(view, relative_view, direction)) + if (!access_policy_->CanReorderWindow(view, relative_view, direction)) return false; std::vector<const ServerView*> children = view->parent()->GetChildren(); @@ -352,15 +353,15 @@ bool ViewTreeImpl::CanReorderView(const ServerView* view, const size_t target_i = std::find(children.begin(), children.end(), relative_view) - 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 == mojom::ORDER_DIRECTION_ABOVE && child_i == target_i + 1) || + (direction == mojom::ORDER_DIRECTION_BELOW && child_i + 1 == target_i)) { return false; } return true; } -bool ViewTreeImpl::DeleteViewImpl(ViewTreeImpl* source, ServerView* view) { +bool ViewTreeImpl::DeleteWindowImpl(ViewTreeImpl* source, ServerView* view) { DCHECK(view); DCHECK_EQ(view->id().connection_id, id_); ConnectionManager::ScopedChange change(source, connection_manager_, true); @@ -370,7 +371,7 @@ bool ViewTreeImpl::DeleteViewImpl(ViewTreeImpl* source, ServerView* view) { void ViewTreeImpl::GetUnknownViewsFrom(const ServerView* view, std::vector<const ServerView*>* views) { - if (IsViewKnown(view) || !access_policy_->CanGetViewTree(view)) + if (IsViewKnown(view) || !access_policy_->CanGetWindowTree(view)) return; views->push_back(view); known_views_.insert(ViewIdToTransportId(view->id())); @@ -414,24 +415,24 @@ void ViewTreeImpl::RemoveRoot() { local_views[i]->parent()->Remove(local_views[i]); } -Array<ViewDataPtr> ViewTreeImpl::ViewsToViewDatas( +Array<mojom::WindowDataPtr> ViewTreeImpl::ViewsToWindowDatas( const std::vector<const ServerView*>& views) { - Array<ViewDataPtr> array(views.size()); + Array<mojom::WindowDataPtr> array(views.size()); for (size_t i = 0; i < views.size(); ++i) - array[i] = ViewToViewData(views[i]).Pass(); + array[i] = ViewToWindowData(views[i]).Pass(); return array.Pass(); } -ViewDataPtr ViewTreeImpl::ViewToViewData(const ServerView* view) { +mojom::WindowDataPtr ViewTreeImpl::ViewToWindowData(const ServerView* view) { DCHECK(IsViewKnown(view)); const ServerView* parent = view->parent(); // If the parent isn't known, it means the parent is not visible to us (not // in roots), and should not be sent over. if (parent && !IsViewKnown(parent)) parent = NULL; - ViewDataPtr view_data(mojo::ViewData::New()); + mojom::WindowDataPtr view_data(mojom::WindowData::New()); view_data->parent_id = ViewIdToTransportId(parent ? parent->id() : ViewId()); - view_data->view_id = ViewIdToTransportId(view->id()); + view_data->window_id = ViewIdToTransportId(view->id()); view_data->bounds = Rect::From(view->bounds()); view_data->properties = mojo::Map<String, Array<uint8_t>>::From(view->properties()); @@ -442,12 +443,12 @@ ViewDataPtr ViewTreeImpl::ViewToViewData(const ServerView* view) { return view_data.Pass(); } -void ViewTreeImpl::GetViewTreeImpl( +void ViewTreeImpl::GetWindowTreeImpl( const ServerView* view, std::vector<const ServerView*>* views) const { DCHECK(view); - if (!access_policy_->CanGetViewTree(view)) + if (!access_policy_->CanGetWindowTree(view)) return; views->push_back(view); @@ -457,7 +458,7 @@ void ViewTreeImpl::GetViewTreeImpl( std::vector<const ServerView*> children(view->GetChildren()); for (size_t i = 0; i < children.size(); ++i) - GetViewTreeImpl(children[i], views); + GetWindowTreeImpl(children[i], views); } void ViewTreeImpl::NotifyDrawnStateChanged(const ServerView* view, @@ -487,22 +488,22 @@ void ViewTreeImpl::DestroyViews() { } } -bool ViewTreeImpl::CanEmbed(const ViewId& view_id, +bool ViewTreeImpl::CanEmbed(const ViewId& window_id, uint32_t policy_bitmask) const { - const ServerView* view = GetView(view_id); + const ServerView* view = GetView(window_id); return view && access_policy_->CanEmbed(view, policy_bitmask); } -void ViewTreeImpl::PrepareForEmbed(const ViewId& view_id) { - const ServerView* view = GetView(view_id); +void ViewTreeImpl::PrepareForEmbed(const ViewId& window_id) { + const ServerView* view = GetView(window_id); DCHECK(view); // Only allow a node to be the root for one connection. ViewTreeImpl* existing_owner = - connection_manager_->GetConnectionWithRoot(view_id); + connection_manager_->GetConnectionWithRoot(window_id); ConnectionManager::ScopedChange change(this, connection_manager_, true); - RemoveChildrenAsPartOfEmbed(view_id); + RemoveChildrenAsPartOfEmbed(window_id); if (existing_owner) { // Never message the originating connection. connection_manager_->OnConnectionMessagedClient(id_); @@ -510,44 +511,46 @@ void ViewTreeImpl::PrepareForEmbed(const ViewId& view_id) { } } -void ViewTreeImpl::RemoveChildrenAsPartOfEmbed(const ViewId& view_id) { - ServerView* view = GetView(view_id); +void ViewTreeImpl::RemoveChildrenAsPartOfEmbed(const ViewId& window_id) { + ServerView* view = GetView(window_id); CHECK(view); - CHECK(view->id().connection_id == view_id.connection_id); + CHECK(view->id().connection_id == window_id.connection_id); std::vector<ServerView*> children = view->GetChildren(); for (size_t i = 0; i < children.size(); ++i) view->Remove(children[i]); } -void ViewTreeImpl::CreateView(Id transport_view_id, - const Callback<void(mojo::ErrorCode)>& callback) { - callback.Run(CreateView(ViewIdFromTransportId(transport_view_id))); +void ViewTreeImpl::NewWindow(Id transport_window_id, + const Callback<void(mojom::ErrorCode)>& callback) { + callback.Run(NewWindow(ViewIdFromTransportId(transport_window_id))); } -void ViewTreeImpl::DeleteView(Id transport_view_id, - const Callback<void(bool)>& callback) { - ServerView* view = GetView(ViewIdFromTransportId(transport_view_id)); +void ViewTreeImpl::DeleteWindow(Id transport_window_id, + const Callback<void(bool)>& callback) { + ServerView* view = GetView(ViewIdFromTransportId(transport_window_id)); bool success = false; - if (view && access_policy_->CanDeleteView(view)) { + if (view && access_policy_->CanDeleteWindow(view)) { ViewTreeImpl* connection = connection_manager_->GetConnection(view->id().connection_id); - success = connection && connection->DeleteViewImpl(this, view); + success = connection && connection->DeleteWindowImpl(this, view); } callback.Run(success); } -void ViewTreeImpl::AddView(Id parent_id, - Id child_id, - const Callback<void(bool)>& callback) { - callback.Run(AddView(ViewIdFromTransportId(parent_id), - ViewIdFromTransportId(child_id))); +void ViewTreeImpl::AddWindow(Id parent_id, + Id child_id, + const Callback<void(bool)>& callback) { + callback.Run(AddWindow(ViewIdFromTransportId(parent_id), + ViewIdFromTransportId(child_id))); } -void ViewTreeImpl::RemoveViewFromParent(Id view_id, - const Callback<void(bool)>& callback) { +void ViewTreeImpl::RemoveWindowFromParent( + Id window_id, + const Callback<void(bool)>& callback) { bool success = false; - ServerView* view = GetView(ViewIdFromTransportId(view_id)); - if (view && view->parent() && access_policy_->CanRemoveViewFromParent(view)) { + ServerView* view = GetView(ViewIdFromTransportId(window_id)); + if (view && view->parent() && + access_policy_->CanRemoveWindowFromParent(view)) { success = true; ConnectionManager::ScopedChange change(this, connection_manager_, false); view->parent()->Remove(view); @@ -555,14 +558,15 @@ void ViewTreeImpl::RemoveViewFromParent(Id view_id, callback.Run(success); } -void ViewTreeImpl::ReorderView(Id view_id, - Id relative_view_id, - OrderDirection direction, - const Callback<void(bool)>& callback) { +void ViewTreeImpl::ReorderWindow(Id window_id, + Id relative_window_id, + mojom::OrderDirection direction, + const Callback<void(bool)>& callback) { bool success = false; - ServerView* view = GetView(ViewIdFromTransportId(view_id)); - ServerView* relative_view = GetView(ViewIdFromTransportId(relative_view_id)); - if (CanReorderView(view, relative_view, direction)) { + ServerView* view = GetView(ViewIdFromTransportId(window_id)); + ServerView* relative_view = + GetView(ViewIdFromTransportId(relative_window_id)); + if (CanReorderWindow(view, relative_view, direction)) { success = true; ConnectionManager::ScopedChange change(this, connection_manager_, false); view->parent()->Reorder(view, relative_view, direction); @@ -571,19 +575,19 @@ void ViewTreeImpl::ReorderView(Id view_id, callback.Run(success); } -void ViewTreeImpl::GetViewTree( - Id view_id, - const Callback<void(Array<ViewDataPtr>)>& callback) { +void ViewTreeImpl::GetWindowTree( + Id window_id, + const Callback<void(Array<mojom::WindowDataPtr>)>& callback) { std::vector<const ServerView*> views( - GetViewTree(ViewIdFromTransportId(view_id))); - callback.Run(ViewsToViewDatas(views)); + GetWindowTree(ViewIdFromTransportId(window_id))); + callback.Run(ViewsToWindowDatas(views)); } -void ViewTreeImpl::SetViewBounds(Id view_id, - mojo::RectPtr bounds, - const Callback<void(bool)>& callback) { - ServerView* view = GetView(ViewIdFromTransportId(view_id)); - const bool success = view && access_policy_->CanSetViewBounds(view); +void ViewTreeImpl::SetWindowBounds(Id window_id, + mojo::RectPtr bounds, + const Callback<void(bool)>& callback) { + ServerView* view = GetView(ViewIdFromTransportId(window_id)); + const bool success = view && access_policy_->CanSetWindowBounds(view); if (success) { ConnectionManager::ScopedChange change(this, connection_manager_, false); view->SetBounds(bounds.To<gfx::Rect>()); @@ -591,19 +595,20 @@ void ViewTreeImpl::SetViewBounds(Id view_id, callback.Run(success); } -void ViewTreeImpl::SetViewVisibility(Id transport_view_id, - bool visible, - const Callback<void(bool)>& callback) { +void ViewTreeImpl::SetWindowVisibility(Id transport_window_id, + bool visible, + const Callback<void(bool)>& callback) { callback.Run( - SetViewVisibility(ViewIdFromTransportId(transport_view_id), visible)); + SetWindowVisibility(ViewIdFromTransportId(transport_window_id), visible)); } -void ViewTreeImpl::SetViewProperty(uint32_t view_id, - const mojo::String& name, - mojo::Array<uint8_t> value, - const mojo::Callback<void(bool)>& callback) { - ServerView* view = GetView(ViewIdFromTransportId(view_id)); - const bool success = view && access_policy_->CanSetViewProperties(view); +void ViewTreeImpl::SetWindowProperty( + uint32_t window_id, + const mojo::String& name, + mojo::Array<uint8_t> value, + const mojo::Callback<void(bool)>& callback) { + ServerView* view = GetView(ViewIdFromTransportId(window_id)); + const bool success = view && access_policy_->CanSetWindowProperties(view); if (success) { ConnectionManager::ScopedChange change(this, connection_manager_, false); @@ -617,29 +622,30 @@ void ViewTreeImpl::SetViewProperty(uint32_t view_id, callback.Run(success); } -void ViewTreeImpl::RequestSurface(Id view_id, - mojo::InterfaceRequest<mojo::Surface> surface, - mojo::SurfaceClientPtr client) { - ServerView* view = GetView(ViewIdFromTransportId(view_id)); +void ViewTreeImpl::RequestSurface( + Id window_id, + mojo::InterfaceRequest<mojom::Surface> surface, + mojom::SurfaceClientPtr client) { + ServerView* view = GetView(ViewIdFromTransportId(window_id)); const bool success = view && access_policy_->CanSetWindowSurfaceId(view); if (!success) return; view->Bind(surface.Pass(), client.Pass()); } -void ViewTreeImpl::SetViewTextInputState(uint32_t view_id, - mojo::TextInputStatePtr state) { - ServerView* view = GetView(ViewIdFromTransportId(view_id)); - bool success = view && access_policy_->CanSetViewTextInputState(view); +void ViewTreeImpl::SetWindowTextInputState(uint32_t window_id, + mojo::TextInputStatePtr state) { + ServerView* view = GetView(ViewIdFromTransportId(window_id)); + bool success = view && access_policy_->CanSetWindowTextInputState(view); if (success) view->SetTextInputState(state.To<ui::TextInputState>()); } -void ViewTreeImpl::SetImeVisibility(Id transport_view_id, +void ViewTreeImpl::SetImeVisibility(Id transport_window_id, bool visible, mojo::TextInputStatePtr state) { - ServerView* view = GetView(ViewIdFromTransportId(transport_view_id)); - bool success = view && access_policy_->CanSetViewTextInputState(view); + ServerView* view = GetView(ViewIdFromTransportId(transport_window_id)); + bool success = view && access_policy_->CanSetWindowTextInputState(view); if (success) { if (!state.is_null()) view->SetTextInputState(state.To<ui::TextInputState>()); @@ -661,18 +667,18 @@ void ViewTreeImpl::SetClientArea(Id transport_window_id, mojo::RectPtr rect) { window->SetClientArea(rect.To<gfx::Rect>()); } -void ViewTreeImpl::Embed(Id transport_view_id, - mojo::ViewTreeClientPtr client, +void ViewTreeImpl::Embed(Id transport_window_id, + mojom::WindowTreeClientPtr client, uint32_t policy_bitmask, const EmbedCallback& callback) { ConnectionSpecificId connection_id = kInvalidConnectionId; - const bool result = Embed(ViewIdFromTransportId(transport_view_id), + const bool result = Embed(ViewIdFromTransportId(transport_window_id), client.Pass(), policy_bitmask, &connection_id); callback.Run(result, connection_id); } -void ViewTreeImpl::SetFocus(uint32_t view_id) { - ServerView* view = GetView(ViewIdFromTransportId(view_id)); +void ViewTreeImpl::SetFocus(uint32_t window_id) { + ServerView* view = GetView(ViewIdFromTransportId(window_id)); // TODO(beng): consider shifting non-policy drawn check logic to VTH's // FocusController. if (view && view->IsDrawn() && access_policy_->CanSetFocus(view)) { diff --git a/components/mus/ws/view_tree_impl.h b/components/mus/ws/view_tree_impl.h index 30ce501..ea36132 100644 --- a/components/mus/ws/view_tree_impl.h +++ b/components/mus/ws/view_tree_impl.h @@ -14,7 +14,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "components/mus/public/interfaces/surface_id.mojom.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/ws/access_policy_delegate.h" #include "components/mus/ws/ids.h" @@ -33,7 +33,7 @@ class ViewTreeHostImpl; // ViewTreeImpl tracks all the state and views created by a client. ViewTreeImpl // coordinates with ConnectionManager to update the client (and internal state) // as necessary. -class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { +class ViewTreeImpl : public mojom::WindowTree, public AccessPolicyDelegate { public: ViewTreeImpl(ConnectionManager* connection_manager, ConnectionSpecificId creator_id, @@ -43,12 +43,12 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { // |services| and |exposed_services| are the ServiceProviders to pass to the // client via OnEmbed(). - void Init(mojo::ViewTreeClient* client, mojo::ViewTreePtr tree); + void Init(mojom::WindowTreeClient* client, mojom::WindowTreePtr tree); ConnectionSpecificId id() const { return id_; } ConnectionSpecificId creator_id() const { return creator_id_; } - mojo::ViewTreeClient* client() { return client_; } + mojom::WindowTreeClient* client() { return client_; } // Returns the View with the specified id. ServerView* GetView(const ViewId& id) { @@ -73,15 +73,15 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { // These functions are synchronous variants of those defined in the mojom. The // ViewTree implementations all call into these. See the mojom for details. - mojo::ErrorCode CreateView(const ViewId& view_id); - bool AddView(const ViewId& parent_id, const ViewId& child_id); - std::vector<const ServerView*> GetViewTree(const ViewId& view_id) const; - bool SetViewVisibility(const ViewId& view_id, bool visible); - bool Embed(const ViewId& view_id, - mojo::ViewTreeClientPtr client, + mojom::ErrorCode NewWindow(const ViewId& window_id); + bool AddWindow(const ViewId& parent_id, const ViewId& child_id); + std::vector<const ServerView*> GetWindowTree(const ViewId& window_id) const; + bool SetWindowVisibility(const ViewId& window_id, bool visible); + bool Embed(const ViewId& window_id, + mojom::WindowTreeClientPtr client, uint32_t policy_bitmask, ConnectionSpecificId* connection_id); - void Embed(const ViewId& view_id, mojo::URLRequestPtr request); + void Embed(const ViewId& window_id, mojo::URLRequestPtr request); // The following methods are invoked after the corresponding change has been // processed. They do the appropriate bookkeeping and update the client as @@ -94,8 +94,8 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { const gfx::Rect& old_client_area, const gfx::Rect& new_client_area, bool originated_change); - void ProcessViewportMetricsChanged(const mojo::ViewportMetrics& old_metrics, - const mojo::ViewportMetrics& new_metrics, + void ProcessViewportMetricsChanged(const mojom::ViewportMetrics& old_metrics, + const mojom::ViewportMetrics& new_metrics, bool originated_change); void ProcessWillChangeViewHierarchy(const ServerView* view, const ServerView* new_parent, @@ -111,7 +111,7 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { bool originated_change); void ProcessViewReorder(const ServerView* view, const ServerView* relative_view, - mojo::OrderDirection direction, + mojom::OrderDirection direction, bool originated_change); void ProcessViewDeleted(const ViewId& view, bool originated_change); void ProcessWillChangeViewVisibility(const ServerView* view, @@ -127,13 +127,13 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { // These functions return true if the corresponding mojom function is allowed // for this connection. - bool CanReorderView(const ServerView* view, - const ServerView* relative_view, - mojo::OrderDirection direction) const; + bool CanReorderWindow(const ServerView* view, + const ServerView* relative_view, + mojom::OrderDirection direction) const; // Deletes a view owned by this connection. Returns true on success. |source| // is the connection that originated the change. - bool DeleteViewImpl(ViewTreeImpl* source, ServerView* view); + bool DeleteWindowImpl(ViewTreeImpl* source, ServerView* view); // If |view| is known (in |known_views_|) does nothing. Otherwise adds |view| // to |views|, marks |view| as known and recurses. @@ -149,17 +149,17 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { // Resets the root of this connection. void RemoveRoot(); - // Converts View(s) to ViewData(s) for transport. This assumes all the views + // Converts View(s) to WindowData(s) for transport. This assumes all the views // are valid for the client. The parent of views the client is not allowed to - // see are set to NULL (in the returned ViewData(s)). - mojo::Array<mojo::ViewDataPtr> ViewsToViewDatas( + // see are set to NULL (in the returned WindowData(s)). + mojo::Array<mojom::WindowDataPtr> ViewsToWindowDatas( const std::vector<const ServerView*>& views); - mojo::ViewDataPtr ViewToViewData(const ServerView* view); + mojom::WindowDataPtr ViewToWindowData(const ServerView* view); - // Implementation of GetViewTree(). Adds |view| to |views| and recurses if + // Implementation of GetWindowTree(). Adds |view| to |views| and recurses if // CanDescendIntoViewForViewTree() returns true. - void GetViewTreeImpl(const ServerView* view, - std::vector<const ServerView*>* views) const; + void GetWindowTreeImpl(const ServerView* view, + std::vector<const ServerView*>* views) const; // Notify the client if the drawn state of any of the roots changes. // |view| is the view that is changing to the drawn state |new_drawn_value|. @@ -168,50 +168,51 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { // Deletes all Views we own. void DestroyViews(); - bool CanEmbed(const ViewId& view_id, uint32_t policy_bitmask) const; - void PrepareForEmbed(const ViewId& view_id); - void RemoveChildrenAsPartOfEmbed(const ViewId& view_id); + bool CanEmbed(const ViewId& window_id, uint32_t policy_bitmask) const; + void PrepareForEmbed(const ViewId& window_id); + void RemoveChildrenAsPartOfEmbed(const ViewId& window_id); // ViewTree: - void CreateView( - Id transport_view_id, - const mojo::Callback<void(mojo::ErrorCode)>& callback) override; - void DeleteView(Id transport_view_id, - const mojo::Callback<void(bool)>& callback) override; - void AddView(Id parent_id, - Id child_id, - const mojo::Callback<void(bool)>& callback) override; - void RemoveViewFromParent( - Id view_id, + void NewWindow( + Id transport_window_id, + const mojo::Callback<void(mojom::ErrorCode)>& callback) override; + void DeleteWindow(Id transport_window_id, + const mojo::Callback<void(bool)>& callback) override; + void AddWindow(Id parent_id, + Id child_id, + const mojo::Callback<void(bool)>& callback) override; + void RemoveWindowFromParent( + Id window_id, const mojo::Callback<void(bool)>& callback) override; - void ReorderView(Id view_id, - Id relative_view_id, - mojo::OrderDirection direction, - const mojo::Callback<void(bool)>& callback) override; - void GetViewTree(Id view_id, - const mojo::Callback<void(mojo::Array<mojo::ViewDataPtr>)>& - callback) override; - void SetViewBounds(Id view_id, - mojo::RectPtr bounds, + void ReorderWindow(Id window_id, + Id relative_window_id, + mojom::OrderDirection direction, const mojo::Callback<void(bool)>& callback) override; - void SetViewVisibility(Id view_id, - bool visible, - const mojo::Callback<void(bool)>& callback) override; - void SetViewProperty(Id view_id, - const mojo::String& name, - mojo::Array<uint8_t> value, + void GetWindowTree( + Id window_id, + const mojo::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback) + override; + void SetWindowBounds(Id window_id, + mojo::RectPtr bounds, const mojo::Callback<void(bool)>& callback) override; - void RequestSurface(Id view_id, - mojo::InterfaceRequest<mojo::Surface> surface, - mojo::SurfaceClientPtr client) override; - void Embed(Id transport_view_id, - mojo::ViewTreeClientPtr client, + void SetWindowVisibility(Id window_id, + bool visible, + const mojo::Callback<void(bool)>& callback) override; + void SetWindowProperty(Id window_id, + const mojo::String& name, + mojo::Array<uint8_t> value, + const mojo::Callback<void(bool)>& callback) override; + void RequestSurface(Id window_id, + mojo::InterfaceRequest<mojom::Surface> surface, + mojom::SurfaceClientPtr client) override; + void Embed(Id transport_window_id, + mojom::WindowTreeClientPtr 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 SetFocus(uint32_t window_id) override; + void SetWindowTextInputState(uint32_t window_id, + mojo::TextInputStatePtr state) override; + void SetImeVisibility(Id transport_window_id, bool visible, mojo::TextInputStatePtr state) override; void SetClientArea(Id transport_window_id, mojo::RectPtr rect) override; @@ -232,7 +233,7 @@ class ViewTreeImpl : public mojo::ViewTree, public AccessPolicyDelegate { // created by the root, or the connection that created us has been destroyed. ConnectionSpecificId creator_id_; - mojo::ViewTreeClient* client_; + mojom::WindowTreeClient* client_; scoped_ptr<mus::AccessPolicy> access_policy_; diff --git a/components/mus/ws/view_tree_unittest.cc b/components/mus/ws/view_tree_unittest.cc index 621fa1e..aadbe48 100644 --- a/components/mus/ws/view_tree_unittest.cc +++ b/components/mus/ws/view_tree_unittest.cc @@ -8,7 +8,7 @@ #include "base/message_loop/message_loop.h" #include "components/mus/public/cpp/types.h" #include "components/mus/public/cpp/util.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/surfaces/surfaces_state.h" #include "components/mus/ws/client_connection.h" #include "components/mus/ws/connection_manager.h" @@ -26,32 +26,32 @@ #include "ui/gfx/geometry/rect.h" using mojo::Array; -using mojo::ERROR_CODE_NONE; using mojo::InterfaceRequest; using mojo::ServiceProvider; using mojo::ServiceProviderPtr; using mojo::String; -using mojo::ViewDataPtr; +using mus::mojom::ERROR_CODE_NONE; +using mus::mojom::WindowDataPtr; namespace mus { namespace { // ----------------------------------------------------------------------------- -// ViewTreeClient implementation that logs all calls to a TestChangeTracker. +// WindowTreeClient implementation that logs all calls to a TestChangeTracker. // TODO(sky): refactor so both this and ViewTreeAppTest share code. -class TestViewTreeClient : public mojo::ViewTreeClient { +class TestWindowTreeClient : public mus::mojom::WindowTreeClient { public: - TestViewTreeClient() {} - ~TestViewTreeClient() override {} + TestWindowTreeClient() {} + ~TestWindowTreeClient() override {} TestChangeTracker* tracker() { return &tracker_; } private: - // ViewTreeClient: + // WindowTreeClient: void OnEmbed(uint16_t connection_id, - ViewDataPtr root, - mojo::ViewTreePtr tree, + WindowDataPtr root, + mus::mojom::WindowTreePtr tree, Id focused_view_id, uint32_t access_policy) override { // TODO(sky): add test coverage of |focused_view_id|. @@ -71,21 +71,21 @@ class TestViewTreeClient : public mojo::ViewTreeClient { mojo::RectPtr new_client_area) override { } void OnWindowViewportMetricsChanged( - mojo::ViewportMetricsPtr old_metrics, - mojo::ViewportMetricsPtr new_metrics) override { + mojom::ViewportMetricsPtr old_metrics, + mojom::ViewportMetricsPtr new_metrics) override { tracker_.OnWindowViewportMetricsChanged(old_metrics.Pass(), new_metrics.Pass()); } void OnWindowHierarchyChanged(uint32_t view, uint32_t new_parent, uint32_t old_parent, - Array<ViewDataPtr> views) override { + Array<WindowDataPtr> views) override { tracker_.OnWindowHierarchyChanged(view, new_parent, old_parent, views.Pass()); } void OnWindowReordered(uint32_t view_id, uint32_t relative_view_id, - mojo::OrderDirection direction) override { + mojom::OrderDirection direction) override { tracker_.OnWindowReordered(view_id, relative_view_id, direction); } void OnWindowDeleted(uint32_t view) override { @@ -113,23 +113,23 @@ class TestViewTreeClient : public mojo::ViewTreeClient { TestChangeTracker tracker_; - DISALLOW_COPY_AND_ASSIGN(TestViewTreeClient); + DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient); }; // ----------------------------------------------------------------------------- -// ClientConnection implementation that vends TestViewTreeClient. +// ClientConnection implementation that vends TestWindowTreeClient. class TestClientConnection : public ClientConnection { public: explicit TestClientConnection(scoped_ptr<ViewTreeImpl> service_impl) : ClientConnection(service_impl.Pass(), &client_) {} - TestViewTreeClient* client() { return &client_; } + TestWindowTreeClient* client() { return &client_; } private: ~TestClientConnection() override {} - TestViewTreeClient client_; + TestWindowTreeClient client_; DISALLOW_COPY_AND_ASSIGN(TestClientConnection); }; @@ -142,7 +142,7 @@ class TestConnectionManagerDelegate : public ConnectionManagerDelegate { TestConnectionManagerDelegate() : last_connection_(nullptr) {} ~TestConnectionManagerDelegate() override {} - TestViewTreeClient* last_client() { + TestWindowTreeClient* last_client() { return last_connection_ ? last_connection_->client() : nullptr; } @@ -154,7 +154,7 @@ class TestConnectionManagerDelegate : public ConnectionManagerDelegate { ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> service_request, + mojo::InterfaceRequest<mus::mojom::WindowTree> service_request, ConnectionSpecificId creator_id, mojo::URLRequestPtr request, const ViewId& root_id, @@ -166,11 +166,11 @@ class TestConnectionManagerDelegate : public ConnectionManagerDelegate { } ClientConnection* CreateClientConnectionForEmbedAtView( ConnectionManager* connection_manager, - mojo::InterfaceRequest<mojo::ViewTree> service_request, + mojo::InterfaceRequest<mus::mojom::WindowTree> service_request, ConnectionSpecificId creator_id, const ViewId& root_id, uint32_t policy_bitmask, - mojo::ViewTreeClientPtr client) override { + mus::mojom::WindowTreeClientPtr client) override { // Used by ConnectionManager::AddRoot. scoped_ptr<ViewTreeImpl> service(new ViewTreeImpl( connection_manager, creator_id, root_id, policy_bitmask)); @@ -193,12 +193,13 @@ class TestViewTreeHostConnection : public ViewTreeHostConnection { ~TestViewTreeHostConnection() override {} private: - // ViewTreeHostDelegate: + // WindowTreeHostDelegate: void OnDisplayInitialized() override { connection_manager()->AddHost(this); set_view_tree(connection_manager()->EmbedAtView( kInvalidConnectionId, view_tree_host()->root_view()->id(), - mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT, mojo::ViewTreeClientPtr())); + mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, + mus::mojom::WindowTreeClientPtr())); } DISALLOW_COPY_AND_ASSIGN(TestViewTreeHostConnection); }; @@ -215,23 +216,23 @@ class TestDisplayManager : public DisplayManager { // It is necessary to tell the delegate about the ViewportMetrics to make // sure that the ViewTreeHostConnection is correctly initialized (and a // root-view is created). - mojo::ViewportMetrics metrics; + mojom::ViewportMetrics metrics; metrics.size_in_pixels = mojo::Size::From(gfx::Size(400, 300)); metrics.device_pixel_ratio = 1.f; - delegate->OnViewportMetricsChanged(mojo::ViewportMetrics(), metrics); + delegate->OnViewportMetricsChanged(mojom::ViewportMetrics(), metrics); } void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override { } void SetViewportSize(const gfx::Size& size) override {} void SetTitle(const base::string16& title) override {} - const mojo::ViewportMetrics& GetViewportMetrics() override { + const mojom::ViewportMetrics& GetViewportMetrics() override { return display_metrices_; } void UpdateTextInputState(const ui::TextInputState& state) override {} void SetImeVisibility(bool visible) override {} private: - mojo::ViewportMetrics display_metrices_; + mojom::ViewportMetrics display_metrices_; DISALLOW_COPY_AND_ASSIGN(TestDisplayManager); }; @@ -288,7 +289,7 @@ class ViewTreeTest : public testing::Test { return connection_manager_->GetConnection(1); } - TestViewTreeClient* last_view_tree_client() { + TestWindowTreeClient* last_window_tree_client() { return delegate_.last_client(); } @@ -298,7 +299,7 @@ class ViewTreeTest : public testing::Test { ConnectionManager* connection_manager() { return connection_manager_.get(); } - TestViewTreeClient* wm_client() { return wm_client_; } + TestWindowTreeClient* wm_client() { return wm_client_; } TestViewTreeHostConnection* host_connection() { return host_connection_; } DisplayManagerDelegate* display_manager_delegate() { @@ -313,9 +314,8 @@ class ViewTreeTest : public testing::Test { connection_manager_.reset( new ConnectionManager(&delegate_, scoped_refptr<SurfacesState>())); ViewTreeHostImpl* host = new ViewTreeHostImpl( - mojo::ViewTreeHostClientPtr(), connection_manager_.get(), - nullptr, scoped_refptr<GpuState>(), - scoped_refptr<SurfacesState>()); + mus::mojom::WindowTreeHostClientPtr(), connection_manager_.get(), + nullptr, scoped_refptr<GpuState>(), scoped_refptr<SurfacesState>()); // TODO(fsamuel): This is way too magical. We need to find a better way to // manage lifetime. host_connection_ = new TestViewTreeHostConnection( @@ -325,8 +325,8 @@ class ViewTreeTest : public testing::Test { } private: - // TestViewTreeClient that is used for the WM connection. - TestViewTreeClient* wm_client_; + // TestWindowTreeClient that is used for the WM connection. + TestWindowTreeClient* wm_client_; TestDisplayManagerFactory display_manager_factory_; TestConnectionManagerDelegate delegate_; TestViewTreeHostConnection* host_connection_; @@ -339,10 +339,10 @@ class ViewTreeTest : public testing::Test { // Verifies focus correctly changes on pointer events. TEST_F(ViewTreeTest, FocusOnPointer) { const ViewId embed_view_id(wm_connection()->id(), 1); - EXPECT_EQ(ERROR_CODE_NONE, wm_connection()->CreateView(embed_view_id)); - EXPECT_TRUE(wm_connection()->SetViewVisibility(embed_view_id, true)); + EXPECT_EQ(ERROR_CODE_NONE, wm_connection()->NewWindow(embed_view_id)); + EXPECT_TRUE(wm_connection()->SetWindowVisibility(embed_view_id, true)); EXPECT_TRUE( - wm_connection()->AddView(*(wm_connection()->root()), embed_view_id)); + wm_connection()->AddWindow(*(wm_connection()->root()), embed_view_id)); host_connection()->view_tree_host()->root_view()->SetBounds( gfx::Rect(0, 0, 100, 100)); mojo::URLRequestPtr request(mojo::URLRequest::New()); @@ -357,13 +357,13 @@ TEST_F(ViewTreeTest, FocusOnPointer) { ->SetBounds(gfx::Rect(0, 0, 50, 50)); const ViewId child1(connection1->id(), 1); - EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); - EXPECT_TRUE(connection1->AddView(embed_view_id, child1)); + EXPECT_EQ(ERROR_CODE_NONE, connection1->NewWindow(child1)); + EXPECT_TRUE(connection1->AddWindow(embed_view_id, child1)); ServerView* v1 = connection1->GetView(child1); v1->SetVisible(true); v1->SetBounds(gfx::Rect(20, 20, 20, 20)); - TestViewTreeClient* connection1_client = last_view_tree_client(); + TestWindowTreeClient* connection1_client = last_window_tree_client(); connection1_client->tracker()->changes()->clear(); wm_client()->tracker()->changes()->clear(); @@ -414,10 +414,10 @@ TEST_F(ViewTreeTest, FocusOnPointer) { TEST_F(ViewTreeTest, BasicInputEventTarget) { const ViewId embed_view_id(wm_connection()->id(), 1); - EXPECT_EQ(ERROR_CODE_NONE, wm_connection()->CreateView(embed_view_id)); - EXPECT_TRUE(wm_connection()->SetViewVisibility(embed_view_id, true)); + EXPECT_EQ(ERROR_CODE_NONE, wm_connection()->NewWindow(embed_view_id)); + EXPECT_TRUE(wm_connection()->SetWindowVisibility(embed_view_id, true)); EXPECT_TRUE( - wm_connection()->AddView(*(wm_connection()->root()), embed_view_id)); + wm_connection()->AddWindow(*(wm_connection()->root()), embed_view_id)); host_connection()->view_tree_host()->root_view()->SetBounds( gfx::Rect(0, 0, 100, 100)); mojo::URLRequestPtr request(mojo::URLRequest::New()); @@ -432,13 +432,13 @@ TEST_F(ViewTreeTest, BasicInputEventTarget) { ->SetBounds(gfx::Rect(0, 0, 50, 50)); const ViewId child1(connection1->id(), 1); - EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); - EXPECT_TRUE(connection1->AddView(embed_view_id, child1)); + EXPECT_EQ(ERROR_CODE_NONE, connection1->NewWindow(child1)); + EXPECT_TRUE(connection1->AddWindow(embed_view_id, child1)); ServerView* v1 = connection1->GetView(child1); v1->SetVisible(true); v1->SetBounds(gfx::Rect(20, 20, 20, 20)); - TestViewTreeClient* embed_connection = last_view_tree_client(); + TestWindowTreeClient* embed_connection = last_window_tree_client(); embed_connection->tracker()->changes()->clear(); wm_client()->tracker()->changes()->clear(); diff --git a/components/mus/ws/window_manager_access_policy.cc b/components/mus/ws/window_manager_access_policy.cc index dccd059..d1a8553 100644 --- a/components/mus/ws/window_manager_access_policy.cc +++ b/components/mus/ws/window_manager_access_policy.cc @@ -19,28 +19,28 @@ WindowManagerAccessPolicy::WindowManagerAccessPolicy( WindowManagerAccessPolicy::~WindowManagerAccessPolicy() {} -bool WindowManagerAccessPolicy::CanRemoveViewFromParent( +bool WindowManagerAccessPolicy::CanRemoveWindowFromParent( const ServerView* view) const { return true; } -bool WindowManagerAccessPolicy::CanAddView(const ServerView* parent, - const ServerView* child) const { +bool WindowManagerAccessPolicy::CanAddWindow(const ServerView* parent, + const ServerView* child) const { return true; } -bool WindowManagerAccessPolicy::CanReorderView( +bool WindowManagerAccessPolicy::CanReorderWindow( const ServerView* view, const ServerView* relative_view, - mojo::OrderDirection direction) const { + mojom::OrderDirection direction) const { return true; } -bool WindowManagerAccessPolicy::CanDeleteView(const ServerView* view) const { +bool WindowManagerAccessPolicy::CanDeleteWindow(const ServerView* view) const { return view->id().connection_id == connection_id_; } -bool WindowManagerAccessPolicy::CanGetViewTree(const ServerView* view) const { +bool WindowManagerAccessPolicy::CanGetWindowTree(const ServerView* view) const { return true; } @@ -69,16 +69,17 @@ bool WindowManagerAccessPolicy::CanSetWindowSurfaceId( (delegate_->IsRootForAccessPolicy(view->id())); } -bool WindowManagerAccessPolicy::CanSetViewBounds(const ServerView* view) const { +bool WindowManagerAccessPolicy::CanSetWindowBounds( + const ServerView* view) const { return view->id().connection_id == connection_id_; } -bool WindowManagerAccessPolicy::CanSetViewProperties( +bool WindowManagerAccessPolicy::CanSetWindowProperties( const ServerView* view) const { return view->id().connection_id == connection_id_; } -bool WindowManagerAccessPolicy::CanSetViewTextInputState( +bool WindowManagerAccessPolicy::CanSetWindowTextInputState( const ServerView* view) const { return view->id().connection_id == connection_id_; } diff --git a/components/mus/ws/window_manager_access_policy.h b/components/mus/ws/window_manager_access_policy.h index 43ad20a..59ac1b6 100644 --- a/components/mus/ws/window_manager_access_policy.h +++ b/components/mus/ws/window_manager_access_policy.h @@ -19,21 +19,21 @@ class WindowManagerAccessPolicy : public AccessPolicy { ~WindowManagerAccessPolicy() override; // AccessPolicy: - bool CanRemoveViewFromParent(const ServerView* view) const override; - bool CanAddView(const ServerView* parent, - const ServerView* child) const override; - bool CanReorderView(const ServerView* view, - const ServerView* relative_view, - mojo::OrderDirection direction) const override; - bool CanDeleteView(const ServerView* view) const override; - bool CanGetViewTree(const ServerView* view) const override; + bool CanRemoveWindowFromParent(const ServerView* view) const override; + bool CanAddWindow(const ServerView* parent, + const ServerView* child) const override; + bool CanReorderWindow(const ServerView* view, + const ServerView* relative_view, + mojom::OrderDirection direction) const override; + bool CanDeleteWindow(const ServerView* view) const override; + bool CanGetWindowTree(const ServerView* view) const override; bool CanDescendIntoViewForViewTree(const ServerView* view) const override; bool CanEmbed(const ServerView* view, uint32_t policy_bitmask) const override; bool CanChangeViewVisibility(const ServerView* view) const override; bool CanSetWindowSurfaceId(const ServerView* view) const override; - bool CanSetViewBounds(const ServerView* view) const override; - bool CanSetViewProperties(const ServerView* view) const override; - bool CanSetViewTextInputState(const ServerView* view) const override; + bool CanSetWindowBounds(const ServerView* view) const override; + bool CanSetWindowProperties(const ServerView* view) const override; + bool CanSetWindowTextInputState(const ServerView* view) const override; bool CanSetFocus(const ServerView* view) const override; bool CanSetClientArea(const ServerView* window) const override; bool ShouldNotifyOnHierarchyChange( diff --git a/components/pdf_viewer/pdf_viewer.cc b/components/pdf_viewer/pdf_viewer.cc index b1c11c7..3dd8c6e 100644 --- a/components/pdf_viewer/pdf_viewer.cc +++ b/components/pdf_viewer/pdf_viewer.cc @@ -56,7 +56,7 @@ void LostContext(void*) { 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 { +class BitmapUploader : public mus::mojom::SurfaceClient { public: explicit BitmapUploader(mus::Window* view) : view_(view), @@ -84,7 +84,7 @@ class BitmapUploader : public mojo::SurfaceClient { nullptr, base::Bind(&OnGotContentHandlerID)); ConnectToService(gpu_service_provider.get(), &gpu_service_); - mojo::CommandBufferPtr gles2_client; + mus::mojom::CommandBufferPtr gles2_client; gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); gles2_context_ = MojoGLES2CreateContext( gles2_client.PassInterface().PassHandle().release().value(), @@ -123,12 +123,12 @@ class BitmapUploader : public mojo::SurfaceClient { private: void Upload() { gfx::Rect bounds(view_->bounds().To<gfx::Rect>()); - mojo::PassPtr pass = mojo::CreateDefaultPass(1, bounds); - mojo::CompositorFramePtr frame = mojo::CompositorFrame::New(); + mus::mojom::PassPtr pass = mojo::CreateDefaultPass(1, bounds); + mus::mojom::CompositorFramePtr frame = mus::mojom::CompositorFrame::New(); // TODO(rjkroege): Support device scale factor in PDF viewer - mojo::CompositorFrameMetadataPtr meta = - mojo::CompositorFrameMetadata::New(); + mus::mojom::CompositorFrameMetadataPtr meta = + mus::mojom::CompositorFrameMetadata::New(); meta->device_scale_factor = 1.0f; frame->metadata = meta.Pass(); @@ -159,15 +159,16 @@ class BitmapUploader : public mojo::SurfaceClient { glProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox); GLuint sync_point = glInsertSyncPointCHROMIUM(); - mojo::TransferableResourcePtr resource = - mojo::TransferableResource::New(); + mus::mojom::TransferableResourcePtr resource = + mus::mojom::TransferableResource::New(); resource->id = next_resource_id_++; resource_to_texture_id_map_[resource->id] = texture_id; - resource->format = mojo::RESOURCE_FORMAT_RGBA_8888; + resource->format = mus::mojom::RESOURCE_FORMAT_RGBA_8888; resource->filter = GL_LINEAR; resource->size = bitmap_size.Clone(); - mojo::MailboxHolderPtr mailbox_holder = mojo::MailboxHolder::New(); - mailbox_holder->mailbox = mojo::Mailbox::New(); + mus::mojom::MailboxHolderPtr mailbox_holder = + mus::mojom::MailboxHolder::New(); + mailbox_holder->mailbox = mus::mojom::Mailbox::New(); for (int i = 0; i < GL_MAILBOX_SIZE_CHROMIUM; ++i) mailbox_holder->mailbox->name.push_back(mailbox[i]); mailbox_holder->texture_target = GL_TEXTURE_2D; @@ -176,8 +177,8 @@ class BitmapUploader : public mojo::SurfaceClient { resource->is_repeated = false; resource->is_software = false; - mojo::QuadPtr quad = mojo::Quad::New(); - quad->material = mojo::MATERIAL_TEXTURE_CONTENT; + mus::mojom::QuadPtr quad = mus::mojom::Quad::New(); + quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT; mojo::RectPtr rect = mojo::Rect::New(); if (width_ <= bounds.width() && height_ <= bounds.height()) { @@ -202,14 +203,15 @@ class BitmapUploader : public mojo::SurfaceClient { quad->needs_blending = true; quad->shared_quad_state_index = 0u; - mojo::TextureQuadStatePtr texture_state = mojo::TextureQuadState::New(); + mus::mojom::TextureQuadStatePtr texture_state = + mus::mojom::TextureQuadState::New(); texture_state->resource_id = resource->id; texture_state->premultiplied_alpha = true; texture_state->uv_top_left = mojo::PointF::New(); texture_state->uv_bottom_right = mojo::PointF::New(); texture_state->uv_bottom_right->x = 1.f; texture_state->uv_bottom_right->y = 1.f; - texture_state->background_color = mojo::Color::New(); + texture_state->background_color = mus::mojom::Color::New(); texture_state->background_color->rgba = g_transparent_color; for (int i = 0; i < 4; ++i) texture_state->vertex_opacity.push_back(1.f); @@ -221,17 +223,17 @@ class BitmapUploader : public mojo::SurfaceClient { } if (color_ != g_transparent_color) { - mojo::QuadPtr quad = mojo::Quad::New(); - quad->material = mojo::MATERIAL_SOLID_COLOR; + mus::mojom::QuadPtr quad = mus::mojom::Quad::New(); + quad->material = mus::mojom::MATERIAL_SOLID_COLOR; quad->rect = mojo::Rect::From(bounds); quad->opaque_rect = mojo::Rect::New(); quad->visible_rect = mojo::Rect::From(bounds); quad->needs_blending = true; quad->shared_quad_state_index = 0u; - mojo::SolidColorQuadStatePtr color_state = - mojo::SolidColorQuadState::New(); - color_state->color = mojo::Color::New(); + mus::mojom::SolidColorQuadStatePtr color_state = + mus::mojom::SolidColorQuadState::New(); + color_state->color = mus::mojom::Color::New(); color_state->color->rgba = color_; color_state->force_anti_aliasing_off = false; @@ -275,11 +277,11 @@ class BitmapUploader : public mojo::SurfaceClient { // SurfaceClient implementation. void ReturnResources( - mojo::Array<mojo::ReturnedResourcePtr> resources) override { + mojo::Array<mus::mojom::ReturnedResourcePtr> resources) override { MojoGLES2MakeCurrent(gles2_context_); // TODO(jamesr): Recycle. for (size_t i = 0; i < resources.size(); ++i) { - mojo::ReturnedResourcePtr resource = resources[i].Pass(); + mus::mojom::ReturnedResourcePtr resource = resources[i].Pass(); DCHECK_EQ(1, resource->count); glWaitSyncPointCHROMIUM(resource->sync_point); uint32_t texture_id = resource_to_texture_id_map_[resource->id]; @@ -290,7 +292,7 @@ class BitmapUploader : public mojo::SurfaceClient { } mus::Window* view_; - mojo::GpuPtr gpu_service_; + mus::mojom::GpuPtr gpu_service_; scoped_ptr<mus::WindowSurface> surface_; MojoGLES2Context gles2_context_; @@ -304,7 +306,7 @@ class BitmapUploader : public mojo::SurfaceClient { uint32_t id_namespace_; uint32_t local_id_; base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; - mojo::Binding<mojo::SurfaceClient> returner_binding_; + mojo::Binding<mus::mojom::SurfaceClient> returner_binding_; DISALLOW_COPY_AND_ASSIGN(BitmapUploader); }; @@ -327,7 +329,7 @@ class EmbedderData { class PDFView : public mojo::ApplicationDelegate, public mus::WindowTreeDelegate, public mus::WindowObserver, - public mojo::InterfaceFactory<mojo::ViewTreeClient> { + public mojo::InterfaceFactory<mus::mojom::WindowTreeClient> { public: PDFView(mojo::InterfaceRequest<mojo::Application> request, mojo::URLResponsePtr response) @@ -350,7 +352,7 @@ class PDFView : public mojo::ApplicationDelegate, // Overridden from ApplicationDelegate: bool ConfigureIncomingConnection( mojo::ApplicationConnection* connection) override { - connection->AddService<mojo::ViewTreeClient>(this); + connection->AddService<mus::mojom::WindowTreeClient>(this); return true; } @@ -411,10 +413,10 @@ class PDFView : public mojo::ApplicationDelegate, app_.Quit(); } - // Overridden from mojo::InterfaceFactory<mojo::ViewTreeClient>: + // Overridden from mojo::InterfaceFactory<mus::mojom::WindowTreeClient>: void Create( mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) override { + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override { mus::WindowTreeConnection::Create( this, request.Pass(), mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); diff --git a/components/web_view/frame.cc b/components/web_view/frame.cc index 9cc9163..4bb1e21 100644 --- a/components/web_view/frame.cc +++ b/components/web_view/frame.cc @@ -95,7 +95,7 @@ Frame::~Frame() { } void Frame::Init(Frame* parent, - mojo::ViewTreeClientPtr view_tree_client, + mus::mojom::WindowTreeClientPtr window_tree_client, mojo::InterfaceRequest<mojom::Frame> frame_request, base::TimeTicks navigation_start_time) { { @@ -110,7 +110,7 @@ void Frame::Init(Frame* parent, const ClientType client_type = frame_request.is_pending() ? ClientType::NEW_CHILD_FRAME : ClientType::EXISTING_FRAME_NEW_APP; - InitClient(client_type, nullptr, view_tree_client.Pass(), + InitClient(client_type, nullptr, window_tree_client.Pass(), frame_request.Pass(), navigation_start_time); tree_->delegate_->DidCreateFrame(this); @@ -190,21 +190,22 @@ void Frame::StopHighlightingFindResults() { void Frame::InitClient(ClientType client_type, scoped_ptr<FrameUserDataAndBinding> data_and_binding, - mojo::ViewTreeClientPtr view_tree_client, + mus::mojom::WindowTreeClientPtr window_tree_client, mojo::InterfaceRequest<mojom::Frame> frame_request, base::TimeTicks navigation_start_time) { if (client_type == ClientType::EXISTING_FRAME_NEW_APP && - view_tree_client.get()) { + window_tree_client.get()) { embedded_connection_id_ = kInvalidConnectionId; embed_weak_ptr_factory_.InvalidateWeakPtrs(); view_->Embed( - view_tree_client.Pass(), mojo::ViewTree::ACCESS_POLICY_DEFAULT, + window_tree_client.Pass(), + mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT, base::Bind(&Frame::OnEmbedAck, embed_weak_ptr_factory_.GetWeakPtr())); } if (client_type == ClientType::NEW_CHILD_FRAME) { // Don't install an error handler. We allow for the target to only - // implement ViewTreeClient. + // implement WindowTreeClient. // This frame (and client) was created by an existing FrameClient. There // is no need to send it OnConnect(). frame_binding_.reset( @@ -224,7 +225,7 @@ void Frame::InitClient(ClientType client_type, mojom::FramePtr frame_ptr; // Don't install an error handler. We allow for the target to only - // implement ViewTreeClient. + // implement WindowTreeClient. frame_binding_.reset( new mojo::Binding<mojom::Frame>(this, GetProxy(&frame_ptr).Pass())); frame_client_->OnConnect( @@ -250,13 +251,13 @@ void Frame::OnConnectAck(scoped_ptr<FrameUserDataAndBinding> data_and_binding) { void Frame::ChangeClient(mojom::FrameClient* frame_client, scoped_ptr<FrameUserData> user_data, - mojo::ViewTreeClientPtr view_tree_client, + mus::mojom::WindowTreeClientPtr window_tree_client, uint32_t app_id, base::TimeTicks navigation_start_time) { while (!children_.empty()) delete children_[0]; - ClientType client_type = view_tree_client.get() == nullptr + ClientType client_type = window_tree_client.get() == nullptr ? ClientType::EXISTING_FRAME_SAME_APP : ClientType::EXISTING_FRAME_NEW_APP; scoped_ptr<FrameUserDataAndBinding> data_and_binding; @@ -276,7 +277,7 @@ void Frame::ChangeClient(mojom::FrameClient* frame_client, frame_binding_.reset(); app_id_ = app_id; - InitClient(client_type, data_and_binding.Pass(), view_tree_client.Pass(), + InitClient(client_type, data_and_binding.Pass(), window_tree_client.Pass(), nullptr, navigation_start_time); } @@ -287,16 +288,17 @@ void Frame::OnEmbedAck(bool success, mus::ConnectionSpecificId connection_id) { frame_binding_->ResumeIncomingMethodCallProcessing(); } -void Frame::OnWillNavigateAck(mojom::FrameClient* frame_client, - scoped_ptr<FrameUserData> user_data, - mojo::ViewTreeClientPtr view_tree_client, - uint32 app_id, - base::TimeTicks navigation_start_time) { +void Frame::OnWillNavigateAck( + mojom::FrameClient* frame_client, + scoped_ptr<FrameUserData> user_data, + mus::mojom::WindowTreeClientPtr window_tree_client, + uint32 app_id, + base::TimeTicks navigation_start_time) { DCHECK(waiting_for_on_will_navigate_ack_); DVLOG(2) << "Frame::OnWillNavigateAck id=" << id_; waiting_for_on_will_navigate_ack_ = false; - ChangeClient(frame_client, user_data.Pass(), view_tree_client.Pass(), app_id, - navigation_start_time); + ChangeClient(frame_client, user_data.Pass(), window_tree_client.Pass(), + app_id, navigation_start_time); if (pending_navigate_.get()) StartNavigate(pending_navigate_.Pass()); } @@ -367,30 +369,32 @@ void Frame::StartNavigate(mojo::URLRequestPtr request) { requested_url, navigation_start_time)); } -void Frame::OnCanNavigateFrame(const GURL& url, - base::TimeTicks navigation_start_time, - uint32_t app_id, - mojom::FrameClient* frame_client, - scoped_ptr<FrameUserData> user_data, - mojo::ViewTreeClientPtr view_tree_client) { +void Frame::OnCanNavigateFrame( + const GURL& url, + base::TimeTicks navigation_start_time, + uint32_t app_id, + mojom::FrameClient* frame_client, + scoped_ptr<FrameUserData> user_data, + mus::mojom::WindowTreeClientPtr window_tree_client) { DVLOG(2) << "Frame::OnCanNavigateFrame id=" << id_ << " equal=" << (AreAppIdsEqual(app_id, app_id_) ? "true" : "false"); if (AreAppIdsEqual(app_id, app_id_)) { // The app currently rendering the frame will continue rendering it. In this - // case we do not use the ViewTreeClient (because the app has a View already + // case we do not use the WindowTreeClient (because the app has a View + // already // and ends up reusing it). - DCHECK(!view_tree_client.get()); - ChangeClient(frame_client, user_data.Pass(), view_tree_client.Pass(), + DCHECK(!window_tree_client.get()); + ChangeClient(frame_client, user_data.Pass(), window_tree_client.Pass(), app_id, navigation_start_time); } else { waiting_for_on_will_navigate_ack_ = true; - DCHECK(view_tree_client.get()); + DCHECK(window_tree_client.get()); // TODO(sky): url isn't correct here, it should be a security origin. frame_client_->OnWillNavigate( url.spec(), base::Bind(&Frame::OnWillNavigateAck, base::Unretained(this), frame_client, base::Passed(&user_data), - base::Passed(&view_tree_client), app_id, + base::Passed(&window_tree_client), app_id, navigation_start_time)); } } diff --git a/components/web_view/frame.h b/components/web_view/frame.h index 38e1078..7b6a96a 100644 --- a/components/web_view/frame.h +++ b/components/web_view/frame.h @@ -47,7 +47,7 @@ enum class ViewOwnership { // (|app_id|). This id is used when servicing a request to navigate the frame. // When navigating, if the id of the new app matches that of the existing app, // then it is expected that the new FrameClient will take over rendering to the -// existing view. Because of this a new ViewTreeClient is not obtained and +// existing view. Because of this a new WindowTreeClient is not obtained and // Embed() is not invoked on the View. The FrameClient can detect this case 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 @@ -68,7 +68,7 @@ class Frame : public mus::WindowObserver, public mojom::Frame { ~Frame() override; void Init(Frame* parent, - mojo::ViewTreeClientPtr view_tree_client, + mus::mojom::WindowTreeClientPtr window_tree_client, mojo::InterfaceRequest<mojom::Frame> frame_request, base::TimeTicks navigation_start_time); @@ -159,7 +159,7 @@ class Frame : public mus::WindowObserver, public mojom::Frame { // (and assume the frame is being torn down) before the OnConnect(). void InitClient(ClientType client_type, scoped_ptr<FrameUserDataAndBinding> data_and_binding, - mojo::ViewTreeClientPtr view_tree_client, + mus::mojom::WindowTreeClientPtr window_tree_client, mojo::InterfaceRequest<mojom::Frame> frame_request, base::TimeTicks navigation_start_time); @@ -175,7 +175,7 @@ class Frame : public mus::WindowObserver, public mojom::Frame { // Callback from Frame::OnWillNavigate(). Completes navigation. void OnWillNavigateAck(mojom::FrameClient* frame_client, scoped_ptr<FrameUserData> user_data, - mojo::ViewTreeClientPtr view_tree_client, + mus::mojom::WindowTreeClientPtr window_tree_client, uint32 app_id, base::TimeTicks navigation_start_time); @@ -183,7 +183,7 @@ class Frame : public mus::WindowObserver, public mojom::Frame { // supplied arguments. void ChangeClient(mojom::FrameClient* frame_client, scoped_ptr<FrameUserData> user_data, - mojo::ViewTreeClientPtr view_tree_client, + mus::mojom::WindowTreeClientPtr window_tree_client, uint32 app_id, base::TimeTicks navigation_start_time); @@ -205,7 +205,7 @@ class Frame : public mus::WindowObserver, public mojom::Frame { uint32_t app_id, mojom::FrameClient* frame_client, scoped_ptr<FrameUserData> user_data, - mojo::ViewTreeClientPtr view_tree_client); + mus::mojom::WindowTreeClientPtr window_tree_client); // Notifies the client and all descendants as appropriate. void NotifyAdded(const Frame* source, @@ -257,7 +257,7 @@ class Frame : public mus::WindowObserver, public mojom::Frame { mus::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 FrameClient and ViewTreeClient. + // ID of the app providing the FrameClient and WindowTreeClient. uint32_t app_id_; Frame* parent_; ViewOwnership view_ownership_; diff --git a/components/web_view/frame_apptest.cc b/components/web_view/frame_apptest.cc index a8f0bb8..2b32946 100644 --- a/components/web_view/frame_apptest.cc +++ b/components/web_view/frame_apptest.cc @@ -285,7 +285,7 @@ class ViewAndFrame : public mus::WindowTreeDelegate { class FrameTest : public mojo::test::ApplicationTestBase, public mojo::ApplicationDelegate, public mus::WindowTreeDelegate, - public mojo::InterfaceFactory<mojo::ViewTreeClient>, + public mojo::InterfaceFactory<mus::mojom::WindowTreeClient>, public mojo::InterfaceFactory<mojom::FrameClient> { public: FrameTest() : most_recent_connection_(nullptr), window_manager_(nullptr) {} @@ -353,7 +353,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, // ApplicationDelegate implementation. bool ConfigureIncomingConnection( mojo::ApplicationConnection* connection) override { - connection->AddService<mojo::ViewTreeClient>(this); + connection->AddService<mus::mojom::WindowTreeClient>(this); connection->AddService<mojom::FrameClient>(this); return true; } @@ -380,8 +380,8 @@ class FrameTest : public mojo::test::ApplicationTestBase, scoped_ptr<FrameConnection> frame_connection = CreateFrameConnection(application_impl()); mojom::FrameClient* frame_client = frame_connection->frame_client(); - mojo::ViewTreeClientPtr view_tree_client = - frame_connection->GetViewTreeClient(); + mus::mojom::WindowTreeClientPtr view_tree_client = + frame_connection->GetWindowTreeClient(); mus::Window* frame_root_view = window_manager()->CreateWindow(); window_manager()->GetRoot()->AddChild(frame_root_view); frame_tree_.reset(new FrameTree( @@ -399,10 +399,10 @@ class FrameTest : public mojo::test::ApplicationTestBase, ApplicationTestBase::TearDown(); } - // Overridden from mojo::InterfaceFactory<mojo::ViewTreeClient>: + // Overridden from mojo::InterfaceFactory<mus::mojom::WindowTreeClient>: void Create( mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ViewTreeClient> request) override { + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override { if (view_and_frame_) { mus::WindowTreeConnection::Create( view_and_frame_.get(), request.Pass(), @@ -425,7 +425,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, scoped_ptr<FrameTree> frame_tree_; scoped_ptr<ViewAndFrame> root_view_and_frame_; - mojo::ViewTreeHostPtr host_; + mus::mojom::WindowTreeHostPtr host_; // Used to receive the most recent view manager loaded by an embed action. WindowTreeConnection* most_recent_connection_; diff --git a/components/web_view/frame_connection.cc b/components/web_view/frame_connection.cc index ec2fde7..fd7ac76 100644 --- a/components/web_view/frame_connection.cc +++ b/components/web_view/frame_connection.cc @@ -8,7 +8,7 @@ #include "base/callback.h" #include "components/clipboard/public/interfaces/clipboard.mojom.h" #include "components/mus/public/interfaces/gpu.mojom.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/resource_provider/public/interfaces/resource_provider.mojom.h" #include "components/web_view/frame_tree.h" #include "components/web_view/frame_utils.h" @@ -33,15 +33,15 @@ void OnGotContentHandlerForFrame( const uint32_t existing_content_handler_id, const FrameTreeDelegate::CanNavigateFrameCallback& callback, scoped_ptr<FrameConnection> connection) { - mojo::ViewTreeClientPtr view_tree_client; + mus::mojom::WindowTreeClientPtr window_tree_client; if (!AreAppIdsEqual(existing_content_handler_id, connection->GetContentHandlerID())) { - view_tree_client = connection->GetViewTreeClient(); + window_tree_client = connection->GetWindowTreeClient(); } FrameConnection* connection_ptr = connection.get(); callback.Run(connection_ptr->GetContentHandlerID(), connection_ptr->frame_client(), connection.Pass(), - view_tree_client.Pass()); + window_tree_client.Pass()); } } // namespace @@ -94,8 +94,8 @@ void FrameConnection::Init(mojo::ApplicationImpl* app, filter->filter.insert("mojo:tracing", tracing_interfaces.Pass()); mojo::Array<mojo::String> view_manager_interfaces; - view_manager_interfaces.push_back(mojo::Gpu::Name_); - view_manager_interfaces.push_back(mojo::ViewTreeHostFactory::Name_); + view_manager_interfaces.push_back(mus::mojom::Gpu::Name_); + view_manager_interfaces.push_back(mus::mojom::WindowTreeHostFactory::Name_); filter->filter.insert("mojo:mus", view_manager_interfaces.Pass()); mojo::Array<mojo::String> test_runner_interfaces; @@ -115,11 +115,11 @@ void FrameConnection::Init(mojo::ApplicationImpl* app, application_connection_->AddContentHandlerIDCallback(on_got_id_callback); } -mojo::ViewTreeClientPtr FrameConnection::GetViewTreeClient() { +mus::mojom::WindowTreeClientPtr FrameConnection::GetWindowTreeClient() { DCHECK(application_connection_); - mojo::ViewTreeClientPtr view_tree_client; - application_connection_->ConnectToService(&view_tree_client); - return view_tree_client.Pass(); + mus::mojom::WindowTreeClientPtr window_tree_client; + application_connection_->ConnectToService(&window_tree_client); + return window_tree_client.Pass(); } uint32_t FrameConnection::GetContentHandlerID() const { diff --git a/components/web_view/frame_connection.h b/components/web_view/frame_connection.h index 2a1d29e..1d52fb0 100644 --- a/components/web_view/frame_connection.h +++ b/components/web_view/frame_connection.h @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "base/callback.h" #include "base/memory/scoped_ptr.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/web_view/frame_tree_delegate.h" #include "components/web_view/frame_user_data.h" #include "components/web_view/public/interfaces/frame.mojom.h" @@ -53,8 +53,8 @@ class FrameConnection : public FrameUserData { return application_connection_.get(); } - // Asks the remote application for a ViewTreeClient. - mojo::ViewTreeClientPtr GetViewTreeClient(); + // Asks the remote application for a WindowTreeClient. + mus::mojom::WindowTreeClientPtr GetWindowTreeClient(); // Returns the id of the content handler app. Only available once the callback // has run. diff --git a/components/web_view/frame_tree.cc b/components/web_view/frame_tree.cc index 7132739..a96436d 100644 --- a/components/web_view/frame_tree.cc +++ b/components/web_view/frame_tree.cc @@ -11,7 +11,7 @@ namespace web_view { FrameTree::FrameTree(uint32_t root_app_id, mus::Window* view, - mojo::ViewTreeClientPtr view_tree_client, + mus::mojom::WindowTreeClientPtr view_tree_client, FrameTreeDelegate* delegate, mojom::FrameClient* root_client, scoped_ptr<FrameUserData> user_data, diff --git a/components/web_view/frame_tree.h b/components/web_view/frame_tree.h index f252ceb..edf9639 100644 --- a/components/web_view/frame_tree.h +++ b/components/web_view/frame_tree.h @@ -6,7 +6,7 @@ #define COMPONENTS_WEB_VIEW_FRAME_TREE_H_ #include "base/time/time.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/web_view/frame.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" #include "url/gurl.h" @@ -38,7 +38,7 @@ class FrameTree { // See Frame for details on app id's. FrameTree(uint32_t root_app_id, mus::Window* view, - mojo::ViewTreeClientPtr view_tree_client, + mus::mojom::WindowTreeClientPtr view_tree_client, FrameTreeDelegate* delegate, mojom::FrameClient* root_client, scoped_ptr<FrameUserData> user_data, diff --git a/components/web_view/frame_tree_delegate.h b/components/web_view/frame_tree_delegate.h index 55be561..7743828 100644 --- a/components/web_view/frame_tree_delegate.h +++ b/components/web_view/frame_tree_delegate.h @@ -9,7 +9,7 @@ #include "base/callback_forward.h" #include "base/memory/scoped_ptr.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/web_view/public/interfaces/frame.mojom.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h" #include "url/gurl.h" @@ -31,7 +31,7 @@ class FrameTreeDelegate { base::Callback<void(uint32_t, mojom::FrameClient*, scoped_ptr<FrameUserData>, - mojo::ViewTreeClientPtr)>; + mus::mojom::WindowTreeClientPtr)>; // Called when a Frame creates a new child Frame. |frame_tree_client| is the // FrameClient for the new frame. @@ -59,7 +59,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 + // mus::mojom::WindowTreeClientPtr 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 51fd1d6..3e63ed4 100644 --- a/components/web_view/public/cpp/web_view.cc +++ b/components/web_view/public/cpp/web_view.cc @@ -33,10 +33,11 @@ void WebView::Init(mojo::ApplicationImpl* app, mus::Window* window) { app->ConnectToService(request.Pass(), &factory); factory->CreateWebView(client.Pass(), GetProxy(&web_view_)); - mojo::ViewTreeClientPtr view_tree_client; - web_view_->GetViewTreeClient(GetProxy(&view_tree_client)); + mus::mojom::WindowTreeClientPtr view_tree_client; + web_view_->GetWindowTreeClient(GetProxy(&view_tree_client)); window->Embed(view_tree_client.Pass(), - mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT, base::Bind(&OnEmbed)); + mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, + base::Bind(&OnEmbed)); } } // namespace web_view diff --git a/components/web_view/public/interfaces/web_view.mojom b/components/web_view/public/interfaces/web_view.mojom index ab95c66..24deb90 100644 --- a/components/web_view/public/interfaces/web_view.mojom +++ b/components/web_view/public/interfaces/web_view.mojom @@ -4,7 +4,7 @@ module web_view.mojom; -import "components/mus/public/interfaces/view_tree.mojom"; +import "components/mus/public/interfaces/window_tree.mojom"; import "network/public/interfaces/url_loader.mojom"; enum ButtonState { @@ -40,8 +40,8 @@ interface WebView { // Navigate the top level frame to |request|. LoadRequest(mojo.URLRequest request); - // Provide a ViewTreeClient for this specific WebView. - GetViewTreeClient(mojo.ViewTreeClient& view_tree_client); + // Provide a WindowTreeClient for this specific WebView. + GetWindowTreeClient(mus.mojom.WindowTreeClient& window_tree_client); // Finds a string in page. Find(string search_text, bool forward_direction); 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 6299580..5867ffe 100644 --- a/components/web_view/test_runner/test_runner_application_delegate.h +++ b/components/web_view/test_runner/test_runner_application_delegate.h @@ -8,7 +8,7 @@ #include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "components/mus/public/cpp/window_tree_delegate.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/test_runner/test_info_extractor.h" #include "components/web_view/public/cpp/web_view.h" #include "components/web_view/public/interfaces/web_view.mojom.h" @@ -19,10 +19,6 @@ class GURL; -namespace mojo { -class View; -} - namespace web_view { class TestRunnerApplicationDelegate @@ -69,7 +65,7 @@ class TestRunnerApplicationDelegate mojo::InterfaceRequest<LayoutTestRunner> request) override; mojo::ApplicationImpl* app_; - mojo::ViewTreeHostPtr host_; + mus::mojom::WindowTreeHostPtr host_; mus::Window* root_; mus::Window* content_; diff --git a/components/web_view/web_view_impl.cc b/components/web_view/web_view_impl.cc index b590e0f..24f771f 100644 --- a/components/web_view/web_view_impl.cc +++ b/components/web_view/web_view_impl.cc @@ -84,8 +84,8 @@ void WebViewImpl::OnLoad(const GURL& pending_url) { scoped_ptr<PendingWebViewLoad> pending_load(pending_load_.Pass()); scoped_ptr<FrameConnection> frame_connection( pending_load->frame_connection()); - mojo::ViewTreeClientPtr view_tree_client = - frame_connection->GetViewTreeClient(); + mus::mojom::WindowTreeClientPtr window_tree_client = + frame_connection->GetWindowTreeClient(); Frame::ClientPropertyMap client_properties; if (devtools_agent_) { @@ -98,7 +98,7 @@ void WebViewImpl::OnLoad(const GURL& pending_url) { mojom::FrameClient* frame_client = frame_connection->frame_client(); const uint32_t content_handler_id = frame_connection->GetContentHandlerID(); frame_tree_.reset(new FrameTree(content_handler_id, content_, - view_tree_client.Pass(), this, frame_client, + window_tree_client.Pass(), this, frame_client, frame_connection.Pass(), client_properties, pending_load->navigation_start_time())); } @@ -117,10 +117,10 @@ void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) { navigation_controller_.LoadURL(request.Pass()); } -void WebViewImpl::GetViewTreeClient( - mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) { +void WebViewImpl::GetWindowTreeClient( + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> window_tree_client) { mus::WindowTreeConnection::Create( - this, view_tree_client.Pass(), + this, window_tree_client.Pass(), mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } diff --git a/components/web_view/web_view_impl.h b/components/web_view/web_view_impl.h index 1e2125e..6effe10 100644 --- a/components/web_view/web_view_impl.h +++ b/components/web_view/web_view_impl.h @@ -62,9 +62,8 @@ class WebViewImpl : public mojom::WebView, // Overridden from WebView: void LoadRequest(mojo::URLRequestPtr request) override; - void GetViewTreeClient( - mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) - override; + void GetWindowTreeClient(mojo::InterfaceRequest<mus::mojom::WindowTreeClient> + window_tree_client) override; void Find(const mojo::String& search_text, bool forward_direction) override; void StopFinding() override; void GoBack() override; diff --git a/mandoline/ui/desktop_ui/browser_manager.h b/mandoline/ui/desktop_ui/browser_manager.h index 1d55787..88ed3fa 100644 --- a/mandoline/ui/desktop_ui/browser_manager.h +++ b/mandoline/ui/desktop_ui/browser_manager.h @@ -7,7 +7,7 @@ #include <set> -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h" #include "mojo/application/public/cpp/application_delegate.h" #include "mojo/application/public/cpp/application_impl.h" @@ -53,7 +53,7 @@ class BrowserManager : public mojo::ApplicationDelegate, mojo::InterfaceRequest<LaunchHandler> request) override; mojo::ApplicationImpl* app_; - mojo::ViewTreeHostFactoryPtr host_factory_; + mus::mojom::WindowTreeHostFactoryPtr host_factory_; mojo::WeakBindingSet<LaunchHandler> launch_handler_bindings_; std::set<BrowserWindow*> browsers_; base::Time startup_time_; diff --git a/mandoline/ui/desktop_ui/browser_window.cc b/mandoline/ui/desktop_ui/browser_window.cc index 363320e..3fe21a7 100644 --- a/mandoline/ui/desktop_ui/browser_window.cc +++ b/mandoline/ui/desktop_ui/browser_window.cc @@ -68,7 +68,7 @@ class ProgressView : public views::View { // BrowserWindow, public: BrowserWindow::BrowserWindow(mojo::ApplicationImpl* app, - mojo::ViewTreeHostFactory* host_factory, + mus::mojom::WindowTreeHostFactory* host_factory, BrowserManager* manager) : app_(app), host_client_binding_(this), @@ -82,7 +82,7 @@ BrowserWindow::BrowserWindow(mojo::ApplicationImpl* app, find_active_(0), find_count_(0), web_view_(this) { - mojo::ViewTreeHostClientPtr host_client; + mus::mojom::WindowTreeHostClientPtr host_client; host_client_binding_.Bind(GetProxy(&host_client)); mus::CreateWindowTreeHost(host_factory, host_client.Pass(), this, &host_); } @@ -403,8 +403,8 @@ void BrowserWindow::Init(mus::Window* root) { } void BrowserWindow::EmbedOmnibox() { - mojo::ViewTreeClientPtr view_tree_client; - omnibox_->GetViewTreeClient(GetProxy(&view_tree_client)); + mus::mojom::WindowTreeClientPtr view_tree_client; + omnibox_->GetWindowTreeClient(GetProxy(&view_tree_client)); omnibox_view_->Embed(view_tree_client.Pass()); // TODO(beng): This should be handled sufficiently by diff --git a/mandoline/ui/desktop_ui/browser_window.h b/mandoline/ui/desktop_ui/browser_window.h index 2824c42..c3606fe 100644 --- a/mandoline/ui/desktop_ui/browser_window.h +++ b/mandoline/ui/desktop_ui/browser_window.h @@ -7,7 +7,7 @@ #include "components/mus/public/cpp/window_tree_connection.h" #include "components/mus/public/cpp/window_tree_delegate.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/web_view/public/cpp/web_view.h" #include "components/web_view/public/interfaces/web_view.mojom.h" #include "mandoline/ui/desktop_ui/find_bar_delegate.h" @@ -22,7 +22,6 @@ namespace mojo { class ApplicationConnection; class Shell; -class View; } namespace mandoline { @@ -33,7 +32,7 @@ class ProgressView; class ToolbarView; class BrowserWindow : public mus::WindowTreeDelegate, - public mojo::ViewTreeHostClient, + public mus::mojom::WindowTreeHostClient, public web_view::mojom::WebViewClient, public ViewEmbedder, public mojo::InterfaceFactory<ViewEmbedder>, @@ -41,7 +40,7 @@ class BrowserWindow : public mus::WindowTreeDelegate, public FindBarDelegate { public: BrowserWindow(mojo::ApplicationImpl* app, - mojo::ViewTreeHostFactory* host_factory, + mus::mojom::WindowTreeHostFactory* host_factory, BrowserManager* manager); void LoadURL(const GURL& url); @@ -61,7 +60,7 @@ class BrowserWindow : public mus::WindowTreeDelegate, void OnEmbed(mus::Window* root) override; void OnConnectionLost(mus::WindowTreeConnection* connection) override; - // Overridden from ViewTreeHostClient: + // Overridden from WindowTreeHostClient: void OnAccelerator(uint32_t id, mojo::EventPtr event) override; // Overridden from web_view::mojom::WebViewClient: @@ -98,8 +97,8 @@ class BrowserWindow : public mus::WindowTreeDelegate, mojo::ApplicationImpl* app_; scoped_ptr<views::AuraInit> aura_init_; - mojo::ViewTreeHostPtr host_; - mojo::Binding<ViewTreeHostClient> host_client_binding_; + mus::mojom::WindowTreeHostPtr host_; + mojo::Binding<WindowTreeHostClient> host_client_binding_; BrowserManager* manager_; ToolbarView* toolbar_view_; ProgressView* progress_bar_; diff --git a/mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom b/mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom index 74a15a3..f3bb2e5 100644 --- a/mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom +++ b/mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom @@ -4,12 +4,12 @@ module mandoline; -import "components/mus/public/interfaces/view_tree.mojom"; +import "components/mus/public/interfaces/window_tree.mojom"; // TODO(beng): Could this be generalized as a "Chooser" with a specific type?? // Interface implemented by an application providing a method for URL input. interface Omnibox { - GetViewTreeClient(mojo.ViewTreeClient& client); + GetWindowTreeClient(mus.mojom.WindowTreeClient& client); ShowForURL(string url); }; diff --git a/mandoline/ui/omnibox/omnibox_application.cc b/mandoline/ui/omnibox/omnibox_application.cc index 3c5491d..a6082c7 100644 --- a/mandoline/ui/omnibox/omnibox_application.cc +++ b/mandoline/ui/omnibox/omnibox_application.cc @@ -51,8 +51,8 @@ class OmniboxImpl : public mus::WindowTreeDelegate, const ui::KeyEvent& key_event) override; // Overridden from Omnibox: - void GetViewTreeClient( - mojo::InterfaceRequest<mojo::ViewTreeClient> request) override; + void GetWindowTreeClient( + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override; void ShowForURL(const mojo::String& url) override; void HideWindow(); @@ -189,8 +189,8 @@ bool OmniboxImpl::HandleKeyEvent(views::Textfield* sender, //////////////////////////////////////////////////////////////////////////////// // OmniboxImpl, Omnibox implementation: -void OmniboxImpl::GetViewTreeClient( - mojo::InterfaceRequest<mojo::ViewTreeClient> request) { +void OmniboxImpl::GetWindowTreeClient( + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) { mus::WindowTreeConnection::Create( this, request.Pass(), mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); diff --git a/mandoline/ui/phone_ui/phone_browser_application_delegate.h b/mandoline/ui/phone_ui/phone_browser_application_delegate.h index e21c225..a66f4cf 100644 --- a/mandoline/ui/phone_ui/phone_browser_application_delegate.h +++ b/mandoline/ui/phone_ui/phone_browser_application_delegate.h @@ -9,7 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "components/mus/public/cpp/window_observer.h" #include "components/mus/public/cpp/window_tree_delegate.h" -#include "components/mus/public/interfaces/view_tree_host.mojom.h" +#include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/web_view/public/cpp/web_view.h" #include "components/web_view/public/interfaces/web_view.mojom.h" // TODO(beng): move this file somewhere common. @@ -71,7 +71,7 @@ class PhoneBrowserApplicationDelegate mojo::InterfaceRequest<LaunchHandler> request) override; mojo::ApplicationImpl* app_; - mojo::ViewTreeHostPtr host_; + mus::mojom::WindowTreeHostPtr host_; mus::Window* root_; mus::Window* content_; diff --git a/mojo/converters/surfaces/custom_surface_converter.h b/mojo/converters/surfaces/custom_surface_converter.h index 9f03835..af47e12 100644 --- a/mojo/converters/surfaces/custom_surface_converter.h +++ b/mojo/converters/surfaces/custom_surface_converter.h @@ -17,8 +17,8 @@ namespace mojo { class CustomSurfaceConverter { public: virtual bool ConvertSurfaceDrawQuad( - const QuadPtr& input, - const CompositorFrameMetadataPtr& metadata, + const mus::mojom::QuadPtr& input, + const mus::mojom::CompositorFrameMetadataPtr& metadata, cc::SharedQuadState* sqs, cc::RenderPass* render_pass) = 0; diff --git a/mojo/converters/surfaces/surfaces_type_converters.cc b/mojo/converters/surfaces/surfaces_type_converters.cc index f14bdb5..5f2f25d 100644 --- a/mojo/converters/surfaces/surfaces_type_converters.cc +++ b/mojo/converters/surfaces/surfaces_type_converters.cc @@ -23,11 +23,52 @@ #include "mojo/converters/surfaces/custom_surface_converter.h" #include "mojo/converters/transform/transform_type_converters.h" +using mus::mojom::Color; +using mus::mojom::ColorPtr; +using mus::mojom::CompositorFrame; +using mus::mojom::CompositorFramePtr; +using mus::mojom::CompositorFrameMetadata; +using mus::mojom::CompositorFrameMetadataPtr; +using mus::mojom::DebugBorderQuadState; +using mus::mojom::DebugBorderQuadStatePtr; +using mus::mojom::Mailbox; +using mus::mojom::MailboxPtr; +using mus::mojom::MailboxHolder; +using mus::mojom::MailboxHolderPtr; +using mus::mojom::Pass; +using mus::mojom::PassPtr; +using mus::mojom::Quad; +using mus::mojom::QuadPtr; +using mus::mojom::RenderPassId; +using mus::mojom::RenderPassIdPtr; +using mus::mojom::RenderPassQuadState; +using mus::mojom::RenderPassQuadStatePtr; +using mus::mojom::ResourceFormat; +using mus::mojom::ReturnedResource; +using mus::mojom::ReturnedResourcePtr; +using mus::mojom::SharedQuadState; +using mus::mojom::SharedQuadStatePtr; +using mus::mojom::SolidColorQuadState; +using mus::mojom::SolidColorQuadStatePtr; +using mus::mojom::SurfaceId; +using mus::mojom::SurfaceIdPtr; +using mus::mojom::SurfaceQuadState; +using mus::mojom::SurfaceQuadStatePtr; +using mus::mojom::TextureQuadState; +using mus::mojom::TextureQuadStatePtr; +using mus::mojom::TileQuadState; +using mus::mojom::TileQuadStatePtr; +using mus::mojom::TransferableResource; +using mus::mojom::TransferableResourcePtr; +using mus::mojom::YUVColorSpace; +using mus::mojom::YUVVideoQuadState; +using mus::mojom::YUVVideoQuadStatePtr; + namespace mojo { #define ASSERT_ENUM_VALUES_EQUAL(value) \ COMPILE_ASSERT(cc::DrawQuad::value == static_cast<cc::DrawQuad::Material>( \ - MATERIAL_##value), \ + mus::mojom::MATERIAL_##value), \ value##_enum_value_matches) ASSERT_ENUM_VALUES_EQUAL(DEBUG_BORDER); @@ -41,17 +82,18 @@ ASSERT_ENUM_VALUES_EQUAL(TEXTURE_CONTENT); ASSERT_ENUM_VALUES_EQUAL(TILED_CONTENT); ASSERT_ENUM_VALUES_EQUAL(YUV_VIDEO_CONTENT); -COMPILE_ASSERT( - cc::YUVVideoDrawQuad::REC_601 == - static_cast<cc::YUVVideoDrawQuad::ColorSpace>(YUV_COLOR_SPACE_REC_601), - rec_601_enum_matches); +COMPILE_ASSERT(cc::YUVVideoDrawQuad::REC_601 == + static_cast<cc::YUVVideoDrawQuad::ColorSpace>( + mus::mojom::YUV_COLOR_SPACE_REC_601), + rec_601_enum_matches); // TODO(jamesr): Add REC_709 and JPEG to the YUVColorSpace enum upstream in // mojo. namespace { -cc::SharedQuadState* ConvertSharedQuadState(const SharedQuadStatePtr& input, - cc::RenderPass* render_pass) { +cc::SharedQuadState* ConvertSharedQuadState( + const mus::mojom::SharedQuadStatePtr& input, + cc::RenderPass* render_pass) { cc::SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState(); state->SetAll(input->quad_to_target_transform.To<gfx::Transform>(), input->quad_layer_bounds.To<gfx::Size>(), @@ -69,7 +111,7 @@ bool ConvertDrawQuad(const QuadPtr& input, cc::RenderPass* render_pass, CustomSurfaceConverter* custom_converter) { switch (input->material) { - case MATERIAL_DEBUG_BORDER: { + case mus::mojom::MATERIAL_DEBUG_BORDER: { cc::DebugBorderDrawQuad* debug_border_quad = render_pass->CreateAndAppendDrawQuad<cc::DebugBorderDrawQuad>(); debug_border_quad->SetAll( @@ -82,7 +124,7 @@ bool ConvertDrawQuad(const QuadPtr& input, input->debug_border_quad_state->width); break; } - case MATERIAL_RENDER_PASS: { + case mus::mojom::MATERIAL_RENDER_PASS: { cc::RenderPassDrawQuad* render_pass_quad = render_pass->CreateAndAppendDrawQuad<cc::RenderPassDrawQuad>(); RenderPassQuadState* render_pass_quad_state = @@ -106,7 +148,7 @@ bool ConvertDrawQuad(const QuadPtr& input, cc::FilterOperations()); // TODO(jamesr): background_filters break; } - case MATERIAL_SOLID_COLOR: { + case mus::mojom::MATERIAL_SOLID_COLOR: { if (input->solid_color_quad_state.is_null()) return false; cc::SolidColorDrawQuad* color_quad = @@ -121,7 +163,7 @@ bool ConvertDrawQuad(const QuadPtr& input, input->solid_color_quad_state->force_anti_aliasing_off); break; } - case MATERIAL_SURFACE_CONTENT: { + case mus::mojom::MATERIAL_SURFACE_CONTENT: { if (input->surface_quad_state.is_null()) return false; @@ -140,7 +182,7 @@ bool ConvertDrawQuad(const QuadPtr& input, input->surface_quad_state->surface.To<cc::SurfaceId>()); break; } - case MATERIAL_TEXTURE_CONTENT: { + case mus::mojom::MATERIAL_TEXTURE_CONTENT: { TextureQuadStatePtr& texture_quad_state = input->texture_quad_state; if (texture_quad_state.is_null() || @@ -161,7 +203,7 @@ bool ConvertDrawQuad(const QuadPtr& input, texture_quad_state->y_flipped, texture_quad_state->nearest_neighbor); break; } - case MATERIAL_TILED_CONTENT: { + case mus::mojom::MATERIAL_TILED_CONTENT: { TileQuadStatePtr& tile_state = input->tile_quad_state; if (tile_state.is_null()) return false; @@ -179,7 +221,7 @@ bool ConvertDrawQuad(const QuadPtr& input, tile_state->nearest_neighbor); break; } - case MATERIAL_YUV_VIDEO_CONTENT: { + case mus::mojom::MATERIAL_YUV_VIDEO_CONTENT: { YUVVideoQuadStatePtr& yuv_state = input->yuv_video_quad_state; if (yuv_state.is_null()) return false; @@ -258,7 +300,7 @@ cc::RenderPassId TypeConverter<cc::RenderPassId, RenderPassIdPtr>::Convert( QuadPtr TypeConverter<QuadPtr, cc::DrawQuad>::Convert( const cc::DrawQuad& input) { QuadPtr quad = Quad::New(); - quad->material = static_cast<Material>(input.material); + quad->material = static_cast<mus::mojom::Material>(input.material); quad->rect = Rect::From(input.rect); quad->opaque_rect = Rect::From(input.opaque_rect); quad->visible_rect = Rect::From(input.visible_rect); @@ -372,10 +414,10 @@ QuadPtr TypeConverter<QuadPtr, cc::DrawQuad>::Convert( } // static -SharedQuadStatePtr -TypeConverter<SharedQuadStatePtr, cc::SharedQuadState>::Convert( +mus::mojom::SharedQuadStatePtr +TypeConverter<mus::mojom::SharedQuadStatePtr, cc::SharedQuadState>::Convert( const cc::SharedQuadState& input) { - SharedQuadStatePtr state = SharedQuadState::New(); + mus::mojom::SharedQuadStatePtr state = SharedQuadState::New(); state->quad_to_target_transform = Transform::From(input.quad_to_target_transform); state->quad_layer_bounds = Size::From(input.quad_layer_bounds); @@ -383,7 +425,7 @@ TypeConverter<SharedQuadStatePtr, cc::SharedQuadState>::Convert( state->clip_rect = Rect::From(input.clip_rect); state->is_clipped = input.is_clipped; state->opacity = input.opacity; - state->blend_mode = static_cast<SkXfermode>(input.blend_mode); + state->blend_mode = static_cast<mus::mojom::SkXfermode>(input.blend_mode); state->sorting_context_id = input.sorting_context_id; return state.Pass(); } @@ -399,7 +441,7 @@ PassPtr TypeConverter<PassPtr, cc::RenderPass>::Convert( Transform::From(input.transform_to_root_target); pass->has_transparent_background = input.has_transparent_background; Array<QuadPtr> quads(input.quad_list.size()); - Array<SharedQuadStatePtr> shared_quad_state( + Array<mus::mojom::SharedQuadStatePtr> shared_quad_state( input.shared_quad_state_list.size()); const cc::SharedQuadState* last_sqs = nullptr; cc::SharedQuadStateList::ConstIterator next_sqs_iter = @@ -427,8 +469,8 @@ PassPtr TypeConverter<PassPtr, cc::RenderPass>::Convert( // static scoped_ptr<cc::RenderPass> ConvertToRenderPass( - const mojo::PassPtr& input, - const mojo::CompositorFrameMetadataPtr& metadata, + const PassPtr& input, + const CompositorFrameMetadataPtr& metadata, CustomSurfaceConverter* custom_converter) { scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create( input->shared_quad_states.size(), input->quads.size()); @@ -458,7 +500,7 @@ scoped_ptr<cc::RenderPass> ConvertToRenderPass( scoped_ptr<cc::RenderPass> TypeConverter<scoped_ptr<cc::RenderPass>, PassPtr>::Convert( const PassPtr& input) { - mojo::CompositorFrameMetadataPtr metadata; + mus::mojom::CompositorFrameMetadataPtr metadata; return ConvertToRenderPass(input, metadata, nullptr /* CustomSurfaceConverter */); } @@ -639,7 +681,7 @@ TypeConverter<CompositorFramePtr, cc::CompositorFrame>::Convert( // static scoped_ptr<cc::CompositorFrame> ConvertToCompositorFrame( - const mojo::CompositorFramePtr& input, + const CompositorFramePtr& input, CustomSurfaceConverter* custom_converter) { scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData); frame_data->device_scale_factor = 1.f; diff --git a/mojo/converters/surfaces/surfaces_type_converters.h b/mojo/converters/surfaces/surfaces_type_converters.h index 081ad12..4bcb0db 100644 --- a/mojo/converters/surfaces/surfaces_type_converters.h +++ b/mojo/converters/surfaces/surfaces_type_converters.h @@ -32,157 +32,176 @@ class CustomSurfaceConverter; // Types from surface_id.mojom template <> -struct MOJO_SURFACES_EXPORT TypeConverter<SurfaceIdPtr, cc::SurfaceId> { - static SurfaceIdPtr Convert(const cc::SurfaceId& input); +struct MOJO_SURFACES_EXPORT + TypeConverter<mus::mojom::SurfaceIdPtr, cc::SurfaceId> { + static mus::mojom::SurfaceIdPtr Convert(const cc::SurfaceId& input); }; template <> -struct MOJO_SURFACES_EXPORT TypeConverter<cc::SurfaceId, SurfaceIdPtr> { - static cc::SurfaceId Convert(const SurfaceIdPtr& input); +struct MOJO_SURFACES_EXPORT + TypeConverter<cc::SurfaceId, mus::mojom::SurfaceIdPtr> { + static cc::SurfaceId Convert(const mus::mojom::SurfaceIdPtr& input); }; // Types from quads.mojom template <> -struct MOJO_SURFACES_EXPORT TypeConverter<ColorPtr, SkColor> { - static ColorPtr Convert(const SkColor& input); +struct MOJO_SURFACES_EXPORT TypeConverter<mus::mojom::ColorPtr, SkColor> { + static mus::mojom::ColorPtr Convert(const SkColor& input); }; template <> -struct MOJO_SURFACES_EXPORT TypeConverter<SkColor, ColorPtr> { - static SkColor Convert(const ColorPtr& input); +struct MOJO_SURFACES_EXPORT TypeConverter<SkColor, mus::mojom::ColorPtr> { + static SkColor Convert(const mus::mojom::ColorPtr& input); }; template <> -struct MOJO_SURFACES_EXPORT TypeConverter<RenderPassIdPtr, cc::RenderPassId> { - static RenderPassIdPtr Convert(const cc::RenderPassId& input); +struct MOJO_SURFACES_EXPORT + TypeConverter<mus::mojom::RenderPassIdPtr, cc::RenderPassId> { + static mus::mojom::RenderPassIdPtr Convert(const cc::RenderPassId& input); }; template <> -struct MOJO_SURFACES_EXPORT TypeConverter<cc::RenderPassId, RenderPassIdPtr> { - static cc::RenderPassId Convert(const RenderPassIdPtr& input); +struct MOJO_SURFACES_EXPORT + TypeConverter<cc::RenderPassId, mus::mojom::RenderPassIdPtr> { + static cc::RenderPassId Convert(const mus::mojom::RenderPassIdPtr& input); }; template <> -struct MOJO_SURFACES_EXPORT TypeConverter<QuadPtr, cc::DrawQuad> { - static QuadPtr Convert(const cc::DrawQuad& input); +struct MOJO_SURFACES_EXPORT TypeConverter<mus::mojom::QuadPtr, cc::DrawQuad> { + static mus::mojom::QuadPtr Convert(const cc::DrawQuad& input); }; template <> struct MOJO_SURFACES_EXPORT -TypeConverter<SharedQuadStatePtr, cc::SharedQuadState> { - static SharedQuadStatePtr Convert(const cc::SharedQuadState& input); + TypeConverter<mus::mojom::SharedQuadStatePtr, cc::SharedQuadState> { + static mus::mojom::SharedQuadStatePtr Convert( + const cc::SharedQuadState& input); }; scoped_ptr<cc::RenderPass> ConvertToRenderPass( - const mojo::PassPtr& input, - const mojo::CompositorFrameMetadataPtr& metadata, + const mus::mojom::PassPtr& input, + const mus::mojom::CompositorFrameMetadataPtr& metadata, CustomSurfaceConverter* custom_converter); template <> -struct MOJO_SURFACES_EXPORT TypeConverter<PassPtr, cc::RenderPass> { - static PassPtr Convert(const cc::RenderPass& input); +struct MOJO_SURFACES_EXPORT TypeConverter<mus::mojom::PassPtr, cc::RenderPass> { + static mus::mojom::PassPtr Convert(const cc::RenderPass& input); }; template <> -struct MOJO_SURFACES_EXPORT TypeConverter<scoped_ptr<cc::RenderPass>, PassPtr> { - static scoped_ptr<cc::RenderPass> Convert(const PassPtr& input); +struct MOJO_SURFACES_EXPORT + TypeConverter<scoped_ptr<cc::RenderPass>, mus::mojom::PassPtr> { + static scoped_ptr<cc::RenderPass> Convert(const mus::mojom::PassPtr& input); }; // Types from compositor_frame.mojom template <> -struct MOJO_SURFACES_EXPORT TypeConverter<MailboxPtr, gpu::Mailbox> { - static MailboxPtr Convert(const gpu::Mailbox& input); +struct MOJO_SURFACES_EXPORT + TypeConverter<mus::mojom::MailboxPtr, gpu::Mailbox> { + static mus::mojom::MailboxPtr Convert(const gpu::Mailbox& input); }; template <> -struct MOJO_SURFACES_EXPORT TypeConverter<gpu::Mailbox, MailboxPtr> { - static gpu::Mailbox Convert(const MailboxPtr& input); +struct MOJO_SURFACES_EXPORT + TypeConverter<gpu::Mailbox, mus::mojom::MailboxPtr> { + static gpu::Mailbox Convert(const mus::mojom::MailboxPtr& input); }; template <> struct MOJO_SURFACES_EXPORT -TypeConverter<MailboxHolderPtr, gpu::MailboxHolder> { - static MailboxHolderPtr Convert(const gpu::MailboxHolder& input); + TypeConverter<mus::mojom::MailboxHolderPtr, gpu::MailboxHolder> { + static mus::mojom::MailboxHolderPtr Convert(const gpu::MailboxHolder& input); }; template <> struct MOJO_SURFACES_EXPORT -TypeConverter<gpu::MailboxHolder, MailboxHolderPtr> { - static gpu::MailboxHolder Convert(const MailboxHolderPtr& input); + TypeConverter<gpu::MailboxHolder, mus::mojom::MailboxHolderPtr> { + static gpu::MailboxHolder Convert(const mus::mojom::MailboxHolderPtr& input); }; template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<TransferableResourcePtr, cc::TransferableResource> { - static TransferableResourcePtr Convert(const cc::TransferableResource& input); +struct MOJO_SURFACES_EXPORT TypeConverter<mus::mojom::TransferableResourcePtr, + cc::TransferableResource> { + static mus::mojom::TransferableResourcePtr Convert( + const cc::TransferableResource& input); }; template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<cc::TransferableResource, TransferableResourcePtr> { - static cc::TransferableResource Convert(const TransferableResourcePtr& input); +struct MOJO_SURFACES_EXPORT TypeConverter<cc::TransferableResource, + mus::mojom::TransferableResourcePtr> { + static cc::TransferableResource Convert( + const mus::mojom::TransferableResourcePtr& input); }; template <> struct MOJO_SURFACES_EXPORT -TypeConverter<Array<TransferableResourcePtr>, cc::TransferableResourceArray> { - static Array<TransferableResourcePtr> Convert( + TypeConverter<Array<mus::mojom::TransferableResourcePtr>, + cc::TransferableResourceArray> { + static Array<mus::mojom::TransferableResourcePtr> Convert( const cc::TransferableResourceArray& input); }; template <> struct MOJO_SURFACES_EXPORT -TypeConverter<cc::TransferableResourceArray, Array<TransferableResourcePtr> > { + TypeConverter<cc::TransferableResourceArray, + Array<mus::mojom::TransferableResourcePtr>> { static cc::TransferableResourceArray Convert( - const Array<TransferableResourcePtr>& input); + const Array<mus::mojom::TransferableResourcePtr>& input); }; template <> struct MOJO_SURFACES_EXPORT -TypeConverter<ReturnedResourcePtr, cc::ReturnedResource> { - static ReturnedResourcePtr Convert(const cc::ReturnedResource& input); + TypeConverter<mus::mojom::ReturnedResourcePtr, cc::ReturnedResource> { + static mus::mojom::ReturnedResourcePtr Convert( + const cc::ReturnedResource& input); }; template <> struct MOJO_SURFACES_EXPORT -TypeConverter<cc::ReturnedResource, ReturnedResourcePtr> { - static cc::ReturnedResource Convert(const ReturnedResourcePtr& input); + TypeConverter<cc::ReturnedResource, mus::mojom::ReturnedResourcePtr> { + static cc::ReturnedResource Convert( + const mus::mojom::ReturnedResourcePtr& input); }; template <> struct MOJO_SURFACES_EXPORT -TypeConverter<Array<ReturnedResourcePtr>, cc::ReturnedResourceArray> { - static Array<ReturnedResourcePtr> Convert( + TypeConverter<Array<mus::mojom::ReturnedResourcePtr>, + cc::ReturnedResourceArray> { + static Array<mus::mojom::ReturnedResourcePtr> Convert( const cc::ReturnedResourceArray& input); }; template <> struct MOJO_SURFACES_EXPORT - TypeConverter<cc::ReturnedResourceArray, Array<ReturnedResourcePtr>> { + TypeConverter<cc::ReturnedResourceArray, + Array<mus::mojom::ReturnedResourcePtr>> { static cc::ReturnedResourceArray Convert( - const Array<ReturnedResourcePtr>& input); + const Array<mus::mojom::ReturnedResourcePtr>& input); }; template <> struct MOJO_SURFACES_EXPORT - TypeConverter<CompositorFrameMetadataPtr, cc::CompositorFrameMetadata> { - static CompositorFrameMetadataPtr Convert( + TypeConverter<mus::mojom::CompositorFrameMetadataPtr, + cc::CompositorFrameMetadata> { + static mus::mojom::CompositorFrameMetadataPtr Convert( const cc::CompositorFrameMetadata& input); }; template <> struct MOJO_SURFACES_EXPORT - TypeConverter<cc::CompositorFrameMetadata, CompositorFrameMetadataPtr> { + TypeConverter<cc::CompositorFrameMetadata, + mus::mojom::CompositorFrameMetadataPtr> { static cc::CompositorFrameMetadata Convert( - const CompositorFrameMetadataPtr& input); + const mus::mojom::CompositorFrameMetadataPtr& input); }; scoped_ptr<cc::CompositorFrame> ConvertToCompositorFrame( - const mojo::CompositorFramePtr& input, + const mus::mojom::CompositorFramePtr& input, CustomSurfaceConverter* custom_converter); template <> struct MOJO_SURFACES_EXPORT -TypeConverter<CompositorFramePtr, cc::CompositorFrame> { - static CompositorFramePtr Convert(const cc::CompositorFrame& input); + TypeConverter<mus::mojom::CompositorFramePtr, cc::CompositorFrame> { + static mus::mojom::CompositorFramePtr Convert( + const cc::CompositorFrame& input); }; template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<scoped_ptr<cc::CompositorFrame>, CompositorFramePtr> { +struct MOJO_SURFACES_EXPORT TypeConverter<scoped_ptr<cc::CompositorFrame>, + mus::mojom::CompositorFramePtr> { static scoped_ptr<cc::CompositorFrame> Convert( - const CompositorFramePtr& input); + const mus::mojom::CompositorFramePtr& input); }; } // namespace mojo diff --git a/mojo/converters/surfaces/surfaces_utils.cc b/mojo/converters/surfaces/surfaces_utils.cc index d62fc08..79b2996 100644 --- a/mojo/converters/surfaces/surfaces_utils.cc +++ b/mojo/converters/surfaces/surfaces_utils.cc @@ -10,6 +10,12 @@ #include "ui/gfx/geometry/size.h" #include "ui/gfx/transform.h" +using mus::mojom::Pass; +using mus::mojom::PassPtr; +using mus::mojom::RenderPassId; +using mus::mojom::SharedQuadState; +using mus::mojom::SharedQuadStatePtr; + namespace mojo { SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size) { @@ -20,7 +26,7 @@ SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size) { sqs->clip_rect = Rect::From(gfx::Rect(size)); sqs->is_clipped = false; sqs->opacity = 1.f; - sqs->blend_mode = mojo::SK_XFERMODE_kSrc_Mode; + sqs->blend_mode = mus::mojom::SK_XFERMODE_kSrc_Mode; sqs->sorting_context_id = 0; return sqs.Pass(); } diff --git a/mojo/converters/surfaces/surfaces_utils.h b/mojo/converters/surfaces/surfaces_utils.h index 6eabb1f3..f049175 100644 --- a/mojo/converters/surfaces/surfaces_utils.h +++ b/mojo/converters/surfaces/surfaces_utils.h @@ -15,12 +15,15 @@ class Size; namespace mojo { -MOJO_SURFACES_EXPORT SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size); +MOJO_SURFACES_EXPORT mus::mojom::SharedQuadStatePtr CreateDefaultSQS( + const gfx::Size& size); // Constructs a pass with the given id, output_rect and damage_rect set to rect, // transform_to_root_target set to identity and has_transparent_background set // to false. -MOJO_SURFACES_EXPORT PassPtr CreateDefaultPass(int id, const gfx::Rect& rect); +MOJO_SURFACES_EXPORT mus::mojom::PassPtr CreateDefaultPass( + int id, + const gfx::Rect& rect); } // namespace mojo diff --git a/mojo/converters/surfaces/tests/surface_unittest.cc b/mojo/converters/surfaces/tests/surface_unittest.cc index c6a9a88..fceaa32 100644 --- a/mojo/converters/surfaces/tests/surface_unittest.cc +++ b/mojo/converters/surfaces/tests/surface_unittest.cc @@ -17,6 +17,47 @@ #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkXfermode.h" +using mus::mojom::Color; +using mus::mojom::ColorPtr; +using mus::mojom::CompositorFrame; +using mus::mojom::CompositorFramePtr; +using mus::mojom::CompositorFrameMetadata; +using mus::mojom::CompositorFrameMetadataPtr; +using mus::mojom::DebugBorderQuadState; +using mus::mojom::DebugBorderQuadStatePtr; +using mus::mojom::Mailbox; +using mus::mojom::MailboxPtr; +using mus::mojom::MailboxHolder; +using mus::mojom::MailboxHolderPtr; +using mus::mojom::Pass; +using mus::mojom::PassPtr; +using mus::mojom::Quad; +using mus::mojom::QuadPtr; +using mus::mojom::RenderPassId; +using mus::mojom::RenderPassIdPtr; +using mus::mojom::RenderPassQuadState; +using mus::mojom::RenderPassQuadStatePtr; +using mus::mojom::ResourceFormat; +using mus::mojom::ReturnedResource; +using mus::mojom::ReturnedResourcePtr; +using mus::mojom::SharedQuadState; +using mus::mojom::SharedQuadStatePtr; +using mus::mojom::SolidColorQuadState; +using mus::mojom::SolidColorQuadStatePtr; +using mus::mojom::SurfaceId; +using mus::mojom::SurfaceIdPtr; +using mus::mojom::SurfaceQuadState; +using mus::mojom::SurfaceQuadStatePtr; +using mus::mojom::TextureQuadState; +using mus::mojom::TextureQuadStatePtr; +using mus::mojom::TileQuadState; +using mus::mojom::TileQuadStatePtr; +using mus::mojom::TransferableResource; +using mus::mojom::TransferableResourcePtr; +using mus::mojom::YUVColorSpace; +using mus::mojom::YUVVideoQuadState; +using mus::mojom::YUVVideoQuadStatePtr; + namespace mojo { namespace { @@ -72,17 +113,17 @@ TEST_F(SurfaceLibQuadTest, ColorQuad) { arbitrary_color, force_anti_aliasing_off); - QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*color_quad); - ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(MATERIAL_SOLID_COLOR, mojo_quad->material); - EXPECT_TRUE(Rect::From(rect).Equals(mojo_quad->rect)); - EXPECT_TRUE(Rect::From(opaque_rect).Equals(mojo_quad->opaque_rect)); - EXPECT_TRUE(Rect::From(visible_rect).Equals(mojo_quad->visible_rect)); - EXPECT_EQ(needs_blending, mojo_quad->needs_blending); - ASSERT_TRUE(mojo_quad->solid_color_quad_state); - SolidColorQuadStatePtr& mojo_color_state = mojo_quad->solid_color_quad_state; - EXPECT_TRUE(Color::From(arbitrary_color).Equals(mojo_color_state->color)); - EXPECT_EQ(force_anti_aliasing_off, mojo_color_state->force_anti_aliasing_off); + QuadPtr mus_quad = Quad::From<cc::DrawQuad>(*color_quad); + ASSERT_FALSE(mus_quad.is_null()); + EXPECT_EQ(mus::mojom::MATERIAL_SOLID_COLOR, mus_quad->material); + EXPECT_TRUE(Rect::From(rect).Equals(mus_quad->rect)); + EXPECT_TRUE(Rect::From(opaque_rect).Equals(mus_quad->opaque_rect)); + EXPECT_TRUE(Rect::From(visible_rect).Equals(mus_quad->visible_rect)); + EXPECT_EQ(needs_blending, mus_quad->needs_blending); + ASSERT_TRUE(mus_quad->solid_color_quad_state); + SolidColorQuadStatePtr& mus_color_state = mus_quad->solid_color_quad_state; + EXPECT_TRUE(Color::From(arbitrary_color).Equals(mus_color_state->color)); + EXPECT_EQ(force_anti_aliasing_off, mus_color_state->force_anti_aliasing_off); } TEST_F(SurfaceLibQuadTest, SurfaceQuad) { @@ -92,13 +133,12 @@ TEST_F(SurfaceLibQuadTest, SurfaceQuad) { surface_quad->SetAll( sqs, rect, opaque_rect, visible_rect, needs_blending, arbitrary_id); - QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*surface_quad); - ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(MATERIAL_SURFACE_CONTENT, mojo_quad->material); - ASSERT_TRUE(mojo_quad->surface_quad_state); - SurfaceQuadStatePtr& mojo_surface_state = mojo_quad->surface_quad_state; - EXPECT_TRUE( - SurfaceId::From(arbitrary_id).Equals(mojo_surface_state->surface)); + QuadPtr mus_quad = Quad::From<cc::DrawQuad>(*surface_quad); + ASSERT_FALSE(mus_quad.is_null()); + EXPECT_EQ(mus::mojom::MATERIAL_SURFACE_CONTENT, mus_quad->material); + ASSERT_TRUE(mus_quad->surface_quad_state); + SurfaceQuadStatePtr& mus_surface_state = mus_quad->surface_quad_state; + EXPECT_TRUE(SurfaceId::From(arbitrary_id).Equals(mus_surface_state->surface)); } TEST_F(SurfaceLibQuadTest, TextureQuad) { @@ -117,59 +157,58 @@ TEST_F(SurfaceLibQuadTest, TextureQuad) { uv_top_left, uv_bottom_right, background_color, vertex_opacity, y_flipped, nearest_neighbor); - QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*texture_quad); - ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(MATERIAL_TEXTURE_CONTENT, mojo_quad->material); - ASSERT_TRUE(mojo_quad->texture_quad_state); - TextureQuadStatePtr& mojo_texture_state = mojo_quad->texture_quad_state; - EXPECT_EQ(resource_id, mojo_texture_state->resource_id); - EXPECT_EQ(premultiplied_alpha, mojo_texture_state->premultiplied_alpha); + QuadPtr mus_quad = Quad::From<cc::DrawQuad>(*texture_quad); + ASSERT_FALSE(mus_quad.is_null()); + EXPECT_EQ(mus::mojom::MATERIAL_TEXTURE_CONTENT, mus_quad->material); + ASSERT_TRUE(mus_quad->texture_quad_state); + TextureQuadStatePtr& mus_texture_state = mus_quad->texture_quad_state; + EXPECT_EQ(resource_id, mus_texture_state->resource_id); + EXPECT_EQ(premultiplied_alpha, mus_texture_state->premultiplied_alpha); + EXPECT_TRUE(PointF::From(uv_top_left).Equals(mus_texture_state->uv_top_left)); EXPECT_TRUE( - PointF::From(uv_top_left).Equals(mojo_texture_state->uv_top_left)); - EXPECT_TRUE(PointF::From(uv_bottom_right) - .Equals(mojo_texture_state->uv_bottom_right)); + PointF::From(uv_bottom_right).Equals(mus_texture_state->uv_bottom_right)); EXPECT_TRUE(Color::From(background_color) - .Equals(mojo_texture_state->background_color)); + .Equals(mus_texture_state->background_color)); for (size_t i = 0; i < 4; ++i) { - EXPECT_EQ(vertex_opacity[i], mojo_texture_state->vertex_opacity[i]) << i; + EXPECT_EQ(vertex_opacity[i], mus_texture_state->vertex_opacity[i]) << i; } - EXPECT_EQ(y_flipped, mojo_texture_state->y_flipped); + EXPECT_EQ(y_flipped, mus_texture_state->y_flipped); } TEST_F(SurfaceLibQuadTest, TextureQuadEmptyVertexOpacity) { - QuadPtr mojo_texture_quad = Quad::New(); - mojo_texture_quad->material = MATERIAL_TEXTURE_CONTENT; - TextureQuadStatePtr mojo_texture_state = TextureQuadState::New(); - mojo_texture_state->background_color = Color::New(); - mojo_texture_quad->texture_quad_state = mojo_texture_state.Pass(); - PassPtr mojo_pass = Pass::New(); - mojo_pass->id = RenderPassId::New(); - mojo_pass->id->layer_id = 1; - mojo_pass->id->index = 1u; - mojo_pass->quads.push_back(mojo_texture_quad.Pass()); - SharedQuadStatePtr mojo_sqs = SharedQuadState::New(); - mojo_pass->shared_quad_states.push_back(mojo_sqs.Pass()); - - scoped_ptr<cc::RenderPass> pass = mojo_pass.To<scoped_ptr<cc::RenderPass> >(); + QuadPtr mus_texture_quad = Quad::New(); + mus_texture_quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT; + TextureQuadStatePtr mus_texture_state = TextureQuadState::New(); + mus_texture_state->background_color = Color::New(); + mus_texture_quad->texture_quad_state = mus_texture_state.Pass(); + PassPtr mus_pass = Pass::New(); + mus_pass->id = RenderPassId::New(); + mus_pass->id->layer_id = 1; + mus_pass->id->index = 1u; + mus_pass->quads.push_back(mus_texture_quad.Pass()); + SharedQuadStatePtr mus_sqs = SharedQuadState::New(); + mus_pass->shared_quad_states.push_back(mus_sqs.Pass()); + + scoped_ptr<cc::RenderPass> pass = mus_pass.To<scoped_ptr<cc::RenderPass>>(); EXPECT_FALSE(pass); } TEST_F(SurfaceLibQuadTest, TextureQuadEmptyBackgroundColor) { - QuadPtr mojo_texture_quad = Quad::New(); - mojo_texture_quad->material = MATERIAL_TEXTURE_CONTENT; - TextureQuadStatePtr mojo_texture_state = TextureQuadState::New(); - mojo_texture_state->vertex_opacity = mojo::Array<float>::New(4); - mojo_texture_quad->texture_quad_state = mojo_texture_state.Pass(); - PassPtr mojo_pass = Pass::New(); - mojo_pass->id = RenderPassId::New(); - mojo_pass->id->layer_id = 1; - mojo_pass->id->index = 1u; - mojo_pass->quads.push_back(mojo_texture_quad.Pass()); - SharedQuadStatePtr mojo_sqs = SharedQuadState::New(); - mojo_pass->shared_quad_states.push_back(mojo_sqs.Pass()); - - scoped_ptr<cc::RenderPass> pass = mojo_pass.To<scoped_ptr<cc::RenderPass> >(); + QuadPtr mus_texture_quad = Quad::New(); + mus_texture_quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT; + TextureQuadStatePtr mus_texture_state = TextureQuadState::New(); + mus_texture_state->vertex_opacity = mojo::Array<float>::New(4); + mus_texture_quad->texture_quad_state = mus_texture_state.Pass(); + PassPtr mus_pass = Pass::New(); + mus_pass->id = RenderPassId::New(); + mus_pass->id->layer_id = 1; + mus_pass->id->index = 1u; + mus_pass->quads.push_back(mus_texture_quad.Pass()); + SharedQuadStatePtr mus_sqs = SharedQuadState::New(); + mus_pass->shared_quad_states.push_back(mus_sqs.Pass()); + + scoped_ptr<cc::RenderPass> pass = mus_pass.To<scoped_ptr<cc::RenderPass>>(); EXPECT_FALSE(pass); } @@ -189,18 +228,17 @@ TEST(SurfaceLibTest, SharedQuadState) { visible_quad_layer_rect, clip_rect, is_clipped, opacity, blend_mode, sorting_context_id); - SharedQuadStatePtr mojo_sqs = SharedQuadState::From(*sqs); - ASSERT_FALSE(mojo_sqs.is_null()); + SharedQuadStatePtr mus_sqs = SharedQuadState::From(*sqs); + ASSERT_FALSE(mus_sqs.is_null()); EXPECT_TRUE(Transform::From(quad_to_target_transform) - .Equals(mojo_sqs->quad_to_target_transform)); - EXPECT_TRUE( - Size::From(quad_layer_bounds).Equals(mojo_sqs->quad_layer_bounds)); + .Equals(mus_sqs->quad_to_target_transform)); + EXPECT_TRUE(Size::From(quad_layer_bounds).Equals(mus_sqs->quad_layer_bounds)); EXPECT_TRUE(Rect::From(visible_quad_layer_rect) - .Equals(mojo_sqs->visible_quad_layer_rect)); - EXPECT_TRUE(Rect::From(clip_rect).Equals(mojo_sqs->clip_rect)); - EXPECT_EQ(is_clipped, mojo_sqs->is_clipped); - EXPECT_EQ(opacity, mojo_sqs->opacity); - EXPECT_EQ(sorting_context_id, mojo_sqs->sorting_context_id); + .Equals(mus_sqs->visible_quad_layer_rect)); + EXPECT_TRUE(Rect::From(clip_rect).Equals(mus_sqs->clip_rect)); + EXPECT_EQ(is_clipped, mus_sqs->is_clipped); + EXPECT_EQ(opacity, mus_sqs->opacity); + EXPECT_EQ(sorting_context_id, mus_sqs->sorting_context_id); } TEST(SurfaceLibTest, RenderPass) { @@ -269,20 +307,20 @@ TEST(SurfaceLibTest, RenderPass) { uv_top_left, uv_bottom_right, background_color, vertex_opacity, y_flipped, nearest_neighbor); - PassPtr mojo_pass = Pass::From(*pass); - ASSERT_FALSE(mojo_pass.is_null()); - EXPECT_EQ(6u, mojo_pass->id->index); - EXPECT_TRUE(Rect::From(output_rect).Equals(mojo_pass->output_rect)); - EXPECT_TRUE(Rect::From(damage_rect).Equals(mojo_pass->damage_rect)); + PassPtr mus_pass = Pass::From(*pass); + ASSERT_FALSE(mus_pass.is_null()); + EXPECT_EQ(6u, mus_pass->id->index); + EXPECT_TRUE(Rect::From(output_rect).Equals(mus_pass->output_rect)); + EXPECT_TRUE(Rect::From(damage_rect).Equals(mus_pass->damage_rect)); EXPECT_TRUE(Transform::From(transform_to_root_target) - .Equals(mojo_pass->transform_to_root_target)); - EXPECT_EQ(has_transparent_background, mojo_pass->has_transparent_background); - ASSERT_EQ(1u, mojo_pass->shared_quad_states.size()); - ASSERT_EQ(3u, mojo_pass->quads.size()); - EXPECT_EQ(0u, mojo_pass->quads[0]->shared_quad_state_index); + .Equals(mus_pass->transform_to_root_target)); + EXPECT_EQ(has_transparent_background, mus_pass->has_transparent_background); + ASSERT_EQ(1u, mus_pass->shared_quad_states.size()); + ASSERT_EQ(3u, mus_pass->quads.size()); + EXPECT_EQ(0u, mus_pass->quads[0]->shared_quad_state_index); scoped_ptr<cc::RenderPass> round_trip_pass = - mojo_pass.To<scoped_ptr<cc::RenderPass> >(); + mus_pass.To<scoped_ptr<cc::RenderPass>>(); EXPECT_EQ(pass_id, round_trip_pass->id); EXPECT_EQ(output_rect, round_trip_pass->output_rect); EXPECT_EQ(damage_rect, round_trip_pass->damage_rect); @@ -346,17 +384,17 @@ TEST(SurfaceLibTest, Mailbox) { gpu::Mailbox mailbox; mailbox.Generate(); - MailboxPtr mojo_mailbox = Mailbox::From(mailbox); - EXPECT_EQ(0, memcmp(mailbox.name, &mojo_mailbox->name.storage()[0], 64)); + MailboxPtr mus_mailbox = Mailbox::From(mailbox); + EXPECT_EQ(0, memcmp(mailbox.name, &mus_mailbox->name.storage()[0], 64)); - gpu::Mailbox round_trip_mailbox = mojo_mailbox.To<gpu::Mailbox>(); + gpu::Mailbox round_trip_mailbox = mus_mailbox.To<gpu::Mailbox>(); EXPECT_EQ(mailbox, round_trip_mailbox); } TEST(SurfaceLibTest, MailboxEmptyName) { - MailboxPtr mojo_mailbox = Mailbox::New(); + MailboxPtr mus_mailbox = Mailbox::New(); - gpu::Mailbox converted_mailbox = mojo_mailbox.To<gpu::Mailbox>(); + gpu::Mailbox converted_mailbox = mus_mailbox.To<gpu::Mailbox>(); EXPECT_TRUE(converted_mailbox.IsZero()); } @@ -367,11 +405,11 @@ TEST(SurfaceLibTest, MailboxHolder) { uint32_t sync_point = 7u; gpu::MailboxHolder holder(mailbox, texture_target, sync_point); - MailboxHolderPtr mojo_holder = MailboxHolder::From(holder); - EXPECT_EQ(texture_target, mojo_holder->texture_target); - EXPECT_EQ(sync_point, mojo_holder->sync_point); + MailboxHolderPtr mus_holder = MailboxHolder::From(holder); + EXPECT_EQ(texture_target, mus_holder->texture_target); + EXPECT_EQ(sync_point, mus_holder->sync_point); - gpu::MailboxHolder round_trip_holder = mojo_holder.To<gpu::MailboxHolder>(); + gpu::MailboxHolder round_trip_holder = mus_holder.To<gpu::MailboxHolder>(); EXPECT_EQ(mailbox, round_trip_holder.mailbox); EXPECT_EQ(texture_target, round_trip_holder.texture_target); EXPECT_EQ(sync_point, round_trip_holder.sync_point); @@ -392,16 +430,15 @@ TEST(SurfaceLibTest, TransferableResource) { resource.mailbox_holder = mailbox_holder; resource.is_software = is_software; - TransferableResourcePtr mojo_resource = TransferableResource::From(resource); - EXPECT_EQ(id, mojo_resource->id); - EXPECT_EQ(static_cast<ResourceFormat>(format), - mojo_resource->format); - EXPECT_EQ(filter, mojo_resource->filter); - EXPECT_TRUE(Size::From(size).Equals(mojo_resource->size)); - EXPECT_EQ(is_software, mojo_resource->is_software); + TransferableResourcePtr mus_resource = TransferableResource::From(resource); + EXPECT_EQ(id, mus_resource->id); + EXPECT_EQ(static_cast<ResourceFormat>(format), mus_resource->format); + EXPECT_EQ(filter, mus_resource->filter); + EXPECT_TRUE(Size::From(size).Equals(mus_resource->size)); + EXPECT_EQ(is_software, mus_resource->is_software); cc::TransferableResource round_trip_resource = - mojo_resource.To<cc::TransferableResource>(); + mus_resource.To<cc::TransferableResource>(); EXPECT_EQ(id, round_trip_resource.id); EXPECT_EQ(format, round_trip_resource.format); EXPECT_EQ(filter, round_trip_resource.filter); @@ -425,14 +462,14 @@ TEST(SurfaceLibTest, ReturnedResource) { resource.count = count; resource.lost = lost; - ReturnedResourcePtr mojo_resource = ReturnedResource::From(resource); - EXPECT_EQ(id, mojo_resource->id); - EXPECT_EQ(sync_point, mojo_resource->sync_point); - EXPECT_EQ(count, mojo_resource->count); - EXPECT_EQ(lost, mojo_resource->lost); + ReturnedResourcePtr mus_resource = ReturnedResource::From(resource); + EXPECT_EQ(id, mus_resource->id); + EXPECT_EQ(sync_point, mus_resource->sync_point); + EXPECT_EQ(count, mus_resource->count); + EXPECT_EQ(lost, mus_resource->lost); cc::ReturnedResource round_trip_resource = - mojo_resource.To<cc::ReturnedResource>(); + mus_resource.To<cc::ReturnedResource>(); EXPECT_EQ(id, round_trip_resource.id); EXPECT_EQ(sync_point, round_trip_resource.sync_point); EXPECT_EQ(count, round_trip_resource.count); @@ -452,19 +489,19 @@ TEST_F(SurfaceLibQuadTest, DebugBorderQuad) { arbitrary_color, width); - QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*debug_border_quad); - ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(MATERIAL_DEBUG_BORDER, mojo_quad->material); - EXPECT_TRUE(Rect::From(rect).Equals(mojo_quad->rect)); - EXPECT_TRUE(Rect::From(opaque_rect).Equals(mojo_quad->opaque_rect)); - EXPECT_TRUE(Rect::From(visible_rect).Equals(mojo_quad->visible_rect)); - EXPECT_EQ(needs_blending, mojo_quad->needs_blending); - ASSERT_TRUE(mojo_quad->debug_border_quad_state); - DebugBorderQuadStatePtr& mojo_debug_border_state = - mojo_quad->debug_border_quad_state; + QuadPtr mus_quad = Quad::From<cc::DrawQuad>(*debug_border_quad); + ASSERT_FALSE(mus_quad.is_null()); + EXPECT_EQ(mus::mojom::MATERIAL_DEBUG_BORDER, mus_quad->material); + EXPECT_TRUE(Rect::From(rect).Equals(mus_quad->rect)); + EXPECT_TRUE(Rect::From(opaque_rect).Equals(mus_quad->opaque_rect)); + EXPECT_TRUE(Rect::From(visible_rect).Equals(mus_quad->visible_rect)); + EXPECT_EQ(needs_blending, mus_quad->needs_blending); + ASSERT_TRUE(mus_quad->debug_border_quad_state); + DebugBorderQuadStatePtr& mus_debug_border_state = + mus_quad->debug_border_quad_state; EXPECT_TRUE( - Color::From(arbitrary_color).Equals(mojo_debug_border_state->color)); - EXPECT_EQ(width, mojo_debug_border_state->width); + Color::From(arbitrary_color).Equals(mus_debug_border_state->color)); + EXPECT_EQ(width, mus_debug_border_state->width); } } // namespace diff --git a/mojo/gles2/command_buffer_client_impl.cc b/mojo/gles2/command_buffer_client_impl.cc index 172ceca..0cba7aa 100644 --- a/mojo/gles2/command_buffer_client_impl.cc +++ b/mojo/gles2/command_buffer_client_impl.cc @@ -48,9 +48,9 @@ CommandBufferDelegate::~CommandBufferDelegate() {} void CommandBufferDelegate::ContextLost() {} class CommandBufferClientImpl::SyncClientImpl - : public mojo::CommandBufferSyncClient { + : public mus::mojom::CommandBufferSyncClient { public: - SyncClientImpl(mojo::CommandBufferSyncClientPtr* ptr, + SyncClientImpl(mus::mojom::CommandBufferSyncClientPtr* ptr, const MojoAsyncWaiter* async_waiter) : initialized_successfully_(false), binding_(this, ptr, async_waiter) {} @@ -60,9 +60,9 @@ class CommandBufferClientImpl::SyncClientImpl return initialized_successfully_; } - mojo::CommandBufferStatePtr WaitForProgress() { + mus::mojom::CommandBufferStatePtr WaitForProgress() { if (!binding_.WaitForIncomingMethodCall()) - return mojo::CommandBufferStatePtr(); + return mus::mojom::CommandBufferStatePtr(); return command_buffer_state_.Pass(); } @@ -75,26 +75,26 @@ class CommandBufferClientImpl::SyncClientImpl private: // CommandBufferSyncClient methods: void DidInitialize(bool success, - mojo::GpuCapabilitiesPtr capabilities) override { + mus::mojom::GpuCapabilitiesPtr capabilities) override { initialized_successfully_ = success; capabilities_ = capabilities.Pass(); } - void DidMakeProgress(mojo::CommandBufferStatePtr state) override { + void DidMakeProgress(mus::mojom::CommandBufferStatePtr state) override { command_buffer_state_ = state.Pass(); } bool initialized_successfully_; - mojo::GpuCapabilitiesPtr capabilities_; - mojo::CommandBufferStatePtr command_buffer_state_; - mojo::Binding<mojo::CommandBufferSyncClient> binding_; + mus::mojom::GpuCapabilitiesPtr capabilities_; + mus::mojom::CommandBufferStatePtr command_buffer_state_; + mojo::Binding<mus::mojom::CommandBufferSyncClient> binding_; DISALLOW_COPY_AND_ASSIGN(SyncClientImpl); }; class CommandBufferClientImpl::SyncPointClientImpl - : public mojo::CommandBufferSyncPointClient { + : public mus::mojom::CommandBufferSyncPointClient { public: - SyncPointClientImpl(mojo::CommandBufferSyncPointClientPtr* ptr, + SyncPointClientImpl(mus::mojom::CommandBufferSyncPointClientPtr* ptr, const MojoAsyncWaiter* async_waiter) : sync_point_(0u), binding_(this, ptr, async_waiter) {} @@ -113,7 +113,7 @@ class CommandBufferClientImpl::SyncPointClientImpl uint32_t sync_point_; - mojo::Binding<mojo::CommandBufferSyncPointClient> binding_; + mojo::Binding<mus::mojom::CommandBufferSyncPointClient> binding_; }; CommandBufferClientImpl::CommandBufferClientImpl( @@ -131,7 +131,7 @@ CommandBufferClientImpl::CommandBufferClientImpl( next_fence_sync_release_(1), flushed_fence_sync_release_(0), async_waiter_(async_waiter) { - command_buffer_.Bind(mojo::InterfacePtrInfo<mojo::CommandBuffer>( + command_buffer_.Bind(mojo::InterfacePtrInfo<mus::mojom::CommandBuffer>( command_buffer_handle.Pass(), 0u), async_waiter); command_buffer_.set_connection_error_handler( @@ -153,14 +153,14 @@ bool CommandBufferClientImpl::Initialize() { shared_state()->Initialize(); - mojo::CommandBufferSyncClientPtr sync_client; + mus::mojom::CommandBufferSyncClientPtr sync_client; sync_client_impl_.reset(new SyncClientImpl(&sync_client, async_waiter_)); - mojo::CommandBufferSyncPointClientPtr sync_point_client; + mus::mojom::CommandBufferSyncPointClientPtr sync_point_client; sync_point_client_impl_.reset( new SyncPointClientImpl(&sync_point_client, async_waiter_)); - mojo::CommandBufferLostContextObserverPtr observer_ptr; + mus::mojom::CommandBufferLostContextObserverPtr observer_ptr; observer_binding_.Bind(GetProxy(&observer_ptr), async_waiter_); command_buffer_->Initialize(sync_client.Pass(), sync_point_client.Pass(), @@ -379,7 +379,8 @@ void CommandBufferClientImpl::TryUpdateState() { void CommandBufferClientImpl::MakeProgressAndUpdateState() { command_buffer_->MakeProgress(last_state_.get_offset); - mojo::CommandBufferStatePtr state = sync_client_impl_->WaitForProgress(); + mus::mojom::CommandBufferStatePtr state = + sync_client_impl_->WaitForProgress(); if (!state) { VLOG(1) << "Channel encountered error while waiting for command buffer"; // TODO(piman): is it ok for this to re-enter? diff --git a/mojo/gles2/command_buffer_client_impl.h b/mojo/gles2/command_buffer_client_impl.h index b4ead3b..c6f35e6 100644 --- a/mojo/gles2/command_buffer_client_impl.h +++ b/mojo/gles2/command_buffer_client_impl.h @@ -29,9 +29,10 @@ class CommandBufferDelegate { virtual void ContextLost(); }; -class CommandBufferClientImpl : public mojo::CommandBufferLostContextObserver, - public gpu::CommandBuffer, - public gpu::GpuControl { +class CommandBufferClientImpl + : public mus::mojom::CommandBufferLostContextObserver, + public gpu::CommandBuffer, + public gpu::GpuControl { public: explicit CommandBufferClientImpl( CommandBufferDelegate* delegate, @@ -86,7 +87,7 @@ class CommandBufferClientImpl : public mojo::CommandBufferLostContextObserver, class SyncClientImpl; class SyncPointClientImpl; - // mojo::CommandBufferLostContextObserver implementation: + // mus::mojom::CommandBufferLostContextObserver implementation: void DidLoseContext(int32_t lost_reason) override; void TryUpdateState(); @@ -96,8 +97,8 @@ class CommandBufferClientImpl : public mojo::CommandBufferLostContextObserver, CommandBufferDelegate* delegate_; std::vector<int32_t> attribs_; - mojo::Binding<mojo::CommandBufferLostContextObserver> observer_binding_; - mojo::CommandBufferPtr command_buffer_; + mojo::Binding<mus::mojom::CommandBufferLostContextObserver> observer_binding_; + mus::mojom::CommandBufferPtr command_buffer_; scoped_ptr<SyncClientImpl> sync_client_impl_; scoped_ptr<SyncPointClientImpl> sync_point_client_impl_; diff --git a/ui/views/mus/surface_binding.cc b/ui/views/mus/surface_binding.cc index 168ff50..c53eb4e 100644 --- a/ui/views/mus/surface_binding.cc +++ b/ui/views/mus/surface_binding.cc @@ -64,7 +64,7 @@ class SurfaceBinding::PerConnectionState mus::WindowTreeConnection* connection_; // Set of state needed to create an OutputSurface. - mojo::GpuPtr gpu_; + mus::mojom::GpuPtr gpu_; DISALLOW_COPY_AND_ASSIGN(PerConnectionState); }; @@ -94,7 +94,7 @@ scoped_ptr<cc::OutputSurface> SurfaceBinding::PerConnectionState::CreateOutputSurface(mus::Window* window) { // TODO(sky): figure out lifetime here. Do I need to worry about the return // value outliving this? - mojo::CommandBufferPtr cb; + mus::mojom::CommandBufferPtr cb; gpu_->CreateOffscreenGLES2Context(GetProxy(&cb)); scoped_refptr<cc::ContextProvider> context_provider( diff --git a/ui/views/mus/window_manager_connection.cc b/ui/views/mus/window_manager_connection.cc index 2131f78..70f6786 100644 --- a/ui/views/mus/window_manager_connection.cc +++ b/ui/views/mus/window_manager_connection.cc @@ -7,7 +7,7 @@ #include "base/lazy_instance.h" #include "base/threading/thread_local.h" #include "components/mus/public/cpp/window_tree_connection.h" -#include "components/mus/public/interfaces/view_tree.mojom.h" +#include "components/mus/public/interfaces/window_tree.mojom.h" #include "mojo/application/public/cpp/application_connection.h" #include "mojo/application/public/cpp/application_impl.h" #include "mojo/converters/geometry/geometry_type_converters.h" @@ -98,13 +98,13 @@ WindowManagerConnection* WindowManagerConnection::Get() { } mus::Window* WindowManagerConnection::CreateWindow() { - mojo::ViewTreeClientPtr view_tree_client; - mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client_request = - GetProxy(&view_tree_client); - window_manager_->OpenWindow(view_tree_client.Pass()); + mus::mojom::WindowTreeClientPtr window_tree_client; + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> + window_tree_client_request = GetProxy(&window_tree_client); + window_manager_->OpenWindow(window_tree_client.Pass()); mus::WindowTreeConnection* window_tree_connection = mus::WindowTreeConnection::Create( - this, view_tree_client_request.Pass(), + this, window_tree_client_request.Pass(), mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); DCHECK(window_tree_connection->GetRoot()); return window_tree_connection->GetRoot(); |