diff options
author | viettrungluu <viettrungluu@chromium.org> | 2015-02-09 15:30:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-09 23:31:30 +0000 |
commit | 2e86fb9356e3a693762d3c86c70e63951bd9d1be (patch) | |
tree | b618ca637c6ab2517f44967b435aeba2b2c548a0 /third_party/mojo_services | |
parent | ececadd5dd84f2f7724791ad46c7ec23cdd43b2f (diff) | |
download | chromium_src-2e86fb9356e3a693762d3c86c70e63951bd9d1be.zip chromium_src-2e86fb9356e3a693762d3c86c70e63951bd9d1be.tar.gz chromium_src-2e86fb9356e3a693762d3c86c70e63951bd9d1be.tar.bz2 |
Update mojo sdk to rev 8af2ccff2eee4bfca1043015abee30482a030b30
Also apply mojo 8fda9302f51f99dc25e6e0c95cfd0a04e1adc802 (https://codereview.chromium.org/902783004/).
Also apply mojo e62ed5fbf8bb4d7cfa87f499b1d1b50bdf8e0b3b (https://codereview.chromium.org/905253005/).
Also apply dcf5a5e1dbccb91f774d545b5f31d06042d8a8e3 (https://codereview.chromium.org/909903003/).
TBR=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/910883002
Cr-Commit-Position: refs/heads/master@{#315432}
Diffstat (limited to 'third_party/mojo_services')
8 files changed, 56 insertions, 36 deletions
diff --git a/third_party/mojo_services/src/public/js/shell.js b/third_party/mojo_services/src/public/js/shell.js index 90b3533..358f272 100644 --- a/third_party/mojo_services/src/public/js/shell.js +++ b/third_party/mojo_services/src/public/js/shell.js @@ -30,10 +30,13 @@ define("mojo/services/public/js/shell", [ var application = new ServiceExchange(); this.shellProxy.connectToApplication(url, - function(services) { - application.proxy = services; + function(servicesProxy) { + application.proxy = servicesProxy; }, - application); + function(exposedServicesStub) { + application.stub = exposedServicesStub; + StubBindings(exposedServicesStub).delegate = application; + }); this.applications_.set(url, application); return application; } 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 ba3b61c..4a70072 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 @@ -387,6 +387,8 @@ namespace { ViewportMetricsPtr CreateEmptyViewportMetrics() { ViewportMetricsPtr metrics = ViewportMetrics::New(); metrics->size = Size::New(); + // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove it + // once that's fixed. return metrics.Pass(); } diff --git a/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_factory.cc b/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_factory.cc index be4463c..cfa2b79 100644 --- a/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_factory.cc +++ b/third_party/mojo_services/src/view_manager/public/cpp/lib/view_manager_client_factory.cc @@ -21,12 +21,14 @@ ViewManagerClientFactory::~ViewManagerClientFactory() { // static scoped_ptr<ViewManagerClient> ViewManagerClientFactory::WeakBindViewManagerToPipe( - ScopedMessagePipeHandle handle, + InterfaceRequest<ViewManagerClient> request, + ViewManagerServicePtr view_manager_service, Shell* shell, ViewManagerDelegate* delegate) { const bool delete_on_error = false; scoped_ptr<ViewManagerClientImpl> client(new ViewManagerClientImpl( - delegate, shell, handle.Pass(), delete_on_error)); + delegate, shell, request.Pass(), delete_on_error)); + client->SetViewManagerService(view_manager_service.Pass()); return client.Pass(); } @@ -35,8 +37,7 @@ void ViewManagerClientFactory::Create( ApplicationConnection* connection, InterfaceRequest<ViewManagerClient> request) { const bool delete_on_error = true; - new ViewManagerClientImpl(delegate_, shell_, request.PassMessagePipe(), - delete_on_error); + new ViewManagerClientImpl(delegate_, shell_, request.Pass(), delete_on_error); } } // namespace mojo 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 eea760b..3fffac2 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 @@ -93,12 +93,12 @@ class RootObserver : public ViewObserver { DISALLOW_COPY_AND_ASSIGN(RootObserver); }; -ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate, - Shell* shell, - ScopedMessagePipeHandle handle, - bool delete_on_error) - : connected_(false), - connection_id_(0), +ViewManagerClientImpl::ViewManagerClientImpl( + ViewManagerDelegate* delegate, + Shell* shell, + InterfaceRequest<ViewManagerClient> request, + bool delete_on_error) + : connection_id_(0), next_id_(1), delegate_(delegate), root_(nullptr), @@ -106,8 +106,7 @@ ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate, focused_view_(nullptr), activated_view_(nullptr), wm_observer_binding_(this), - binding_(this, handle.Pass()), - service_(binding_.client()), + binding_(this, request.Pass()), delete_on_error_(delete_on_error) { } @@ -133,17 +132,17 @@ ViewManagerClientImpl::~ViewManagerClientImpl() { } void ViewManagerClientImpl::DestroyView(Id view_id) { - DCHECK(connected_); + DCHECK(service_); service_->DeleteView(view_id, ActionCompletedCallback()); } void ViewManagerClientImpl::AddChild(Id child_id, Id parent_id) { - DCHECK(connected_); + DCHECK(service_); service_->AddView(parent_id, child_id, ActionCompletedCallback()); } void ViewManagerClientImpl::RemoveChild(Id child_id, Id parent_id) { - DCHECK(connected_); + DCHECK(service_); service_->RemoveViewFromParent(child_id, ActionCompletedCallback()); } @@ -151,7 +150,7 @@ void ViewManagerClientImpl::Reorder( Id view_id, Id relative_view_id, OrderDirection direction) { - DCHECK(connected_); + DCHECK(service_); service_->ReorderView(view_id, relative_view_id, direction, ActionCompletedCallback()); } @@ -161,12 +160,12 @@ bool ViewManagerClientImpl::OwnsView(Id id) const { } void ViewManagerClientImpl::SetBounds(Id view_id, const Rect& bounds) { - DCHECK(connected_); + DCHECK(service_); service_->SetViewBounds(view_id, bounds.Clone(), ActionCompletedCallback()); } void ViewManagerClientImpl::SetSurfaceId(Id view_id, SurfaceIdPtr surface_id) { - DCHECK(connected_); + DCHECK(service_); if (surface_id.is_null()) return; service_->SetViewSurfaceId( @@ -181,7 +180,7 @@ void ViewManagerClientImpl::SetFocus(Id view_id) { } void ViewManagerClientImpl::SetVisible(Id view_id, bool visible) { - DCHECK(connected_); + DCHECK(service_); service_->SetViewVisibility(view_id, visible, ActionCompletedCallback()); } @@ -189,7 +188,7 @@ void ViewManagerClientImpl::SetProperty( Id view_id, const std::string& name, const std::vector<uint8_t>& data) { - DCHECK(connected_); + DCHECK(service_); service_->SetViewProperty(view_id, String(name), Array<uint8_t>::From(data), @@ -204,7 +203,7 @@ void ViewManagerClientImpl::Embed(const String& url, Id view_id, InterfaceRequest<ServiceProvider> services, ServiceProviderPtr exposed_services) { - DCHECK(connected_); + DCHECK(service_); service_->Embed(url, view_id, services.Pass(), exposed_services.Pass(), ActionCompletedCallback()); } @@ -220,11 +219,17 @@ void ViewManagerClientImpl::RemoveView(Id view_id) { views_.erase(it); } +void ViewManagerClientImpl::SetViewManagerService( + ViewManagerServicePtr service) { + DCHECK(!service_); + DCHECK(service); + service_ = service.Pass(); +} //////////////////////////////////////////////////////////////////////////////// // ViewManagerClientImpl, ViewManager implementation: Id ViewManagerClientImpl::CreateViewOnServer() { - DCHECK(connected_); + DCHECK(service_); const Id view_id = MakeTransportId(connection_id_, ++next_id_); service_->CreateView(view_id, ActionCompletedCallbackWithErrorCode()); return view_id; @@ -260,11 +265,14 @@ void ViewManagerClientImpl::OnEmbed( ConnectionSpecificId connection_id, const String& creator_url, ViewDataPtr root_data, + ViewManagerServicePtr view_manager_service, InterfaceRequest<ServiceProvider> services, ServiceProviderPtr exposed_services, ScopedMessagePipeHandle window_manager_pipe) { - DCHECK(!connected_); - connected_ = true; + if (view_manager_service) { + DCHECK(!service_); + service_ = view_manager_service.Pass(); + } connection_id_ = connection_id; creator_url_ = String::From(creator_url); 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 e0d7bba..b3dd1fd 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 @@ -29,11 +29,11 @@ class ViewManagerClientImpl : public ViewManager, public: ViewManagerClientImpl(ViewManagerDelegate* delegate, Shell* shell, - ScopedMessagePipeHandle handle, + InterfaceRequest<ViewManagerClient> request, bool delete_on_error); ~ViewManagerClientImpl() override; - bool connected() const { return connected_; } + bool connected() const { return service_; } ConnectionSpecificId connection_id() const { return connection_id_; } // API exposed to the view implementations that pushes local changes to the @@ -77,6 +77,8 @@ class ViewManagerClientImpl : public ViewManager, void AddView(View* view); void RemoveView(Id view_id); + void SetViewManagerService(ViewManagerServicePtr service); + private: friend class RootObserver; @@ -95,6 +97,7 @@ class ViewManagerClientImpl : public ViewManager, void OnEmbed(ConnectionSpecificId connection_id, const String& creator_url, ViewDataPtr root, + ViewManagerServicePtr view_manager_service, InterfaceRequest<ServiceProvider> services, ServiceProviderPtr exposed_services, ScopedMessagePipeHandle window_manager_pipe) override; @@ -142,7 +145,6 @@ class ViewManagerClientImpl : public ViewManager, uint32_t focused_view_id, uint32_t active_view_id); - bool connected_; ConnectionSpecificId connection_id_; ConnectionSpecificId next_id_; @@ -164,7 +166,7 @@ class ViewManagerClientImpl : public ViewManager, Binding<WindowManagerObserver> wm_observer_binding_; Binding<ViewManagerClient> binding_; - ViewManagerService* service_; + ViewManagerServicePtr service_; const bool delete_on_error_; DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); diff --git a/third_party/mojo_services/src/view_manager/public/cpp/view_manager_client_factory.h b/third_party/mojo_services/src/view_manager/public/cpp/view_manager_client_factory.h index 35b1245..edb5ca3 100644 --- a/third_party/mojo_services/src/view_manager/public/cpp/view_manager_client_factory.h +++ b/third_party/mojo_services/src/view_manager/public/cpp/view_manager_client_factory.h @@ -24,7 +24,8 @@ class ViewManagerClientFactory : public InterfaceFactory<ViewManagerClient> { // Creates a ViewManagerClient from the supplied arguments. static scoped_ptr<ViewManagerClient> WeakBindViewManagerToPipe( - ScopedMessagePipeHandle handle, + InterfaceRequest<ViewManagerClient> request, + ViewManagerServicePtr view_manager_service, Shell* shell, ViewManagerDelegate* delegate); diff --git a/third_party/mojo_services/src/view_manager/public/interfaces/view_manager.mojom b/third_party/mojo_services/src/view_manager/public/interfaces/view_manager.mojom index 23238d5..961b783 100644 --- a/third_party/mojo_services/src/view_manager/public/interfaces/view_manager.mojom +++ b/third_party/mojo_services/src/view_manager/public/interfaces/view_manager.mojom @@ -35,7 +35,6 @@ enum ErrorCode { // 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. -[Client=ViewManagerClient] interface ViewManagerService { // 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). @@ -139,14 +138,16 @@ interface ViewManagerService { // 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 OnViewBoundsChanged(). -[Client=ViewManagerService] interface ViewManagerClient { // Invoked when the client application has been embedded at |root|. - // See Embed() on ViewManagerService for more details. |window_manager_pipe| - // is a pipe to the WindowManager. + // See Embed() on ViewManagerService for more details. |view_manager_service| + // will be a handle back to the view manager service, unless the connection is + // to the WindowManager in which case it will be null. + // |window_manager_pipe| is a pipe to the WindowManager. OnEmbed(uint16 connection_id, string embedder_url, ViewData root, + ViewManagerService? view_manager_service, ServiceProvider&? services, ServiceProvider? exposed_services, handle<message_pipe> window_manager_pipe); diff --git a/third_party/mojo_services/src/window_manager/public/interfaces/window_manager_internal.mojom b/third_party/mojo_services/src/window_manager/public/interfaces/window_manager_internal.mojom index 6b85632..bdb655d 100644 --- a/third_party/mojo_services/src/window_manager/public/interfaces/window_manager_internal.mojom +++ b/third_party/mojo_services/src/window_manager/public/interfaces/window_manager_internal.mojom @@ -16,6 +16,8 @@ interface WindowManagerInternal { CreateWindowManagerForViewManagerClient( uint16 connection_id, handle<message_pipe> window_manager_pipe); + + SetViewManagerClient(handle<message_pipe> view_manager_client_request); }; // WindowManagerInternalClient is an interface provide by the ViewManager |