OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef COMPONENTS_WEB_VIEW_FRAME_TREE_H_ | |
6 #define COMPONENTS_WEB_VIEW_FRAME_TREE_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/time/time.h" | |
12 #include "components/mus/public/interfaces/window_tree.mojom.h" | |
13 #include "components/web_view/frame.h" | |
14 #include "mojo/public/cpp/bindings/array.h" | |
15 #include "url/gurl.h" | |
16 | |
17 namespace mojo { | |
18 class String; | |
19 } | |
20 | |
21 namespace web_view { | |
22 | |
23 class FrameTreeDelegate; | |
24 class FrameUserData; | |
25 | |
26 namespace mojom { | |
27 class FrameClient; | |
28 } | |
29 | |
30 // FrameTree manages the set of Frames that comprise a single url. FrameTree | |
31 // owns the root Frame and each Frame owns its children. Frames are | |
32 // automatically deleted and removed from the tree if the corresponding window | |
33 // is | |
34 // deleted. This happens if the creator of the window deletes it (say an iframe | |
35 // is | |
36 // destroyed). | |
37 class FrameTree { | |
38 public: | |
39 // |window| is the window to do the initial embedding in. It is assumed | |
40 // |window| | |
41 // outlives FrameTree. | |
42 // |client_properties| is the client properties for the root frame. | |
43 // |root_app_id| is a unique identifier of the app providing |root_client|. | |
44 // See Frame for details on app id's. | |
45 FrameTree(uint32_t root_app_id, | |
46 mus::Window* window, | |
47 mus::mojom::WindowTreeClientPtr window_tree_client, | |
48 FrameTreeDelegate* delegate, | |
49 mojom::FrameClient* root_client, | |
50 scoped_ptr<FrameUserData> user_data, | |
51 const Frame::ClientPropertyMap& client_properties, | |
52 base::TimeTicks navigation_start_time); | |
53 ~FrameTree(); | |
54 | |
55 const Frame* root() const { return root_; } | |
56 Frame* root() { return root_; } | |
57 uint32_t change_id() const { return change_id_; } | |
58 | |
59 private: | |
60 friend class Frame; | |
61 | |
62 // Creates a new Frame parented to |parent|. The Frame is considered shared in | |
63 // that it is sharing the FrameClient/Frame of |parent|. There may or may not | |
64 // be a Window identified by |frame_id| yet. See Frame for details. | |
65 Frame* CreateChildFrame(Frame* parent, | |
66 mojo::InterfaceRequest<mojom::Frame> frame_request, | |
67 mojom::FrameClientPtr client, | |
68 uint32_t frame_id, | |
69 uint32_t app_id, | |
70 const Frame::ClientPropertyMap& client_properties); | |
71 | |
72 // Increments the change id, returning the new value. | |
73 uint32_t AdvanceChangeID(); | |
74 | |
75 void LoadingStateChanged(); | |
76 void TitleChanged(const mojo::String& title); | |
77 void DidCommitProvisionalLoad(Frame* source); | |
78 void DidNavigateLocally(Frame* source, const GURL& url); | |
79 void ClientPropertyChanged(const Frame* source, | |
80 const mojo::String& name, | |
81 const mojo::Array<uint8_t>& value); | |
82 | |
83 mus::Window* window_; | |
84 | |
85 FrameTreeDelegate* delegate_; | |
86 | |
87 // |root_| is owned by this, but a raw pointer as during destruction we still | |
88 // want access to it. | |
89 Frame* root_; | |
90 | |
91 double progress_; | |
92 | |
93 uint32_t change_id_; | |
94 | |
95 DISALLOW_COPY_AND_ASSIGN(FrameTree); | |
96 }; | |
97 | |
98 } // namespace web_view | |
99 | |
100 #endif // COMPONENTS_WEB_VIEW_FRAME_TREE_H_ | |
OLD | NEW |