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 COMPONENTS_WEB_VIEW_FRAME_H_ | 5 #ifndef COMPONENTS_WEB_VIEW_FRAME_H_ |
6 #define COMPONENTS_WEB_VIEW_FRAME_H_ | 6 #define COMPONENTS_WEB_VIEW_FRAME_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // When navigating, if the id of the new app matches that of the existing app, | 47 // When navigating, if the id of the new app matches that of the existing app, |
48 // then it is expected that the new FrameClient will take over rendering to the | 48 // then it is expected that the new FrameClient will take over rendering to the |
49 // existing view. Because of this a new ViewTreeClient is not obtained and | 49 // existing view. Because of this a new ViewTreeClient is not obtained and |
50 // Embed() is not invoked on the View. The FrameClient can detect this case by | 50 // Embed() is not invoked on the View. The FrameClient can detect this case by |
51 // the argument |reuse_existing_view| supplied to OnConnect(). Typically the id | 51 // the argument |reuse_existing_view| supplied to OnConnect(). Typically the id |
52 // is that of content handler id, but this is left up to the FrameTreeDelegate | 52 // is that of content handler id, but this is left up to the FrameTreeDelegate |
53 // to decide. | 53 // to decide. |
54 class Frame : public mus::ViewObserver, public mojom::Frame { | 54 class Frame : public mus::ViewObserver, public mojom::Frame { |
55 public: | 55 public: |
56 using ClientPropertyMap = std::map<std::string, std::vector<uint8_t>>; | 56 using ClientPropertyMap = std::map<std::string, std::vector<uint8_t>>; |
| 57 using FindCallback = mojo::Callback<void(int, const mojo::String&, bool)>; |
57 | 58 |
58 Frame(FrameTree* tree, | 59 Frame(FrameTree* tree, |
59 mus::View* view, | 60 mus::View* view, |
60 uint32_t frame_id, | 61 uint32_t frame_id, |
61 uint32_t app_id, | 62 uint32_t app_id, |
62 ViewOwnership view_ownership, | 63 ViewOwnership view_ownership, |
63 mojom::FrameClient* frame_client, | 64 mojom::FrameClient* frame_client, |
64 scoped_ptr<FrameUserData> user_data, | 65 scoped_ptr<FrameUserData> user_data, |
65 const ClientPropertyMap& client_properties); | 66 const ClientPropertyMap& client_properties); |
66 ~Frame() override; | 67 ~Frame() override; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 const std::vector<Frame*>& children() const { return children_; } | 107 const std::vector<Frame*>& children() const { return children_; } |
107 | 108 |
108 // Returns true if this Frame or any child Frame is loading. | 109 // Returns true if this Frame or any child Frame is loading. |
109 bool IsLoading() const; | 110 bool IsLoading() const; |
110 | 111 |
111 // Returns the sum total of loading progress from this Frame and all of its | 112 // Returns the sum total of loading progress from this Frame and all of its |
112 // children, as well as the number of Frames accumulated. | 113 // children, as well as the number of Frames accumulated. |
113 double GatherProgress(int* frame_count) const; | 114 double GatherProgress(int* frame_count) const; |
114 | 115 |
| 116 void Find(int32_t request_id, const mojo::String& search_text, |
| 117 const FindCallback& callback); |
| 118 void StopFinding(bool clear_selection); |
| 119 void ScopeStringMatches(int32_t request_id, const mojo::String& search_text, |
| 120 bool reset); |
| 121 void CancelPendingScopingEffort(); |
| 122 |
115 private: | 123 private: |
116 friend class FrameTest; | 124 friend class FrameTest; |
117 friend class FrameTree; | 125 friend class FrameTree; |
118 | 126 |
119 // Identifies whether the FrameClient is from the same app or a different | 127 // Identifies whether the FrameClient is from the same app or a different |
120 // app. | 128 // app. |
121 enum class ClientType { | 129 enum class ClientType { |
122 // The client is either the root frame, or navigating an existing frame | 130 // The client is either the root frame, or navigating an existing frame |
123 // to a different app. | 131 // to a different app. |
124 EXISTING_FRAME_NEW_APP, | 132 EXISTING_FRAME_NEW_APP, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 void OnCreatedFrame( | 225 void OnCreatedFrame( |
218 mojo::InterfaceRequest<mojom::Frame> frame_request, | 226 mojo::InterfaceRequest<mojom::Frame> frame_request, |
219 mojom::FrameClientPtr client, | 227 mojom::FrameClientPtr client, |
220 uint32_t frame_id, | 228 uint32_t frame_id, |
221 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties) override; | 229 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties) override; |
222 void RequestNavigate(mojom::NavigationTargetType target_type, | 230 void RequestNavigate(mojom::NavigationTargetType target_type, |
223 uint32_t target_frame_id, | 231 uint32_t target_frame_id, |
224 mojo::URLRequestPtr request) override; | 232 mojo::URLRequestPtr request) override; |
225 void DidNavigateLocally(const mojo::String& url) override; | 233 void DidNavigateLocally(const mojo::String& url) override; |
226 void DispatchLoadEventToParent() override; | 234 void DispatchLoadEventToParent() override; |
| 235 void OnReportFindInFrameMatchCount(int32_t request_id, |
| 236 int32_t count, |
| 237 bool final_update) override; |
| 238 void OnReportFindInPageSelection(int32_t request_id, |
| 239 int32_t active_match_ordinal) override; |
227 | 240 |
228 FrameTree* const tree_; | 241 FrameTree* const tree_; |
229 // WARNING: this may be null. See class description for details. | 242 // WARNING: this may be null. See class description for details. |
230 mus::View* view_; | 243 mus::View* view_; |
231 // The connection id returned from ViewManager::Embed(). Frames created by | 244 // The connection id returned from ViewManager::Embed(). Frames created by |
232 // way of OnCreatedFrame() inherit the id from the parent. | 245 // way of OnCreatedFrame() inherit the id from the parent. |
233 mus::ConnectionSpecificId embedded_connection_id_; | 246 mus::ConnectionSpecificId embedded_connection_id_; |
234 // ID for the frame, which is the same as that of the view. | 247 // ID for the frame, which is the same as that of the view. |
235 const uint32_t id_; | 248 const uint32_t id_; |
236 // ID of the app providing the FrameClient and ViewTreeClient. | 249 // ID of the app providing the FrameClient and ViewTreeClient. |
(...skipping 22 matching lines...) Expand all Loading... |
259 base::WeakPtrFactory<Frame> embed_weak_ptr_factory_; | 272 base::WeakPtrFactory<Frame> embed_weak_ptr_factory_; |
260 | 273 |
261 base::WeakPtrFactory<Frame> navigate_weak_ptr_factory_; | 274 base::WeakPtrFactory<Frame> navigate_weak_ptr_factory_; |
262 | 275 |
263 DISALLOW_COPY_AND_ASSIGN(Frame); | 276 DISALLOW_COPY_AND_ASSIGN(Frame); |
264 }; | 277 }; |
265 | 278 |
266 } // namespace web_view | 279 } // namespace web_view |
267 | 280 |
268 #endif // COMPONENTS_WEB_VIEW_FRAME_H_ | 281 #endif // COMPONENTS_WEB_VIEW_FRAME_H_ |
OLD | NEW |