Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: components/web_view/frame_tree.h

Issue 1323233004: Adds better security checking to OnCreatedFrame() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/web_view/frame_apptest.cc ('k') | components/web_view/frame_tree.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_WEB_VIEW_FRAME_TREE_H_ 5 #ifndef COMPONENTS_WEB_VIEW_FRAME_TREE_H_
6 #define COMPONENTS_WEB_VIEW_FRAME_TREE_H_ 6 #define COMPONENTS_WEB_VIEW_FRAME_TREE_H_
7 7
8 #include "components/view_manager/public/interfaces/view_tree.mojom.h"
8 #include "components/web_view/frame.h" 9 #include "components/web_view/frame.h"
9 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" 10 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
10 11
11 namespace mojo { 12 namespace mojo {
12 class String; 13 class String;
13 } 14 }
14 15
15 namespace web_view { 16 namespace web_view {
16 17
17 class FrameTreeClient; 18 class FrameTreeClient;
18 class FrameTreeDelegate; 19 class FrameTreeDelegate;
19 class FrameUserData; 20 class FrameUserData;
20 21
21 // FrameTree manages the set of Frames that comprise a single url. FrameTree 22 // 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 // 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 // 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 // deleted. This happens if the creator of the view deletes it (say an iframe is
25 // destroyed). 26 // destroyed).
26 class FrameTree { 27 class FrameTree {
27 public: 28 public:
28 // |view| is the view to do the initial embedding in. It is assumed |view| 29 // |view| is the view to do the initial embedding in. It is assumed |view|
29 // outlives FrameTree. 30 // outlives FrameTree.
30 // |client_properties| is the client properties for the root frame. 31 // |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 // |root_app_id| is a unique identifier of the app providing |root_client|.
32 // See Frame for details on app id's. 33 // See Frame for details on app id's.
33 FrameTree(uint32_t root_app_id, 34 FrameTree(uint32_t root_app_id,
34 mojo::View* view, 35 mojo::View* view,
36 mojo::ViewTreeClientPtr view_tree_client,
35 FrameTreeDelegate* delegate, 37 FrameTreeDelegate* delegate,
36 FrameTreeClient* root_client, 38 FrameTreeClient* root_client,
37 scoped_ptr<FrameUserData> user_data, 39 scoped_ptr<FrameUserData> user_data,
38 const Frame::ClientPropertyMap& client_properties); 40 const Frame::ClientPropertyMap& client_properties);
39 ~FrameTree(); 41 ~FrameTree();
40 42
41 // Returns true if there should be a distinct renderer per frame. This is 43 // Returns true if there should be a distinct renderer per frame. This is
42 // useful for testing. 44 // useful for testing.
43 static bool AlwaysCreateNewFrameTree(); 45 static bool AlwaysCreateNewFrameTree();
44 46
45 Frame* root() { return &root_; } 47 Frame* root() { return &root_; }
46 48
47 uint32_t change_id() const { return change_id_; } 49 uint32_t change_id() const { return change_id_; }
48 50
49 Frame* CreateAndAddFrame(mojo::View* view, 51 Frame* CreateAndAddFrame(mojo::View* view,
50 Frame* parent, 52 Frame* parent,
51 uint32_t app_id, 53 uint32_t app_id,
52 FrameTreeClient* client, 54 FrameTreeClient* client,
53 scoped_ptr<FrameUserData> user_data); 55 scoped_ptr<FrameUserData> user_data);
54 56
55 // Creates a new Frame parented to |parent|. The Frame is considered shared in 57 // Creates a new Frame parented to |parent|. The Frame is considered shared in
56 // that it is sharing the FrameTreeClient/FrameTreeServer of |parent|. There 58 // 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 59 // may or may not be a View identified by |frame_id| yet. See Frame for
58 // details. 60 // details.
59 void CreateSharedFrame(Frame* parent, 61 Frame* CreateSharedFrame(Frame* parent,
60 uint32_t frame_id, 62 uint32_t frame_id,
61 uint32_t app_id, 63 uint32_t app_id,
62 const Frame::ClientPropertyMap& client_properties); 64 const Frame::ClientPropertyMap& client_properties);
63 65
64 private: 66 private:
65 friend class Frame; 67 friend class Frame;
66 68
67 // Increments the change id, returning the new value. 69 // Increments the change id, returning the new value.
68 uint32_t AdvanceChangeID(); 70 uint32_t AdvanceChangeID();
69 71
70 Frame* CreateAndAddFrameImpl( 72 Frame* CreateAndAddFrameImpl(
71 mojo::View* view, 73 mojo::View* view,
72 uint32_t frame_id, 74 uint32_t frame_id,
(...skipping 19 matching lines...) Expand all
92 double progress_; 94 double progress_;
93 95
94 uint32_t change_id_; 96 uint32_t change_id_;
95 97
96 DISALLOW_COPY_AND_ASSIGN(FrameTree); 98 DISALLOW_COPY_AND_ASSIGN(FrameTree);
97 }; 99 };
98 100
99 } // namespace web_view 101 } // namespace web_view
100 102
101 #endif // COMPONENTS_WEB_VIEW_FRAME_TREE_H_ 103 #endif // COMPONENTS_WEB_VIEW_FRAME_TREE_H_
OLDNEW
« no previous file with comments | « components/web_view/frame_apptest.cc ('k') | components/web_view/frame_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698