Revert of Mandoline UI Process: Update namespaces and file names (patchset #9 id...
[chromium-blink-merge.git] / components / web_view / frame_tree.h
blobad457d9f2043164cab4bef1ba26d38fd0bb4eafb
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_WEB_VIEW_FRAME_TREE_H_
6 #define COMPONENTS_WEB_VIEW_FRAME_TREE_H_
8 #include "components/mus/public/interfaces/view_tree.mojom.h"
9 #include "components/web_view/frame.h"
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
12 namespace mojo {
13 class String;
16 namespace web_view {
18 class FrameTreeClient;
19 class FrameTreeDelegate;
20 class FrameUserData;
22 // FrameTree manages the set of Frames that comprise a single url. FrameTree
23 // owns the root Frame and each Frame owns its children. Frames are
24 // automatically deleted and removed from the tree if the corresponding view is
25 // deleted. This happens if the creator of the view deletes it (say an iframe is
26 // destroyed).
27 class FrameTree {
28 public:
29 // |view| is the view to do the initial embedding in. It is assumed |view|
30 // outlives FrameTree.
31 // |client_properties| is the client properties for the root frame.
32 // |root_app_id| is a unique identifier of the app providing |root_client|.
33 // See Frame for details on app id's.
34 FrameTree(uint32_t root_app_id,
35 mojo::View* view,
36 mojo::ViewTreeClientPtr view_tree_client,
37 FrameTreeDelegate* delegate,
38 FrameTreeClient* root_client,
39 scoped_ptr<FrameUserData> user_data,
40 const Frame::ClientPropertyMap& client_properties);
41 ~FrameTree();
43 const Frame* root() const { return root_; }
44 Frame* root() { return root_; }
45 uint32_t change_id() const { return change_id_; }
47 private:
48 friend class Frame;
50 // Creates a new Frame parented to |parent|. The Frame is considered shared in
51 // that it is sharing the FrameTreeClient/FrameTreeServer of |parent|. There
52 // may or may not be a View identified by |frame_id| yet. See Frame for
53 // details.
54 Frame* CreateSharedFrame(Frame* parent,
55 uint32_t frame_id,
56 uint32_t app_id,
57 const Frame::ClientPropertyMap& client_properties);
59 // Increments the change id, returning the new value.
60 uint32_t AdvanceChangeID();
62 void LoadingStateChanged();
63 void ProgressChanged();
64 void TitleChanged(const mojo::String& title);
65 void ClientPropertyChanged(const Frame* source,
66 const mojo::String& name,
67 const mojo::Array<uint8_t>& value);
69 mojo::View* view_;
71 FrameTreeDelegate* delegate_;
73 // |root_| is owned by this, but a raw pointer as during destruction we still
74 // want access to it.
75 Frame* root_;
77 double progress_;
79 uint32_t change_id_;
81 DISALLOW_COPY_AND_ASSIGN(FrameTree);
84 } // namespace web_view
86 #endif // COMPONENTS_WEB_VIEW_FRAME_TREE_H_