| 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(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, |
| 117 const mojo::String& search_text, |
| 118 const FindCallback& callback); |
| 119 void StopFinding(bool clear_selection); |
| 120 void HighlightFindResults(int32_t request_id, |
| 121 const mojo::String& search_text, |
| 122 bool reset); |
| 123 void StopHighlightingFindResults(); |
| 124 |
| 115 private: | 125 private: |
| 116 friend class FrameTest; | 126 friend class FrameTest; |
| 117 friend class FrameTree; | 127 friend class FrameTree; |
| 118 | 128 |
| 119 // Identifies whether the FrameClient is from the same app or a different | 129 // Identifies whether the FrameClient is from the same app or a different |
| 120 // app. | 130 // app. |
| 121 enum class ClientType { | 131 enum class ClientType { |
| 122 // The client is either the root frame, or navigating an existing frame | 132 // The client is either the root frame, or navigating an existing frame |
| 123 // to a different app. | 133 // to a different app. |
| 124 EXISTING_FRAME_NEW_APP, | 134 EXISTING_FRAME_NEW_APP, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 void OnCreatedFrame( | 227 void OnCreatedFrame( |
| 218 mojo::InterfaceRequest<mojom::Frame> frame_request, | 228 mojo::InterfaceRequest<mojom::Frame> frame_request, |
| 219 mojom::FrameClientPtr client, | 229 mojom::FrameClientPtr client, |
| 220 uint32_t frame_id, | 230 uint32_t frame_id, |
| 221 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties) override; | 231 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties) override; |
| 222 void RequestNavigate(mojom::NavigationTargetType target_type, | 232 void RequestNavigate(mojom::NavigationTargetType target_type, |
| 223 uint32_t target_frame_id, | 233 uint32_t target_frame_id, |
| 224 mojo::URLRequestPtr request) override; | 234 mojo::URLRequestPtr request) override; |
| 225 void DidNavigateLocally(const mojo::String& url) override; | 235 void DidNavigateLocally(const mojo::String& url) override; |
| 226 void DispatchLoadEventToParent() override; | 236 void DispatchLoadEventToParent() override; |
| 237 void OnFindInFrameCountUpdated(int32_t request_id, |
| 238 int32_t count, |
| 239 bool final_update) override; |
| 240 void OnFindInPageSelectionUpdated(int32_t request_id, |
| 241 int32_t active_match_ordinal) override; |
| 227 | 242 |
| 228 FrameTree* const tree_; | 243 FrameTree* const tree_; |
| 229 // WARNING: this may be null. See class description for details. | 244 // WARNING: this may be null. See class description for details. |
| 230 mus::View* view_; | 245 mus::View* view_; |
| 231 // The connection id returned from ViewManager::Embed(). Frames created by | 246 // The connection id returned from ViewManager::Embed(). Frames created by |
| 232 // way of OnCreatedFrame() inherit the id from the parent. | 247 // way of OnCreatedFrame() inherit the id from the parent. |
| 233 mus::ConnectionSpecificId embedded_connection_id_; | 248 mus::ConnectionSpecificId embedded_connection_id_; |
| 234 // ID for the frame, which is the same as that of the view. | 249 // ID for the frame, which is the same as that of the view. |
| 235 const uint32_t id_; | 250 const uint32_t id_; |
| 236 // ID of the app providing the FrameClient and ViewTreeClient. | 251 // ID of the app providing the FrameClient and ViewTreeClient. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 259 base::WeakPtrFactory<Frame> embed_weak_ptr_factory_; | 274 base::WeakPtrFactory<Frame> embed_weak_ptr_factory_; |
| 260 | 275 |
| 261 base::WeakPtrFactory<Frame> navigate_weak_ptr_factory_; | 276 base::WeakPtrFactory<Frame> navigate_weak_ptr_factory_; |
| 262 | 277 |
| 263 DISALLOW_COPY_AND_ASSIGN(Frame); | 278 DISALLOW_COPY_AND_ASSIGN(Frame); |
| 264 }; | 279 }; |
| 265 | 280 |
| 266 } // namespace web_view | 281 } // namespace web_view |
| 267 | 282 |
| 268 #endif // COMPONENTS_WEB_VIEW_FRAME_H_ | 283 #endif // COMPONENTS_WEB_VIEW_FRAME_H_ |
| OLD | NEW |