Index: components/mus/view_tree_impl.cc |
diff --git a/components/view_manager/view_tree_impl.cc b/components/mus/view_tree_impl.cc |
similarity index 83% |
rename from components/view_manager/view_tree_impl.cc |
rename to components/mus/view_tree_impl.cc |
index d16403bcdf5568380f2d21349c1c2dbcd31dc93f..3ca59a960b7276167213dd2a23f93ed6b8adcaef 100644 |
--- a/components/view_manager/view_tree_impl.cc |
+++ b/components/mus/view_tree_impl.cc |
@@ -2,16 +2,16 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "components/view_manager/view_tree_impl.h" |
+#include "components/mus/view_tree_impl.h" |
#include "base/bind.h" |
#include "base/stl_util.h" |
-#include "components/view_manager/connection_manager.h" |
-#include "components/view_manager/default_access_policy.h" |
-#include "components/view_manager/display_manager.h" |
-#include "components/view_manager/server_view.h" |
-#include "components/view_manager/view_tree_host_impl.h" |
-#include "components/view_manager/window_manager_access_policy.h" |
+#include "components/mus/connection_manager.h" |
+#include "components/mus/default_access_policy.h" |
+#include "components/mus/display_manager.h" |
+#include "components/mus/server_view.h" |
+#include "components/mus/view_tree_host_impl.h" |
+#include "components/mus/window_manager_access_policy.h" |
#include "mojo/converters/geometry/geometry_type_converters.h" |
#include "mojo/converters/ime/ime_type_converters.h" |
#include "mojo/converters/input_events/input_events_type_converters.h" |
@@ -31,10 +31,9 @@ using mojo::ViewDataPtr; |
namespace view_manager { |
-ViewTreeImpl::ViewTreeImpl( |
- ConnectionManager* connection_manager, |
- mojo::ConnectionSpecificId creator_id, |
- const ViewId& root_id) |
+ViewTreeImpl::ViewTreeImpl(ConnectionManager* connection_manager, |
+ mojo::ConnectionSpecificId creator_id, |
+ const ViewId& root_id) |
: connection_manager_(connection_manager), |
id_(connection_manager_->GetAndAdvanceNextConnectionId()), |
creator_id_(creator_id), |
@@ -91,12 +90,12 @@ bool ViewTreeImpl::IsRoot(const ViewId& id) const { |
} |
ViewTreeHostImpl* ViewTreeImpl::GetHost() { |
- return root_.get() ? |
- connection_manager_->GetViewTreeHostByView(GetView(*root_)) : nullptr; |
+ return root_.get() |
+ ? connection_manager_->GetViewTreeHostByView(GetView(*root_)) |
+ : nullptr; |
} |
-void ViewTreeImpl::OnWillDestroyViewTreeImpl( |
- ViewTreeImpl* connection) { |
+void ViewTreeImpl::OnWillDestroyViewTreeImpl(ViewTreeImpl* connection) { |
if (creator_id_ == connection->id()) |
creator_id_ = kInvalidConnectionId; |
const ServerView* connection_root = |
@@ -175,16 +174,14 @@ void ViewTreeImpl::Embed(const ViewId& view_id, mojo::URLRequestPtr request) { |
connection_manager_->EmbedAtView(id_, view_id, request.Pass()); |
} |
-void ViewTreeImpl::ProcessViewBoundsChanged( |
- const ServerView* view, |
- const gfx::Rect& old_bounds, |
- const gfx::Rect& new_bounds, |
- bool originated_change) { |
+void ViewTreeImpl::ProcessViewBoundsChanged(const ServerView* view, |
+ const gfx::Rect& old_bounds, |
+ const gfx::Rect& new_bounds, |
+ bool originated_change) { |
if (originated_change || !IsViewKnown(view)) |
return; |
client()->OnViewBoundsChanged(ViewIdToTransportId(view->id()), |
- Rect::From(old_bounds), |
- Rect::From(new_bounds)); |
+ Rect::From(old_bounds), Rect::From(new_bounds)); |
} |
void ViewTreeImpl::ProcessViewportMetricsChanged( |
@@ -195,11 +192,10 @@ void ViewTreeImpl::ProcessViewportMetricsChanged( |
new_metrics.Clone()); |
} |
-void ViewTreeImpl::ProcessWillChangeViewHierarchy( |
- const ServerView* view, |
- const ServerView* new_parent, |
- const ServerView* old_parent, |
- bool originated_change) { |
+void ViewTreeImpl::ProcessWillChangeViewHierarchy(const ServerView* view, |
+ const ServerView* new_parent, |
+ const ServerView* old_parent, |
+ bool originated_change) { |
if (originated_change) |
return; |
@@ -227,11 +223,10 @@ void ViewTreeImpl::ProcessViewPropertyChanged( |
String(name), data.Pass()); |
} |
-void ViewTreeImpl::ProcessViewHierarchyChanged( |
- const ServerView* view, |
- const ServerView* new_parent, |
- const ServerView* old_parent, |
- bool originated_change) { |
+void ViewTreeImpl::ProcessViewHierarchyChanged(const ServerView* view, |
+ const ServerView* new_parent, |
+ const ServerView* old_parent, |
+ bool originated_change) { |
if (originated_change && !IsViewKnown(view) && new_parent && |
IsViewKnown(new_parent)) { |
std::vector<const ServerView*> unused; |
@@ -242,8 +237,8 @@ void ViewTreeImpl::ProcessViewHierarchyChanged( |
return; |
} |
- if (!access_policy_->ShouldNotifyOnHierarchyChange( |
- view, &new_parent, &old_parent)) { |
+ if (!access_policy_->ShouldNotifyOnHierarchyChange(view, &new_parent, |
+ &old_parent)) { |
return; |
} |
// Inform the client of any new views and update the set of views we know |
@@ -253,10 +248,9 @@ void ViewTreeImpl::ProcessViewHierarchyChanged( |
GetUnknownViewsFrom(view, &to_send); |
const ViewId new_parent_id(new_parent ? new_parent->id() : ViewId()); |
const ViewId old_parent_id(old_parent ? old_parent->id() : ViewId()); |
- client()->OnViewHierarchyChanged(ViewIdToTransportId(view->id()), |
- ViewIdToTransportId(new_parent_id), |
- ViewIdToTransportId(old_parent_id), |
- ViewsToViewDatas(to_send)); |
+ client()->OnViewHierarchyChanged( |
+ ViewIdToTransportId(view->id()), ViewIdToTransportId(new_parent_id), |
+ ViewIdToTransportId(old_parent_id), ViewsToViewDatas(to_send)); |
connection_manager_->OnConnectionMessagedClient(id_); |
} |
@@ -291,9 +285,8 @@ void ViewTreeImpl::ProcessViewDeleted(const ViewId& view, |
} |
} |
-void ViewTreeImpl::ProcessWillChangeViewVisibility( |
- const ServerView* view, |
- bool originated_change) { |
+void ViewTreeImpl::ProcessWillChangeViewVisibility(const ServerView* view, |
+ bool originated_change) { |
if (originated_change) |
return; |
@@ -315,9 +308,8 @@ void ViewTreeImpl::ProcessWillChangeViewVisibility( |
NotifyDrawnStateChanged(view, view_target_drawn_state); |
} |
-void ViewTreeImpl::ProcessFocusChanged( |
- const ServerView* old_focused_view, |
- const ServerView* new_focused_view) { |
+void ViewTreeImpl::ProcessFocusChanged(const ServerView* old_focused_view, |
+ const ServerView* new_focused_view) { |
const ServerView* view = |
new_focused_view ? access_policy_->GetViewForFocusChange(new_focused_view) |
: nullptr; |
@@ -363,9 +355,8 @@ bool ViewTreeImpl::DeleteViewImpl(ViewTreeImpl* source, ServerView* view) { |
return true; |
} |
-void ViewTreeImpl::GetUnknownViewsFrom( |
- const ServerView* view, |
- std::vector<const ServerView*>* views) { |
+void ViewTreeImpl::GetUnknownViewsFrom(const ServerView* view, |
+ std::vector<const ServerView*>* views) { |
if (IsViewKnown(view) || !access_policy_->CanGetViewTree(view)) |
return; |
views->push_back(view); |
@@ -373,13 +364,12 @@ void ViewTreeImpl::GetUnknownViewsFrom( |
if (!access_policy_->CanDescendIntoViewForViewTree(view)) |
return; |
std::vector<const ServerView*> children(view->GetChildren()); |
- for (size_t i = 0 ; i < children.size(); ++i) |
+ for (size_t i = 0; i < children.size(); ++i) |
GetUnknownViewsFrom(children[i], views); |
} |
-void ViewTreeImpl::RemoveFromKnown( |
- const ServerView* view, |
- std::vector<ServerView*>* local_views) { |
+void ViewTreeImpl::RemoveFromKnown(const ServerView* view, |
+ std::vector<ServerView*>* local_views) { |
if (view->id().connection_id == id_) { |
if (local_views) |
local_views->push_back(GetView(view->id())); |
@@ -453,7 +443,7 @@ void ViewTreeImpl::GetViewTreeImpl( |
return; |
std::vector<const ServerView*> children(view->GetChildren()); |
- for (size_t i = 0 ; i < children.size(); ++i) |
+ for (size_t i = 0; i < children.size(); ++i) |
GetViewTreeImpl(children[i], views); |
} |
@@ -515,15 +505,13 @@ void ViewTreeImpl::RemoveChildrenAsPartOfEmbed(const ViewId& view_id) { |
view->Remove(children[i]); |
} |
-void ViewTreeImpl::CreateView( |
- Id transport_view_id, |
- const Callback<void(mojo::ErrorCode)>& callback) { |
+void ViewTreeImpl::CreateView(Id transport_view_id, |
+ const Callback<void(mojo::ErrorCode)>& callback) { |
callback.Run(CreateView(ViewIdFromTransportId(transport_view_id))); |
} |
-void ViewTreeImpl::DeleteView( |
- Id transport_view_id, |
- const Callback<void(bool)>& callback) { |
+void ViewTreeImpl::DeleteView(Id transport_view_id, |
+ const Callback<void(bool)>& callback) { |
ServerView* view = GetView(ViewIdFromTransportId(transport_view_id)); |
bool success = false; |
if (view && access_policy_->CanDeleteView(view)) { |
@@ -534,17 +522,15 @@ void ViewTreeImpl::DeleteView( |
callback.Run(success); |
} |
-void ViewTreeImpl::AddView( |
- Id parent_id, |
- Id child_id, |
- const Callback<void(bool)>& callback) { |
+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::RemoveViewFromParent( |
- Id view_id, |
- const Callback<void(bool)>& callback) { |
+void ViewTreeImpl::RemoveViewFromParent(Id view_id, |
+ const Callback<void(bool)>& callback) { |
bool success = false; |
ServerView* view = GetView(ViewIdFromTransportId(view_id)); |
if (view && view->parent() && access_policy_->CanRemoveViewFromParent(view)) { |
@@ -579,10 +565,9 @@ void ViewTreeImpl::GetViewTree( |
callback.Run(ViewsToViewDatas(views)); |
} |
-void ViewTreeImpl::SetViewBounds( |
- Id view_id, |
- mojo::RectPtr bounds, |
- const Callback<void(bool)>& callback) { |
+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); |
if (success) { |
@@ -592,19 +577,17 @@ void ViewTreeImpl::SetViewBounds( |
callback.Run(success); |
} |
-void ViewTreeImpl::SetViewVisibility( |
- Id transport_view_id, |
- bool visible, |
- const Callback<void(bool)>& callback) { |
+void ViewTreeImpl::SetViewVisibility(Id transport_view_id, |
+ bool visible, |
+ const Callback<void(bool)>& callback) { |
callback.Run( |
SetViewVisibility(ViewIdFromTransportId(transport_view_id), visible)); |
} |
-void ViewTreeImpl::SetViewProperty( |
- uint32_t view_id, |
- const mojo::String& name, |
- mojo::Array<uint8_t> value, |
- const mojo::Callback<void(bool)>& callback) { |
+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); |
if (success) { |
@@ -620,10 +603,9 @@ void ViewTreeImpl::SetViewProperty( |
callback.Run(success); |
} |
-void ViewTreeImpl::RequestSurface( |
- mojo::Id view_id, |
- mojo::InterfaceRequest<mojo::Surface> surface, |
- mojo::SurfaceClientPtr client) { |
+void ViewTreeImpl::RequestSurface(mojo::Id view_id, |
+ mojo::InterfaceRequest<mojo::Surface> surface, |
+ mojo::SurfaceClientPtr client) { |
ServerView* view = GetView(ViewIdFromTransportId(view_id)); |
const bool success = view && access_policy_->CanSetViewSurfaceId(view); |
if (!success) |
@@ -631,9 +613,8 @@ void ViewTreeImpl::RequestSurface( |
view->Bind(surface.Pass(), client.Pass()); |
} |
-void ViewTreeImpl::SetViewTextInputState( |
- uint32_t view_id, |
- mojo::TextInputStatePtr state) { |
+void ViewTreeImpl::SetViewTextInputState(uint32_t view_id, |
+ mojo::TextInputStatePtr state) { |
ServerView* view = GetView(ViewIdFromTransportId(view_id)); |
bool success = view && access_policy_->CanSetViewTextInputState(view); |
if (success) |