| Index: components/mus/public/cpp/lib/view_tree_client_impl.cc
|
| diff --git a/components/mus/public/cpp/lib/view_tree_client_impl.cc b/components/mus/public/cpp/lib/view_tree_client_impl.cc
|
| index b7a157d14ca8823953fcf8f44609c23e6f97583f..8673e7b7c73f251e8bdd79a8169e7821b9d10693 100644
|
| --- a/components/mus/public/cpp/lib/view_tree_client_impl.cc
|
| +++ b/components/mus/public/cpp/lib/view_tree_client_impl.cc
|
| @@ -14,7 +14,7 @@
|
| #include "mojo/application/public/cpp/service_provider_impl.h"
|
| #include "mojo/application/public/interfaces/service_provider.mojom.h"
|
|
|
| -namespace mojo {
|
| +namespace mus {
|
|
|
| Id MakeTransportId(ConnectionSpecificId connection_id,
|
| ConnectionSpecificId local_id) {
|
| @@ -24,7 +24,7 @@ Id MakeTransportId(ConnectionSpecificId connection_id,
|
| // Helper called to construct a local view object from transport data.
|
| View* AddViewToConnection(ViewTreeClientImpl* client,
|
| View* parent,
|
| - const ViewDataPtr& view_data) {
|
| + const mojo::ViewDataPtr& view_data) {
|
| // We don't use the cto that takes a ViewTreeConnection here, since it will
|
| // call back to the service and attempt to create a new view.
|
| View* view = ViewPrivate::LocalCreate();
|
| @@ -33,19 +33,19 @@ View* AddViewToConnection(ViewTreeClientImpl* client,
|
| private_view.set_id(view_data->view_id);
|
| private_view.set_visible(view_data->visible);
|
| private_view.set_drawn(view_data->drawn);
|
| - private_view.LocalSetViewportMetrics(ViewportMetrics(),
|
| + private_view.LocalSetViewportMetrics(mojo::ViewportMetrics(),
|
| *view_data->viewport_metrics);
|
| private_view.set_properties(
|
| view_data->properties.To<std::map<std::string, std::vector<uint8_t>>>());
|
| client->AddView(view);
|
| - private_view.LocalSetBounds(Rect(), *view_data->bounds);
|
| + private_view.LocalSetBounds(mojo::Rect(), *view_data->bounds);
|
| if (parent)
|
| ViewPrivate(parent).LocalAddChild(view);
|
| return view;
|
| }
|
|
|
| View* BuildViewTree(ViewTreeClientImpl* client,
|
| - const Array<ViewDataPtr>& views,
|
| + const mojo::Array<mojo::ViewDataPtr>& views,
|
| View* initial_parent) {
|
| std::vector<View*> parents;
|
| View* root = NULL;
|
| @@ -70,12 +70,13 @@ View* BuildViewTree(ViewTreeClientImpl* client,
|
|
|
| ViewTreeConnection* ViewTreeConnection::Create(
|
| ViewTreeDelegate* delegate,
|
| - InterfaceRequest<ViewTreeClient> request) {
|
| + mojo::InterfaceRequest<mojo::ViewTreeClient> request) {
|
| return new ViewTreeClientImpl(delegate, request.Pass());
|
| }
|
|
|
| -ViewTreeClientImpl::ViewTreeClientImpl(ViewTreeDelegate* delegate,
|
| - InterfaceRequest<ViewTreeClient> request)
|
| +ViewTreeClientImpl::ViewTreeClientImpl(
|
| + ViewTreeDelegate* delegate,
|
| + mojo::InterfaceRequest<mojo::ViewTreeClient> request)
|
| : connection_id_(0),
|
| next_id_(1),
|
| delegate_(delegate),
|
| @@ -128,7 +129,7 @@ void ViewTreeClientImpl::RemoveChild(Id child_id, Id parent_id) {
|
|
|
| void ViewTreeClientImpl::Reorder(Id view_id,
|
| Id relative_view_id,
|
| - OrderDirection direction) {
|
| + mojo::OrderDirection direction) {
|
| DCHECK(tree_);
|
| tree_->ReorderView(view_id, relative_view_id, direction,
|
| ActionCompletedCallback());
|
| @@ -138,7 +139,7 @@ bool ViewTreeClientImpl::OwnsView(Id id) const {
|
| return HiWord(id) == connection_id_;
|
| }
|
|
|
| -void ViewTreeClientImpl::SetBounds(Id view_id, const Rect& bounds) {
|
| +void ViewTreeClientImpl::SetBounds(Id view_id, const mojo::Rect& bounds) {
|
| DCHECK(tree_);
|
| tree_->SetViewBounds(view_id, bounds.Clone(), ActionCompletedCallback());
|
| }
|
| @@ -159,19 +160,20 @@ void ViewTreeClientImpl::SetProperty(Id view_id,
|
| const std::string& name,
|
| const std::vector<uint8_t>& data) {
|
| DCHECK(tree_);
|
| - tree_->SetViewProperty(view_id, String(name), Array<uint8_t>::From(data),
|
| + tree_->SetViewProperty(view_id, mojo::String(name),
|
| + mojo::Array<uint8_t>::From(data),
|
| ActionCompletedCallback());
|
| }
|
|
|
| void ViewTreeClientImpl::SetViewTextInputState(Id view_id,
|
| - TextInputStatePtr state) {
|
| + mojo::TextInputStatePtr state) {
|
| DCHECK(tree_);
|
| tree_->SetViewTextInputState(view_id, state.Pass());
|
| }
|
|
|
| void ViewTreeClientImpl::SetImeVisibility(Id view_id,
|
| bool visible,
|
| - TextInputStatePtr state) {
|
| + mojo::TextInputStatePtr state) {
|
| DCHECK(tree_);
|
| tree_->SetImeVisibility(view_id, visible, state.Pass());
|
| }
|
| @@ -182,15 +184,16 @@ void ViewTreeClientImpl::SetAccessPolicy(Id view_id, uint32_t access_policy) {
|
| }
|
|
|
| void ViewTreeClientImpl::Embed(Id view_id,
|
| - ViewTreeClientPtr client,
|
| - const ViewTree::EmbedCallback& callback) {
|
| + mojo::ViewTreeClientPtr client,
|
| + const mojo::ViewTree::EmbedCallback& callback) {
|
| DCHECK(tree_);
|
| tree_->Embed(view_id, client.Pass(), callback);
|
| }
|
|
|
| -void ViewTreeClientImpl::RequestSurface(Id view_id,
|
| - InterfaceRequest<Surface> surface,
|
| - SurfaceClientPtr client) {
|
| +void ViewTreeClientImpl::RequestSurface(
|
| + Id view_id,
|
| + mojo::InterfaceRequest<mojo::Surface> surface,
|
| + mojo::SurfaceClientPtr client) {
|
| DCHECK(tree_);
|
| tree_->RequestSurface(view_id, surface.Pass(), client.Pass());
|
| }
|
| @@ -224,8 +227,8 @@ void ViewTreeClientImpl::OnRootDestroyed(View* root) {
|
| Id ViewTreeClientImpl::CreateViewOnServer() {
|
| DCHECK(tree_);
|
| const Id view_id = MakeTransportId(connection_id_, ++next_id_);
|
| - tree_->CreateView(view_id, [this](ErrorCode code) {
|
| - OnActionCompleted(code == ERROR_CODE_NONE);
|
| + tree_->CreateView(view_id, [this](mojo::ErrorCode code) {
|
| + OnActionCompleted(code == mojo::ERROR_CODE_NONE);
|
| });
|
| return view_id;
|
| }
|
| @@ -261,8 +264,8 @@ ConnectionSpecificId ViewTreeClientImpl::GetConnectionId() {
|
| // ViewTreeClientImpl, ViewTreeClient implementation:
|
|
|
| void ViewTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id,
|
| - ViewDataPtr root_data,
|
| - ViewTreePtr tree,
|
| + mojo::ViewDataPtr root_data,
|
| + mojo::ViewTreePtr tree,
|
| Id focused_view_id,
|
| uint32 access_policy) {
|
| if (tree) {
|
| @@ -297,8 +300,8 @@ void ViewTreeClientImpl::OnUnembed() {
|
| }
|
|
|
| void ViewTreeClientImpl::OnViewBoundsChanged(Id view_id,
|
| - RectPtr old_bounds,
|
| - RectPtr new_bounds) {
|
| + mojo::RectPtr old_bounds,
|
| + mojo::RectPtr new_bounds) {
|
| View* view = GetViewById(view_id);
|
| ViewPrivate(view).LocalSetBounds(*old_bounds, *new_bounds);
|
| }
|
| @@ -306,8 +309,8 @@ void ViewTreeClientImpl::OnViewBoundsChanged(Id view_id,
|
| namespace {
|
|
|
| void SetViewportMetricsOnDecendants(View* root,
|
| - const ViewportMetrics& old_metrics,
|
| - const ViewportMetrics& new_metrics) {
|
| + const mojo::ViewportMetrics& old_metrics,
|
| + const mojo::ViewportMetrics& new_metrics) {
|
| ViewPrivate(root).LocalSetViewportMetrics(old_metrics, new_metrics);
|
| const View::Children& children = root->children();
|
| for (size_t i = 0; i < children.size(); ++i)
|
| @@ -316,8 +319,8 @@ void SetViewportMetricsOnDecendants(View* root,
|
| }
|
|
|
| void ViewTreeClientImpl::OnViewViewportMetricsChanged(
|
| - ViewportMetricsPtr old_metrics,
|
| - ViewportMetricsPtr new_metrics) {
|
| + mojo::ViewportMetricsPtr old_metrics,
|
| + mojo::ViewportMetricsPtr new_metrics) {
|
| View* view = GetRoot();
|
| if (view)
|
| SetViewportMetricsOnDecendants(view, *old_metrics, *new_metrics);
|
| @@ -327,7 +330,7 @@ void ViewTreeClientImpl::OnViewHierarchyChanged(
|
| Id view_id,
|
| Id new_parent_id,
|
| Id old_parent_id,
|
| - mojo::Array<ViewDataPtr> views) {
|
| + mojo::Array<mojo::ViewDataPtr> views) {
|
| View* initial_parent = views.size() ? GetViewById(views[0]->parent_id) : NULL;
|
|
|
| const bool was_view_known = GetViewById(view_id) != nullptr;
|
| @@ -350,7 +353,7 @@ void ViewTreeClientImpl::OnViewHierarchyChanged(
|
|
|
| void ViewTreeClientImpl::OnViewReordered(Id view_id,
|
| Id relative_view_id,
|
| - OrderDirection direction) {
|
| + mojo::OrderDirection direction) {
|
| View* view = GetViewById(view_id);
|
| View* relative_view = GetViewById(relative_view_id);
|
| if (view && relative_view)
|
| @@ -378,9 +381,10 @@ void ViewTreeClientImpl::OnViewDrawnStateChanged(Id view_id, bool drawn) {
|
| ViewPrivate(view).LocalSetDrawn(drawn);
|
| }
|
|
|
| -void ViewTreeClientImpl::OnViewSharedPropertyChanged(Id view_id,
|
| - const String& name,
|
| - Array<uint8_t> new_data) {
|
| +void ViewTreeClientImpl::OnViewSharedPropertyChanged(
|
| + Id view_id,
|
| + const mojo::String& name,
|
| + mojo::Array<uint8_t> new_data) {
|
| View* view = GetViewById(view_id);
|
| if (view) {
|
| std::vector<uint8_t> data;
|
| @@ -396,8 +400,8 @@ void ViewTreeClientImpl::OnViewSharedPropertyChanged(Id view_id,
|
|
|
| void ViewTreeClientImpl::OnViewInputEvent(
|
| Id view_id,
|
| - EventPtr event,
|
| - const Callback<void()>& ack_callback) {
|
| + mojo::EventPtr event,
|
| + const mojo::Callback<void()>& ack_callback) {
|
| View* view = GetViewById(view_id);
|
| if (view) {
|
| FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view).observers(),
|
| @@ -431,8 +435,8 @@ void ViewTreeClientImpl::OnActionCompleted(bool success) {
|
| change_acked_callback_.Run();
|
| }
|
|
|
| -Callback<void(bool)> ViewTreeClientImpl::ActionCompletedCallback() {
|
| +mojo::Callback<void(bool)> ViewTreeClientImpl::ActionCompletedCallback() {
|
| return [this](bool success) { OnActionCompleted(success); };
|
| }
|
|
|
| -} // namespace mojo
|
| +} // namespace mus
|
|
|