| Index: services/ui/view_manager/view_registry.h
|
| diff --git a/services/ui/view_manager/view_registry.h b/services/ui/view_manager/view_registry.h
|
| index c0562093b4cda5a11c15539da5b31406a0dbbc8d..3f2b7baf63e95286fd3896cb8a68912fd6779bdd 100644
|
| --- a/services/ui/view_manager/view_registry.h
|
| +++ b/services/ui/view_manager/view_registry.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_
|
| #define SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_
|
|
|
| +#include <string>
|
| #include <unordered_map>
|
|
|
| #include "base/macros.h"
|
| @@ -15,6 +16,7 @@
|
| #include "services/ui/view_manager/view_associate_table.h"
|
| #include "services/ui/view_manager/view_layout_request.h"
|
| #include "services/ui/view_manager/view_state.h"
|
| +#include "services/ui/view_manager/view_stub.h"
|
| #include "services/ui/view_manager/view_tree_state.h"
|
|
|
| namespace view_manager {
|
| @@ -40,17 +42,22 @@ class ViewRegistry : public mojo::ui::ViewInspector {
|
| // VIEW MANAGER REQUESTS
|
|
|
| // Registers a view and returns its ViewToken.
|
| - mojo::ui::ViewTokenPtr RegisterView(
|
| + void RegisterView(
|
| mojo::ui::ViewPtr view,
|
| mojo::InterfaceRequest<mojo::ui::ViewHost> view_host_request,
|
| + mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request,
|
| const mojo::String& label);
|
|
|
| // Registers a view tree.
|
| - mojo::ui::ViewTreeTokenPtr RegisterViewTree(
|
| + void RegisterViewTree(
|
| mojo::ui::ViewTreePtr view_tree,
|
| mojo::InterfaceRequest<mojo::ui::ViewTreeHost> view_tree_host_request,
|
| const mojo::String& label);
|
|
|
| + // VIEW STUB REQUESTS
|
| +
|
| + void OnViewResolved(ViewStub* view_stub, mojo::ui::ViewTokenPtr view_token);
|
| +
|
| // VIEW HOST REQUESTS
|
|
|
| // Creates a scene for the view, replacing its current scene.
|
| @@ -66,11 +73,14 @@ class ViewRegistry : public mojo::ui::ViewInspector {
|
| // Destroys |parent_state| if an error occurs.
|
| void AddChild(ViewState* parent_state,
|
| uint32_t child_key,
|
| - mojo::ui::ViewTokenPtr child_view_token);
|
| + mojo::ui::ViewOwnerPtr child_view_owner);
|
|
|
| // Removes a child.
|
| // Destroys |parent_state| if an error occurs.
|
| - void RemoveChild(ViewState* parent_state, uint32_t child_key);
|
| + void RemoveChild(ViewState* parent_state,
|
| + uint32_t child_key,
|
| + mojo::InterfaceRequest<mojo::ui::ViewOwner>
|
| + transferred_view_owner_request);
|
|
|
| // Lays out a child and optionally provides its size.
|
| // Destroys |parent_state| if an error occurs.
|
| @@ -85,6 +95,9 @@ class ViewRegistry : public mojo::ui::ViewInspector {
|
| const mojo::String& service_name,
|
| mojo::ScopedMessagePipeHandle client_handle);
|
|
|
| + // Called when one of the view pipes is closed remotely.
|
| + void OnViewDied(ViewState* view_state, const std::string& reason);
|
| +
|
| // VIEW TREE HOST REQUESTS
|
|
|
| // Requests layout.
|
| @@ -95,11 +108,13 @@ class ViewRegistry : public mojo::ui::ViewInspector {
|
| // Destroys |tree_state| if an error occurs.
|
| void SetRoot(ViewTreeState* tree_state,
|
| uint32_t root_key,
|
| - mojo::ui::ViewTokenPtr root_view_token);
|
| + mojo::ui::ViewOwnerPtr root_view_owner);
|
|
|
| // Resets the root of the view tree.
|
| // Destroys |tree_state| if an error occurs.
|
| - void ResetRoot(ViewTreeState* tree_state);
|
| + void ResetRoot(ViewTreeState* tree_state,
|
| + mojo::InterfaceRequest<mojo::ui::ViewOwner>
|
| + transferred_view_owner_request);
|
|
|
| // Lays out a view tree's root and optionally provides its size.
|
| // Destroys |tree_state| if an error occurs.
|
| @@ -113,48 +128,45 @@ class ViewRegistry : public mojo::ui::ViewInspector {
|
| const mojo::String& service_name,
|
| mojo::ScopedMessagePipeHandle client_handle);
|
|
|
| + // Called when one of the view tree pipes is closed remotely.
|
| + void OnViewTreeDied(ViewTreeState* tree_state, const std::string& reason);
|
| +
|
| private:
|
| // LIFETIME
|
|
|
| - void OnViewConnectionError(ViewState* view_state);
|
| void UnregisterView(ViewState* view_state);
|
| - void OnViewTreeConnectionError(ViewTreeState* tree_state);
|
| void UnregisterViewTree(ViewTreeState* tree_state);
|
|
|
| // TREE MANIPULATION
|
|
|
| ViewState* FindView(uint32_t view_token_value);
|
| - void LinkChild(ViewState* parent_state,
|
| - uint32_t child_key,
|
| - ViewState* child_state);
|
| - void LinkChildAsUnavailable(ViewState* parent_state, uint32_t child_key);
|
| - void MarkChildAsUnavailable(ViewState* parent_state, uint32_t child_key);
|
| - void UnlinkChild(ViewState* parent_state,
|
| - ViewState::ChildrenMap::iterator child_it);
|
| -
|
| ViewTreeState* FindViewTree(uint32_t view_tree_token_value);
|
| - void LinkRoot(ViewTreeState* tree_state,
|
| - ViewState* root_state,
|
| - uint32_t root_key);
|
| - void UnlinkRoot(ViewTreeState* tree_state);
|
| +
|
| void HijackView(ViewState* view_state);
|
|
|
| - // Must be called before the view is actually unlinked from the tree.
|
| - // Caller is still responsible for actually unlinking the view.
|
| - void ResetStateWhenUnlinking(ViewState* view_state);
|
| + void AttachViewStubAndNotify(ViewStub* view_stub, ViewState* view_state);
|
| + void ReleaseViewStubAndNotify(ViewStub* view_stub);
|
| + void TransferOrUnregisterViewStub(std::unique_ptr<ViewStub> view_stub,
|
| + mojo::InterfaceRequest<mojo::ui::ViewOwner>
|
| + transferred_view_owner_request);
|
| + void UnregisterViewStub(std::unique_ptr<ViewStub> view_stub);
|
|
|
| // LAYOUT
|
|
|
| - void InvalidateLayout(ViewState* view_state);
|
| - void InvalidateLayoutForChild(ViewState* parent_state, uint32_t child_key);
|
| - void InvalidateLayoutForRoot(ViewTreeState* tree_state);
|
| - void SetLayout(ViewState* view_state,
|
| + void SetLayout(ViewStub* view_stub,
|
| mojo::ui::ViewLayoutParamsPtr layout_params,
|
| const ViewLayoutCallback& callback);
|
| void EnqueueLayoutRequest(ViewState* view_state,
|
| mojo::ui::ViewLayoutParamsPtr layout_params);
|
| + void InvalidateLayout(ViewState* view_state);
|
| + void InvalidateLayoutForChild(ViewState* parent_state, uint32_t child_key);
|
| + void InvalidateLayoutForRoot(ViewTreeState* tree_state);
|
| +
|
| void IssueNextViewLayoutRequest(ViewState* view_state);
|
| void IssueNextViewTreeLayoutRequest(ViewTreeState* tree_state);
|
| + void OnViewLayoutResult(base::WeakPtr<ViewState> view_state_weak,
|
| + mojo::ui::ViewLayoutResultPtr result);
|
| + void OnViewTreeLayoutResult(base::WeakPtr<ViewTreeState> tree_state_weak);
|
|
|
| // SCENE MANAGEMENT
|
|
|
| @@ -165,11 +177,6 @@ class ViewRegistry : public mojo::ui::ViewInspector {
|
|
|
| void SendChildUnavailable(ViewState* parent_state, uint32_t child_key);
|
| void SendRootUnavailable(ViewTreeState* tree_state, uint32_t root_key);
|
| - void SendViewLayoutRequest(ViewState* view_state);
|
| - void SendViewTreeLayoutRequest(ViewTreeState* tree_state);
|
| - void OnViewLayoutResult(base::WeakPtr<ViewState> view_state_weak,
|
| - mojo::ui::ViewLayoutResultPtr result);
|
| - void OnViewTreeLayoutResult(base::WeakPtr<ViewTreeState> tree_state_weak);
|
|
|
| bool IsViewStateRegisteredDebug(ViewState* view_state) {
|
| return view_state && FindView(view_state->view_token()->value);
|
|
|