summaryrefslogtreecommitdiffstats
path: root/third_party/mojo_services
diff options
context:
space:
mode:
authorviettrungluu <viettrungluu@chromium.org>2015-02-06 18:26:22 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-07 02:26:50 +0000
commitac702dad4e2b64caacb84c9c5114d4d45456e183 (patch)
tree067375329cf282e7f44cc2bfe65782723642a6df /third_party/mojo_services
parentf2104fc2a5cb2c08551d57af8f2143a987cf312f (diff)
downloadchromium_src-ac702dad4e2b64caacb84c9c5114d4d45456e183.zip
chromium_src-ac702dad4e2b64caacb84c9c5114d4d45456e183.tar.gz
chromium_src-ac702dad4e2b64caacb84c9c5114d4d45456e183.tar.bz2
Update mojo sdk to rev 8d45c89c30b230843c5bd6dd0693a555750946c0
[Taken over from blundell's https://codereview.chromium.org/901843003/, PS3.] Adapt to de-clienting of Surface. Have nacl_listener pass a SimplePlatformSupport instance to mojo::embedder::Init to satisfy the DCHECK introduced in https://codereview.chromium.org/898623002/diff/40001/mojo/edk/embedder/embedder.cc. [Additional fix backported from https://codereview.chromium.org/898423002/.] Fix mojo::embedder::CreateChannel(): the evaluation order between the channel_info->channel_id and channel_info.release() is undefined. [Additional "fix" backported from https://codereview.chromium.org/903933006/.] Add an "unnecessary" .Pass() to try to placate MSVS. [Additional fix:] surfaces_service.mojom.h -> surfaces.mojom.h R=jamesr@chromium.org NOPRESUBMIT=true CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win8_chromium_gn_dbg,win8_chromium_gn_rel Review URL: https://codereview.chromium.org/904103003 Cr-Commit-Position: refs/heads/master@{#315161}
Diffstat (limited to 'third_party/mojo_services')
-rw-r--r--third_party/mojo_services/src/geometry/public/cpp/DEPS3
-rw-r--r--third_party/mojo_services/src/gpu/public/interfaces/command_buffer.mojom18
-rw-r--r--third_party/mojo_services/src/native_viewport/public/cpp/DEPS3
-rw-r--r--third_party/mojo_services/src/public/js/application.js42
-rw-r--r--third_party/mojo_services/src/public/js/service_exchange.js (renamed from third_party/mojo_services/src/public/js/service_provider.js)14
-rw-r--r--third_party/mojo_services/src/public/js/shell.js8
-rw-r--r--third_party/mojo_services/src/public/sky/BUILD.gn2
-rw-r--r--third_party/mojo_services/src/surfaces/public/cpp/DEPS4
-rw-r--r--third_party/mojo_services/src/surfaces/public/interfaces/BUILD.gn1
-rw-r--r--third_party/mojo_services/src/surfaces/public/interfaces/surfaces.mojom25
-rw-r--r--third_party/mojo_services/src/surfaces/public/interfaces/surfaces_service.mojom15
-rw-r--r--third_party/mojo_services/src/view_manager/public/cpp/DEPS14
-rw-r--r--third_party/mojo_services/src/view_manager/public/cpp/lib/DEPS10
-rw-r--r--third_party/mojo_services/src/view_manager/public/cpp/lib/view.cc3
-rw-r--r--third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.cc44
-rw-r--r--third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.h21
-rw-r--r--third_party/mojo_services/src/view_manager/public/cpp/tests/BUILD.gn2
-rw-r--r--third_party/mojo_services/src/view_manager/public/cpp/tests/DEPS16
-rw-r--r--third_party/mojo_services/src/view_manager/public/cpp/tests/run_all_unittests.cc (renamed from third_party/mojo_services/src/view_manager/public/cpp/tests/view_manager_unittests.cc)0
-rw-r--r--third_party/mojo_services/src/view_manager/public/cpp/view_observer.h2
-rw-r--r--third_party/mojo_services/src/window_manager/public/interfaces/window_manager.mojom22
21 files changed, 109 insertions, 160 deletions
diff --git a/third_party/mojo_services/src/geometry/public/cpp/DEPS b/third_party/mojo_services/src/geometry/public/cpp/DEPS
deleted file mode 100644
index b413470..0000000
--- a/third_party/mojo_services/src/geometry/public/cpp/DEPS
+++ /dev/null
@@ -1,3 +0,0 @@
-include_rules = [
- "+geometry/public/interfaces",
-]
diff --git a/third_party/mojo_services/src/gpu/public/interfaces/command_buffer.mojom b/third_party/mojo_services/src/gpu/public/interfaces/command_buffer.mojom
index a31b3dd..aa2c556 100644
--- a/third_party/mojo_services/src/gpu/public/interfaces/command_buffer.mojom
+++ b/third_party/mojo_services/src/gpu/public/interfaces/command_buffer.mojom
@@ -25,10 +25,19 @@ interface CommandBufferSyncPointClient {
DidInsertSyncPoint(uint32 sync_point);
};
-[Client=CommandBufferClient]
+interface CommandBufferLostContextObserver {
+ DidLoseContext(int32 context_lost_reason);
+};
+
interface CommandBuffer {
+ // Initialize attempts to initialize the command buffer. Success or failure
+ // will be communicated via the CommandBufferSyncClient DidInitialize() call.
+ // If the context is lost after creation the LostContext method on the
+ // CommandBufferLostContextObserver's will be called then this pipe will be
+ // closed.
Initialize(CommandBufferSyncClient sync_client,
CommandBufferSyncPointClient sync_point_client,
+ CommandBufferLostContextObserver lost_observer,
handle<shared_buffer> shared_state);
SetGetBuffer(int32 buffer);
Flush(int32 put_offset);
@@ -43,11 +52,4 @@ interface CommandBuffer {
InsertSyncPoint(bool retire);
RetireSyncPoint(uint32 sync_point);
Echo() => ();
-
- // TODO(piman): sync points
-};
-
-interface CommandBufferClient {
- DidDestroy();
- LostContext(int32 lost_reason); // TODO(piman): enum
};
diff --git a/third_party/mojo_services/src/native_viewport/public/cpp/DEPS b/third_party/mojo_services/src/native_viewport/public/cpp/DEPS
deleted file mode 100644
index 8fc8a7f..0000000
--- a/third_party/mojo_services/src/native_viewport/public/cpp/DEPS
+++ /dev/null
@@ -1,3 +0,0 @@
-include_rules = [
- "+native_viewport/public",
-]
diff --git a/third_party/mojo_services/src/public/js/application.js b/third_party/mojo_services/src/public/js/application.js
index d4aa1e6..aea60fd 100644
--- a/third_party/mojo_services/src/public/js/application.js
+++ b/third_party/mojo_services/src/public/js/application.js
@@ -8,20 +8,19 @@ define("mojo/services/public/js/application", [
"mojo/public/js/connection",
"mojo/public/js/threading",
"mojo/public/interfaces/application/application.mojom",
- "mojo/services/public/js/service_provider",
+ "mojo/services/public/js/service_exchange",
"mojo/services/public/js/shell",
-], function(bindings, core, connection, threading, applicationMojom, serviceProvider, shell) {
+], function(bindings, core, connection, threading, applicationMojom, serviceExchange, shell) {
const ApplicationInterface = applicationMojom.Application;
const ProxyBindings = bindings.ProxyBindings;
- const ServiceProvider = serviceProvider.ServiceProvider;
+ const ServiceExchange = serviceExchange.ServiceExchange;
const Shell = shell.Shell;
class Application {
constructor(appRequestHandle, url) {
this.url = url;
- this.serviceProviders = [];
- this.exposedServiceProviders = [];
+ this.serviceExchanges = [];
this.appRequestHandle_ = appRequestHandle;
this.appStub_ =
connection.bindHandleToStub(appRequestHandle, ApplicationInterface);
@@ -37,30 +36,27 @@ define("mojo/services/public/js/application", [
this.initialize(args);
}
- initialize(args) {}
+ initialize(args) {
+ }
- // The mojom signature of this function is:
- // AcceptConnection(string requestor_url,
- // ServiceProvider&? services,
- // ServiceProvider? exposed_services);
- //
- // We want to bind |services| to our js implementation of ServiceProvider
- // and store |exposed_services| so we can request services of the connecting
- // application.
+ // Implements AcceptConnection() from Application.mojom. Calls
+ // this.acceptConnection() with a JS ServiceExchange instead of a pair
+ // of Mojo ServiceProviders.
doAcceptConnection(requestorUrl, servicesRequest, exposedServicesProxy) {
- // Construct a new js ServiceProvider that can make outgoing calls on
- // exposedServicesProxy.
- var serviceProvider =
- new ServiceProvider(servicesRequest, exposedServicesProxy);
- this.serviceProviders.push(serviceProvider);
- this.acceptConnection(requestorUrl, serviceProvider);
+ var serviceExchange =
+ new ServiceExchange(servicesRequest, exposedServicesProxy);
+ this.serviceExchanges.push(serviceExchange);
+ this.acceptConnection(requestorUrl, serviceExchange);
}
- acceptConnection(requestorUrl, serviceProvider) {}
+ // Subclasses override this method to request or provide services for
+ // ConnectToApplication() calls from requestorURL.
+ acceptConnection(requestorUrl, serviceExchange) {
+ }
quit() {
- this.serviceProviders.forEach(function(sp) {
- sp.close();
+ this.serviceExchanges.forEach(function(exch) {
+ exch.close();
});
this.shell.close();
core.close(this.appRequestHandle_);
diff --git a/third_party/mojo_services/src/public/js/service_provider.js b/third_party/mojo_services/src/public/js/service_exchange.js
index a6a81ca..a424c12 100644
--- a/third_party/mojo_services/src/public/js/service_provider.js
+++ b/third_party/mojo_services/src/public/js/service_exchange.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-define("mojo/services/public/js/service_provider", [
+define("mojo/services/public/js/service_exchange", [
"mojo/public/js/bindings",
"mojo/public/interfaces/application/service_provider.mojom",
"mojo/public/js/connection",
@@ -12,12 +12,12 @@ define("mojo/services/public/js/service_provider", [
const StubBindings = bindings.StubBindings;
const ServiceProviderInterface = spMojom.ServiceProvider;
- function checkServiceProvider(sp) {
- if (!sp.providers_)
+ function checkServiceExchange(exch) {
+ if (!exch.providers_)
throw new Error("Service was closed");
}
- class ServiceProvider {
+ class ServiceExchange {
constructor(servicesRequest, exposedServicesProxy) {
this.proxy = exposedServicesProxy;
this.providers_ = new Map(); // serviceName => see provideService() below
@@ -43,7 +43,7 @@ define("mojo/services/public/js/service_provider", [
}
provideService(service, factory) {
- checkServiceProvider(this);
+ checkServiceExchange(this);
var provider = {
service: service, // A JS bindings interface object.
@@ -61,7 +61,7 @@ define("mojo/services/public/js/service_provider", [
// Outgoing requests
requestService(interfaceObject, clientImpl) {
- checkServiceProvider(this);
+ checkServiceExchange(this);
if (!interfaceObject.name)
throw new Error("Invalid service parameter");
if (!clientImpl && interfaceObject.client)
@@ -81,6 +81,6 @@ define("mojo/services/public/js/service_provider", [
}
var exports = {};
- exports.ServiceProvider = ServiceProvider;
+ exports.ServiceExchange = ServiceExchange;
return exports;
});
diff --git a/third_party/mojo_services/src/public/js/shell.js b/third_party/mojo_services/src/public/js/shell.js
index e6c2dee..90b3533 100644
--- a/third_party/mojo_services/src/public/js/shell.js
+++ b/third_party/mojo_services/src/public/js/shell.js
@@ -8,12 +8,12 @@ define("mojo/services/public/js/shell", [
"mojo/public/js/connection",
"mojo/public/interfaces/application/shell.mojom",
"mojo/public/interfaces/application/service_provider.mojom",
- "mojo/services/public/js/service_provider","console",
-], function(bindings, core, connection, shellMojom, spMojom, sp, console) {
+ "mojo/services/public/js/service_exchange",
+], function(bindings, core, connection, shellMojom, spMojom, serviceExchange) {
const ProxyBindings = bindings.ProxyBindings;
const StubBindings = bindings.StubBindings;
- const ServiceProvider = sp.ServiceProvider;
+ const ServiceExchange = serviceExchange.ServiceExchange;
const ServiceProviderInterface = spMojom.ServiceProvider;
const ShellInterface = shellMojom.Shell;
@@ -28,7 +28,7 @@ define("mojo/services/public/js/shell", [
if (application)
return application;
- var application = new ServiceProvider();
+ var application = new ServiceExchange();
this.shellProxy.connectToApplication(url,
function(services) {
application.proxy = services;
diff --git a/third_party/mojo_services/src/public/sky/BUILD.gn b/third_party/mojo_services/src/public/sky/BUILD.gn
index 4776aa3..2c5c63c 100644
--- a/third_party/mojo_services/src/public/sky/BUILD.gn
+++ b/third_party/mojo_services/src/public/sky/BUILD.gn
@@ -6,7 +6,7 @@ action_foreach("sky") {
script = "../../../public/sky/convert_amd_modules_to_sky.py"
sources = [
"../js/application.js",
- "../js/service_provider.js",
+ "../js/service_exchange.js",
"../js/shell.js",
]
outputs = [
diff --git a/third_party/mojo_services/src/surfaces/public/cpp/DEPS b/third_party/mojo_services/src/surfaces/public/cpp/DEPS
deleted file mode 100644
index bc9750c..0000000
--- a/third_party/mojo_services/src/surfaces/public/cpp/DEPS
+++ /dev/null
@@ -1,4 +0,0 @@
-include_rules = [
- "+geometry/public/interfaces",
- "+surfaces/public",
-]
diff --git a/third_party/mojo_services/src/surfaces/public/interfaces/BUILD.gn b/third_party/mojo_services/src/surfaces/public/interfaces/BUILD.gn
index 76f5172..aaab024 100644
--- a/third_party/mojo_services/src/surfaces/public/interfaces/BUILD.gn
+++ b/third_party/mojo_services/src/surfaces/public/interfaces/BUILD.gn
@@ -9,7 +9,6 @@ mojom("interfaces") {
sources = [
"quads.mojom",
"surfaces.mojom",
- "surfaces_service.mojom",
]
import_dirs = [ get_path_info("../../../", "abspath") ]
diff --git a/third_party/mojo_services/src/surfaces/public/interfaces/surfaces.mojom b/third_party/mojo_services/src/surfaces/public/interfaces/surfaces.mojom
index 7badcd3..71aed7e 100644
--- a/third_party/mojo_services/src/surfaces/public/interfaces/surfaces.mojom
+++ b/third_party/mojo_services/src/surfaces/public/interfaces/surfaces.mojom
@@ -52,21 +52,28 @@ struct Frame {
array<Pass> passes;
};
-interface SurfaceClient {
- // This sets the id namespace for this connection. This method will be invoked
- // exactly once when a new connection is established.
- SetIdNamespace(uint32 id_namespace);
+interface ResourceReturner {
ReturnResources(array<ReturnedResource> resources);
};
-[Client=SurfaceClient]
interface Surface {
+ // Request the id namespace for this connection. Fully qualified surface ids
+ // are the combination of the id_namespace for the connection that created the
+ // surface and the id_local component allocated by the caller.
+ GetIdNamespace() => (uint32 id_namespace);
+
+ // Sets a ResourceReturner that will receive unused resources.
+ SetResourceReturner(ResourceReturner returner);
+
+ // Creates a new surface with the given local identifier. Once a surface is
+ // created the caller may submit frames to it or destroy it using the local
+ // identifier. The caller can also produce a fully qualified surface id that
+ // can be embedded in frames produces by different connections.
CreateSurface(uint32 id_local);
- // The client can only submit frames to surfaces created with this
- // connection. After the submitted frame is drawn for the first time, the
- // surface will respond to the SubmitFrame message. Clients should use this
- // acknowledgement to ratelimit frame submissions.
+ // After the submitted frame is drawn for the first time, the surface will
+ // respond to the SubmitFrame message. Clients should use this acknowledgement
+ // to ratelimit frame submissions.
SubmitFrame(uint32 id_local, Frame frame) => ();
DestroySurface(uint32 id_local);
diff --git a/third_party/mojo_services/src/surfaces/public/interfaces/surfaces_service.mojom b/third_party/mojo_services/src/surfaces/public/interfaces/surfaces_service.mojom
deleted file mode 100644
index e1ca690..0000000
--- a/third_party/mojo_services/src/surfaces/public/interfaces/surfaces_service.mojom
+++ /dev/null
@@ -1,15 +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 "surfaces/public/interfaces/surfaces.mojom";
-
-// Use this interface to request connections to the surfaces service. Each
-// connection is associated with an id namespace
-interface SurfacesService {
- // DEPRECATED: Just connect to mojo.Surface directly and receive the id
- // namespace via SetIdNamespace.
- CreateSurfaceConnection() => (Surface surface, uint32 id_namespace);
-};
diff --git a/third_party/mojo_services/src/view_manager/public/cpp/DEPS b/third_party/mojo_services/src/view_manager/public/cpp/DEPS
deleted file mode 100644
index c08c2c8..0000000
--- a/third_party/mojo_services/src/view_manager/public/cpp/DEPS
+++ /dev/null
@@ -1,14 +0,0 @@
-include_rules = [
- "+geometry/public",
- "+input_events/public",
- "+surfaces/public",
- "+view_manager/public",
- "+window_manager/public",
-
- # TODO(blundell): Eliminate these dependencies. crbug.com/451403
- "!base/basictypes.h",
- "!base/bind.h",
- "!base/compiler_specific.h",
- "!base/memory/scoped_ptr.h",
- "!base/observer_list.h",
-]
diff --git a/third_party/mojo_services/src/view_manager/public/cpp/lib/DEPS b/third_party/mojo_services/src/view_manager/public/cpp/lib/DEPS
deleted file mode 100644
index f36ebc7..0000000
--- a/third_party/mojo_services/src/view_manager/public/cpp/lib/DEPS
+++ /dev/null
@@ -1,10 +0,0 @@
-include_rules = [
- "+mojo/services/window_manager/public",
-
- # TODO(blundell): Eliminate these dependencies. crbug.com/451403
- "!base/callback.h",
- "!base/memory/scoped_vector.h",
- "!base/memory/weak_ptr.h",
- "!base/message_loop/message_loop.h",
- "!base/stl_util.h",
-]
diff --git a/third_party/mojo_services/src/view_manager/public/cpp/lib/view.cc b/third_party/mojo_services/src/view_manager/public/cpp/lib/view.cc
index d347292..ba3b61c 100644
--- a/third_party/mojo_services/src/view_manager/public/cpp/lib/view.cc
+++ b/third_party/mojo_services/src/view_manager/public/cpp/lib/view.cc
@@ -389,7 +389,8 @@ ViewportMetricsPtr CreateEmptyViewportMetrics() {
metrics->size = Size::New();
return metrics.Pass();
}
-}
+
+} // namespace
View::View()
: manager_(NULL),
diff --git a/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.cc b/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.cc
index 595e039..eea760b 100644
--- a/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.cc
+++ b/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.cc
@@ -105,6 +105,7 @@ ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate,
capture_view_(nullptr),
focused_view_(nullptr),
activated_view_(nullptr),
+ wm_observer_binding_(this),
binding_(this, handle.Pass()),
service_(binding_.client()),
delete_on_error_(delete_on_error) {
@@ -272,10 +273,12 @@ void ViewManagerClientImpl::OnEmbed(
root_->AddObserver(new RootObserver(root_));
window_manager_.Bind(window_manager_pipe.Pass());
- window_manager_.set_client(this);
// base::Unretained() is safe here as |window_manager_| is bound to our
// lifetime.
+ WindowManagerObserverPtr observer;
+ wm_observer_binding_.Bind(GetProxy(&observer));
window_manager_->GetFocusedAndActiveViews(
+ observer.Pass(),
base::Bind(&ViewManagerClientImpl::OnGotFocusedAndActiveViews,
base::Unretained(this)));
@@ -397,12 +400,11 @@ void ViewManagerClientImpl::OnViewInputEvent(
}
////////////////////////////////////////////////////////////////////////////////
-// ViewManagerClientImpl, WindowManagerClient implementation:
+// ViewManagerClientImpl, WindowManagerObserver implementation:
-void ViewManagerClientImpl::OnCaptureChanged(Id old_capture_view_id,
- Id new_capture_view_id) {
- View* gained_capture = GetViewById(new_capture_view_id);
- View* lost_capture = GetViewById(old_capture_view_id);
+void ViewManagerClientImpl::OnCaptureChanged(Id capture_view_id) {
+ View* gained_capture = GetViewById(capture_view_id);
+ View* lost_capture = capture_view_;
if (lost_capture) {
FOR_EACH_OBSERVER(ViewObserver,
*ViewPrivate(lost_capture).observers(),
@@ -416,10 +418,9 @@ void ViewManagerClientImpl::OnCaptureChanged(Id old_capture_view_id,
}
}
-void ViewManagerClientImpl::OnFocusChanged(Id old_focused_view_id,
- Id new_focused_view_id) {
- View* focused = GetViewById(new_focused_view_id);
- View* blurred = GetViewById(old_focused_view_id);
+void ViewManagerClientImpl::OnFocusChanged(Id focused_view_id) {
+ View* focused = GetViewById(focused_view_id);
+ View* blurred = focused_view_;
if (blurred) {
FOR_EACH_OBSERVER(ViewObserver,
*ViewPrivate(blurred).observers(),
@@ -433,10 +434,9 @@ void ViewManagerClientImpl::OnFocusChanged(Id old_focused_view_id,
}
}
-void ViewManagerClientImpl::OnActiveWindowChanged(Id old_active_view_id,
- Id new_active_view_id) {
- View* activated = GetViewById(new_active_view_id);
- View* deactivated = GetViewById(old_active_view_id);
+void ViewManagerClientImpl::OnActiveWindowChanged(Id active_view_id) {
+ View* activated = GetViewById(active_view_id);
+ View* deactivated = activated_view_;
if (deactivated) {
FOR_EACH_OBSERVER(ViewObserver,
*ViewPrivate(deactivated).observers(),
@@ -485,14 +485,16 @@ base::Callback<void(ErrorCode)>
base::Unretained(this));
}
-void ViewManagerClientImpl::OnGotFocusedAndActiveViews(uint32 focused_view_id,
- uint32 active_view_id) {
+void ViewManagerClientImpl::OnGotFocusedAndActiveViews(
+ uint32_t capture_view_id,
+ uint32_t focused_view_id,
+ uint32_t active_view_id) {
+ if (GetViewById(capture_view_id) != capture_view_)
+ OnCaptureChanged(capture_view_id);
if (GetViewById(focused_view_id) != focused_view_)
- OnFocusChanged(focused_view_ ? focused_view_->id() : 0, focused_view_id);
- if (GetViewById(active_view_id) != activated_view_) {
- OnActiveWindowChanged(activated_view_ ? activated_view_->id() : 0,
- active_view_id);
- }
+ OnFocusChanged(focused_view_id);
+ if (GetViewById(active_view_id) != activated_view_)
+ OnActiveWindowChanged(active_view_id);
}
} // namespace mojo
diff --git a/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.h b/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.h
index 2405229..e0d7bba 100644
--- a/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.h
+++ b/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_impl.h
@@ -5,7 +5,6 @@
#ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_
#define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_
-#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
@@ -25,7 +24,7 @@ class ViewManagerTransaction;
// Manages the connection with the View Manager service.
class ViewManagerClientImpl : public ViewManager,
public ViewManagerClient,
- public WindowManagerClient,
+ public WindowManagerObserver,
public ErrorHandler {
public:
ViewManagerClientImpl(ViewManagerDelegate* delegate,
@@ -122,12 +121,10 @@ class ViewManagerClientImpl : public ViewManager,
EventPtr event,
const Callback<void()>& callback) override;
- // Overridden from WindowManagerClient:
- void OnCaptureChanged(Id old_capture_view_id,
- Id new_capture_view_id) override;
- void OnFocusChanged(Id old_focused_view_id, Id new_focused_view_id) override;
- void OnActiveWindowChanged(Id old_focused_view_id,
- Id new_focused_view_id) override;
+ // Overridden from WindowManagerObserver:
+ void OnCaptureChanged(Id capture_view_id) override;
+ void OnFocusChanged(Id focused_view_id) override;
+ void OnActiveWindowChanged(Id focused_view_id) override;
// ErrorHandler implementation.
void OnConnectionError() override;
@@ -140,9 +137,10 @@ class ViewManagerClientImpl : public ViewManager,
base::Callback<void(bool)> ActionCompletedCallback();
base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode();
- // Callback from server for initial request of focused/active views.
- void OnGotFocusedAndActiveViews(uint32 focused_view_id,
- uint32 active_view_id);
+ // Callback from server for initial request of capture/focused/active views.
+ void OnGotFocusedAndActiveViews(uint32_t capture_view_id,
+ uint32_t focused_view_id,
+ uint32_t active_view_id);
bool connected_;
ConnectionSpecificId connection_id_;
@@ -163,6 +161,7 @@ class ViewManagerClientImpl : public ViewManager,
View* activated_view_;
WindowManagerPtr window_manager_;
+ Binding<WindowManagerObserver> wm_observer_binding_;
Binding<ViewManagerClient> binding_;
ViewManagerService* service_;
diff --git a/third_party/mojo_services/src/view_manager/public/cpp/tests/BUILD.gn b/third_party/mojo_services/src/view_manager/public/cpp/tests/BUILD.gn
index e912084..3414d33 100644
--- a/third_party/mojo_services/src/view_manager/public/cpp/tests/BUILD.gn
+++ b/third_party/mojo_services/src/view_manager/public/cpp/tests/BUILD.gn
@@ -7,10 +7,10 @@ import("//testing/test.gni")
test("mojo_view_manager_lib_unittests") {
sources = [
+ "run_all_unittests.cc",
"view_manager_test_suite.cc",
"view_manager_test_suite.h",
"view_manager_unittest.cc",
- "view_manager_unittests.cc",
"view_unittest.cc",
]
diff --git a/third_party/mojo_services/src/view_manager/public/cpp/tests/DEPS b/third_party/mojo_services/src/view_manager/public/cpp/tests/DEPS
deleted file mode 100644
index 0f9ddb4..0000000
--- a/third_party/mojo_services/src/view_manager/public/cpp/tests/DEPS
+++ /dev/null
@@ -1,16 +0,0 @@
-include_rules = [
- "+mojo/services/geometry/public",
-
- # TODO(blundell): Determine whether to eliminate these dependencies or move
- # the tests outside of view_manager's public code. crbug.com/451403
- "!base/auto_reset.h",
- "!base/bind.h",
- "!base/i18n/icu_util.h",
- "!base/logging.h",
- "!base/strings/stringprintf.h",
- "!base/test/launcher/unit_test_launcher.h",
- "!base/test/test_suite.h",
- "!shell/application_manager",
- "!shell/shell_test_helper.h",
- "!ui/gfx/x/x11_connection.h",
-]
diff --git a/third_party/mojo_services/src/view_manager/public/cpp/tests/view_manager_unittests.cc b/third_party/mojo_services/src/view_manager/public/cpp/tests/run_all_unittests.cc
index 95a7b5c..95a7b5c 100644
--- a/third_party/mojo_services/src/view_manager/public/cpp/tests/view_manager_unittests.cc
+++ b/third_party/mojo_services/src/view_manager/public/cpp/tests/run_all_unittests.cc
diff --git a/third_party/mojo_services/src/view_manager/public/cpp/view_observer.h b/third_party/mojo_services/src/view_manager/public/cpp/view_observer.h
index 7430566..f059e11 100644
--- a/third_party/mojo_services/src/view_manager/public/cpp/view_observer.h
+++ b/third_party/mojo_services/src/view_manager/public/cpp/view_observer.h
@@ -61,7 +61,7 @@ class ViewObserver {
const ViewportMetrics& new_bounds) {
}
- virtual void OnCaptureChanged(View* gained_capture, View* lost_capture) {}
+ virtual void OnViewCaptureChanged(View* gained_capture, View* lost_capture) {}
virtual void OnViewFocusChanged(View* gained_focus, View* lost_focus) {}
virtual void OnViewActivationChanged(View* gained_active, View* lost_active) {
}
diff --git a/third_party/mojo_services/src/window_manager/public/interfaces/window_manager.mojom b/third_party/mojo_services/src/window_manager/public/interfaces/window_manager.mojom
index e365fb6..ee1b02e 100644
--- a/third_party/mojo_services/src/window_manager/public/interfaces/window_manager.mojom
+++ b/third_party/mojo_services/src/window_manager/public/interfaces/window_manager.mojom
@@ -7,22 +7,30 @@ module mojo;
import "input_events/public/interfaces/input_events.mojom";
import "mojo/public/interfaces/application/service_provider.mojom";
-[Client=WindowManagerClient]
interface WindowManager {
// Requests the WindowManager to embed the app for |url| at an appropriate
// View. See ViewMangerService::Embed() for details on |services| and
// |exposed_services|.
- Embed(string url, ServiceProvider&? services, ServiceProvider? exposed_services);
+ Embed(string url,
+ ServiceProvider&? services,
+ ServiceProvider? exposed_services);
SetCapture(uint32 view_id) => (bool success);
FocusWindow(uint32 view_id) => (bool success);
ActivateWindow(uint32 view_id) => (bool success);
- GetFocusedAndActiveViews() => (uint32 focused_view_id, uint32 active_view_id);
+ // Requests the current focus and activation state and an interface to observe
+ // future changes.
+ // If |observer| is not null capture, focus and activation updates will be
+ // sent to it.
+ GetFocusedAndActiveViews(WindowManagerObserver? observer)
+ => (uint32 capture_view_id,
+ uint32 focused_view_id,
+ uint32 active_view_id);
};
-interface WindowManagerClient {
- OnCaptureChanged(uint32 old_capture_view_id, uint32 new_capture_view_id);
- OnFocusChanged(uint32 old_focused_view_id, uint32 new_focused_view_id);
- OnActiveWindowChanged(uint32 old_focused_view_id, uint32 new_focused_view_id);
+interface WindowManagerObserver {
+ OnCaptureChanged(uint32 capture_view_id);
+ OnFocusChanged(uint32 focused_view_id);
+ OnActiveWindowChanged(uint32 focused_view_id);
};