cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / web_view / frame_tree.h
blob9ce6b20869cfd8c2e3bdd78479c497b56622a5e5
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/web_view/frame.h"
9 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
11 namespace mojo {
12 class String;
15 namespace web_view {
17 class FrameTreeClient;
18 class FrameTreeDelegate;
19 class FrameUserData;
21 // FrameTree manages the set of Frames that comprise a single url. FrameTree
22 // owns the root Frame and each Frame owns its children. Frames are
23 // automatically deleted and removed from the tree if the corresponding view is
24 // deleted. This happens if the creator of the view deletes it (say an iframe is
25 // destroyed).
26 class FrameTree {
27 public:
28 // |view| is the view to do the initial embedding in. It is assumed |view|
29 // outlives FrameTree.
30 // |client_properties| is the client properties for the root frame.
31 // |root_app_id| is a unique identifier of the app providing |root_client|.
32 // See Frame for details on app id's.
33 FrameTree(uint32_t root_app_id,
34 mojo::View* view,
35 FrameTreeDelegate* delegate,
36 FrameTreeClient* root_client,
37 scoped_ptr<FrameUserData> user_data,
38 const Frame::ClientPropertyMap& client_properties);
39 ~FrameTree();
41 // Returns true if there should be a distinct renderer per frame. This is
42 // useful for testing.
43 static bool AlwaysCreateNewFrameTree();
45 Frame* root() { return &root_; }
47 uint32_t change_id() const { return change_id_; }
49 Frame* CreateAndAddFrame(mojo::View* view,
50 Frame* parent,
51 uint32_t app_id,
52 FrameTreeClient* client,
53 scoped_ptr<FrameUserData> user_data);
55 // Creates a new Frame parented to |parent|. The Frame is considered shared in
56 // that it is sharing the FrameTreeClient/FrameTreeServer of |parent|. There
57 // may or may not be a View identified by |frame_id| yet. See Frame for
58 // details.
59 void CreateSharedFrame(Frame* parent,
60 uint32_t frame_id,
61 uint32_t app_id,
62 const Frame::ClientPropertyMap& client_properties);
64 private:
65 friend class Frame;
67 // Increments the change id, returning the new value.
68 uint32_t AdvanceChangeID();
70 Frame* CreateAndAddFrameImpl(
71 mojo::View* view,
72 uint32_t frame_id,
73 uint32_t app_id,
74 Frame* parent,
75 FrameTreeClient* client,
76 scoped_ptr<FrameUserData> user_data,
77 const Frame::ClientPropertyMap& client_properties);
79 void LoadingStateChanged();
80 void ProgressChanged();
81 void TitleChanged(const mojo::String& title);
82 void ClientPropertyChanged(const Frame* source,
83 const mojo::String& name,
84 const mojo::Array<uint8_t>& value);
86 mojo::View* view_;
88 FrameTreeDelegate* delegate_;
90 Frame root_;
92 double progress_;
94 uint32_t change_id_;
96 DISALLOW_COPY_AND_ASSIGN(FrameTree);
99 } // namespace web_view
101 #endif // COMPONENTS_WEB_VIEW_FRAME_TREE_H_