OLD | NEW |
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 MANDOLINE_TAB_FRAME_H_ | 5 #ifndef MANDOLINE_TAB_FRAME_H_ |
6 #define MANDOLINE_TAB_FRAME_H_ | 6 #define MANDOLINE_TAB_FRAME_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // Finds the descendant with the specified id. | 55 // Finds the descendant with the specified id. |
56 Frame* FindFrame(uint32_t id) { | 56 Frame* FindFrame(uint32_t id) { |
57 return const_cast<Frame*>(const_cast<const Frame*>(this)->FindFrame(id)); | 57 return const_cast<Frame*>(const_cast<const Frame*>(this)->FindFrame(id)); |
58 } | 58 } |
59 const Frame* FindFrame(uint32_t id) const; | 59 const Frame* FindFrame(uint32_t id) const; |
60 | 60 |
61 bool HasAncestor(const Frame* frame) const; | 61 bool HasAncestor(const Frame* frame) const; |
62 | 62 |
63 FrameUserData* user_data() { return user_data_.get(); } | 63 FrameUserData* user_data() { return user_data_.get(); } |
64 | 64 |
| 65 const std::vector<Frame*>& children() { return children_; } |
| 66 |
| 67 const mojo::String& name() const { return name_; } |
| 68 |
65 // Returns true if this Frame or any child Frame is loading. | 69 // Returns true if this Frame or any child Frame is loading. |
66 bool IsLoading() const; | 70 bool IsLoading() const; |
67 | 71 |
68 // Returns the sum total of loading progress from this Frame and all of its | 72 // Returns the sum total of loading progress from this Frame and all of its |
69 // children, as well as the number of Frames accumulated. | 73 // children, as well as the number of Frames accumulated. |
70 double GatherProgress(int* frame_count) const; | 74 double GatherProgress(int* frame_count) const; |
71 | 75 |
72 private: | 76 private: |
73 friend class FrameTree; | 77 friend class FrameTree; |
74 | 78 |
75 // Adds this to |frames| and recurses through the children calling the | 79 // Adds this to |frames| and recurses through the children calling the |
76 // same function. | 80 // same function. |
77 void BuildFrameTree(std::vector<const Frame*>* frames) const; | 81 void BuildFrameTree(std::vector<const Frame*>* frames) const; |
78 | 82 |
79 void Add(Frame* node); | 83 void Add(Frame* node); |
80 void Remove(Frame* node); | 84 void Remove(Frame* node); |
81 | 85 |
82 // Notifies the client and all descendants as appropriate. | 86 // Notifies the client and all descendants as appropriate. |
83 void NotifyAdded(const Frame* source, const Frame* added_node); | 87 void NotifyAdded(const Frame* source, const Frame* added_node); |
84 void NotifyRemoved(const Frame* source, const Frame* removed_node); | 88 void NotifyRemoved(const Frame* source, const Frame* removed_node); |
| 89 void NotifyFrameNameChanged(const Frame* source); |
85 | 90 |
86 // mojo::ViewObserver: | 91 // mojo::ViewObserver: |
87 void OnViewDestroying(mojo::View* view) override; | 92 void OnViewDestroying(mojo::View* view) override; |
88 | 93 |
89 // FrameTreeServer: | 94 // FrameTreeServer: |
90 void PostMessageEventToFrame(uint32_t frame_id, | 95 void PostMessageEventToFrame(uint32_t frame_id, |
91 MessageEventPtr event) override; | 96 MessageEventPtr event) override; |
92 void NavigateFrame(uint32_t frame_id) override; | 97 void NavigateFrame(uint32_t frame_id) override; |
93 void ReloadFrame(uint32_t frame_id) override; | 98 void ReloadFrame(uint32_t frame_id) override; |
94 void LoadingStarted() override; | 99 void LoadingStarted() override; |
95 void LoadingStopped() override; | 100 void LoadingStopped() override; |
96 void ProgressChanged(double progress) override; | 101 void ProgressChanged(double progress) override; |
| 102 void SetFrameName(const mojo::String& name) override; |
97 | 103 |
98 FrameTree* const tree_; | 104 FrameTree* const tree_; |
99 mojo::View* view_; | 105 mojo::View* view_; |
100 Frame* parent_; | 106 Frame* parent_; |
101 ViewOwnership view_ownership_; | 107 ViewOwnership view_ownership_; |
102 std::vector<Frame*> children_; | 108 std::vector<Frame*> children_; |
103 scoped_ptr<FrameUserData> user_data_; | 109 scoped_ptr<FrameUserData> user_data_; |
104 | 110 |
105 FrameTreeClient* frame_tree_client_; | 111 FrameTreeClient* frame_tree_client_; |
106 | 112 |
107 bool loading_; | 113 bool loading_; |
108 double progress_; | 114 double progress_; |
109 | 115 |
| 116 mojo::String name_; |
| 117 |
110 mojo::Binding<FrameTreeServer> frame_tree_server_binding_; | 118 mojo::Binding<FrameTreeServer> frame_tree_server_binding_; |
111 | 119 |
112 DISALLOW_COPY_AND_ASSIGN(Frame); | 120 DISALLOW_COPY_AND_ASSIGN(Frame); |
113 }; | 121 }; |
114 | 122 |
115 } // namespace mandoline | 123 } // namespace mandoline |
116 | 124 |
117 #endif // MANDOLINE_TAB_FRAME_H_ | 125 #endif // MANDOLINE_TAB_FRAME_H_ |
OLD | NEW |