Delete unused downloads page asset.
[chromium-blink-merge.git] / mandoline / tab / frame_tree.h
blob886fbd6cac0c01df7e569403ffda9c3026b2c5b2
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 MANDOLINE_TAB_FRAME_TREE_H_
6 #define MANDOLINE_TAB_FRAME_TREE_H_
8 #include "mandoline/tab/frame.h"
9 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
11 namespace mojo {
12 class String;
15 namespace mandoline {
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 FrameTree(mojo::View* view,
32 FrameTreeDelegate* delegate,
33 FrameTreeClient* root_client,
34 scoped_ptr<FrameUserData> user_data,
35 const Frame::ClientPropertyMap& client_properties);
36 ~FrameTree();
38 Frame* root() { return &root_; }
40 uint32_t change_id() const { return change_id_; }
42 Frame* CreateAndAddFrame(mojo::View* view,
43 Frame* parent,
44 FrameTreeClient* client,
45 scoped_ptr<FrameUserData> user_data);
47 // Creates a new Frame parented to |parent|. The Frame is considered shared in
48 // that it is sharing the FrameTreeClient/FrameTreeServer of |parent|. There
49 // may or may not be a View identified by |frame_id| yet. See Frame for
50 // details.
51 void CreateSharedFrame(Frame* parent,
52 uint32_t frame_id,
53 const Frame::ClientPropertyMap& client_properties);
55 private:
56 friend class Frame;
58 // Increments the change id, returning the new value.
59 uint32_t AdvanceChangeID();
61 Frame* CreateAndAddFrameImpl(
62 mojo::View* view,
63 uint32_t frame_id,
64 Frame* parent,
65 FrameTreeClient* client,
66 scoped_ptr<FrameUserData> user_data,
67 const Frame::ClientPropertyMap& client_properties);
69 void LoadingStateChanged();
70 void ProgressChanged();
71 void ClientPropertyChanged(const Frame* source,
72 const mojo::String& name,
73 const mojo::Array<uint8_t>& value);
75 mojo::View* view_;
77 FrameTreeDelegate* delegate_;
79 Frame root_;
81 double progress_;
83 uint32_t change_id_;
85 DISALLOW_COPY_AND_ASSIGN(FrameTree);
88 } // namespace mandoline
90 #endif // MANDOLINE_TAB_FRAME_TREE_H_