| 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_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_ |
| 6 #define COMPONENTS_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_ | 6 #define COMPONENTS_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/time/time.h" |
| 9 #include "components/html_viewer/html_frame_tree_manager_observer.h" | 10 #include "components/html_viewer/html_frame_tree_manager_observer.h" |
| 10 #include "components/mus/public/cpp/view_observer.h" | 11 #include "components/mus/public/cpp/view_observer.h" |
| 11 #include "components/web_view/public/interfaces/frame.mojom.h" | 12 #include "components/web_view/public/interfaces/frame.mojom.h" |
| 12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 13 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
| 14 | 15 |
| 15 namespace mojo { | 16 namespace mojo { |
| 16 class View; | 17 class View; |
| 17 } | 18 } |
| 18 | 19 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 44 web_view::mojom::ViewConnectType* view_connect_type, | 45 web_view::mojom::ViewConnectType* view_connect_type, |
| 45 OnConnectCallback* on_connect_callback); | 46 OnConnectCallback* on_connect_callback); |
| 46 | 47 |
| 47 uint32_t change_id() const { return change_id_; } | 48 uint32_t change_id() const { return change_id_; } |
| 48 | 49 |
| 49 mojo::URLResponsePtr ReleaseURLResponse(); | 50 mojo::URLResponsePtr ReleaseURLResponse(); |
| 50 | 51 |
| 51 // See class description. | 52 // See class description. |
| 52 bool is_ready() const { return is_ready_; } | 53 bool is_ready() const { return is_ready_; } |
| 53 | 54 |
| 55 base::TimeTicks navigation_start_time() const { |
| 56 return navigation_start_time_; |
| 57 } |
| 58 |
| 54 void SetRoot(mus::View* root); | 59 void SetRoot(mus::View* root); |
| 55 mus::View* root() { return root_; } | 60 mus::View* root() { return root_; } |
| 56 | 61 |
| 57 void Bind(mojo::InterfaceRequest<web_view::mojom::FrameClient> request); | 62 void Bind(mojo::InterfaceRequest<web_view::mojom::FrameClient> request); |
| 58 | 63 |
| 59 private: | 64 private: |
| 60 // Updates |is_ready_|, and if ready starts the Load() in the document. | 65 // Updates |is_ready_|, and if ready starts the Load() in the document. |
| 61 void UpdateIsReady(); | 66 void UpdateIsReady(); |
| 62 | 67 |
| 63 // web_view::mojom::FrameClient: | 68 // web_view::mojom::FrameClient: |
| 64 void OnConnect(web_view::mojom::FramePtr frame, | 69 void OnConnect(web_view::mojom::FramePtr frame, |
| 65 uint32_t change_id, | 70 uint32_t change_id, |
| 66 uint32_t view_id, | 71 uint32_t view_id, |
| 67 web_view::mojom::ViewConnectType view_connect_type, | 72 web_view::mojom::ViewConnectType view_connect_type, |
| 68 mojo::Array<web_view::mojom::FrameDataPtr> frame_data, | 73 mojo::Array<web_view::mojom::FrameDataPtr> frame_data, |
| 74 int64_t navigation_start_time_ticks, |
| 69 const OnConnectCallback& callback) override; | 75 const OnConnectCallback& callback) override; |
| 70 void OnFrameAdded(uint32_t change_id, | 76 void OnFrameAdded(uint32_t change_id, |
| 71 web_view::mojom::FrameDataPtr frame_data) override; | 77 web_view::mojom::FrameDataPtr frame_data) override; |
| 72 void OnFrameRemoved(uint32_t change_id, uint32_t frame_id) override; | 78 void OnFrameRemoved(uint32_t change_id, uint32_t frame_id) override; |
| 73 void OnFrameClientPropertyChanged(uint32_t frame_id, | 79 void OnFrameClientPropertyChanged(uint32_t frame_id, |
| 74 const mojo::String& name, | 80 const mojo::String& name, |
| 75 mojo::Array<uint8_t> new_value) override; | 81 mojo::Array<uint8_t> new_value) override; |
| 76 void OnPostMessageEvent(uint32_t source_frame_id, | 82 void OnPostMessageEvent(uint32_t source_frame_id, |
| 77 uint32_t target_frame_id, | 83 uint32_t target_frame_id, |
| 78 web_view::mojom::HTMLMessageEventPtr event) override; | 84 web_view::mojom::HTMLMessageEventPtr event) override; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 101 void OnHTMLFrameTreeManagerDestroyed() override; | 107 void OnHTMLFrameTreeManagerDestroyed() override; |
| 102 | 108 |
| 103 GlobalState* global_state_; | 109 GlobalState* global_state_; |
| 104 HTMLDocument* document_; | 110 HTMLDocument* document_; |
| 105 mojo::URLResponsePtr response_; | 111 mojo::URLResponsePtr response_; |
| 106 mus::View* root_; | 112 mus::View* root_; |
| 107 web_view::mojom::FramePtr frame_; | 113 web_view::mojom::FramePtr frame_; |
| 108 mojo::Array<web_view::mojom::FrameDataPtr> frame_data_; | 114 mojo::Array<web_view::mojom::FrameDataPtr> frame_data_; |
| 109 uint32_t change_id_; | 115 uint32_t change_id_; |
| 110 uint32_t view_id_; | 116 uint32_t view_id_; |
| 117 base::TimeTicks navigation_start_time_; |
| 111 web_view::mojom::ViewConnectType view_connect_type_; | 118 web_view::mojom::ViewConnectType view_connect_type_; |
| 112 OnConnectCallback on_connect_callback_; | 119 OnConnectCallback on_connect_callback_; |
| 113 | 120 |
| 114 // Once we get OnConnect() we unbind |frame_client_binding_| and put it here. | 121 // Once we get OnConnect() we unbind |frame_client_binding_| and put it here. |
| 115 mojo::InterfaceRequest<web_view::mojom::FrameClient> frame_client_request_; | 122 mojo::InterfaceRequest<web_view::mojom::FrameClient> frame_client_request_; |
| 116 mojo::Binding<web_view::mojom::FrameClient> frame_client_binding_; | 123 mojo::Binding<web_view::mojom::FrameClient> frame_client_binding_; |
| 117 | 124 |
| 118 bool is_ready_; | 125 bool is_ready_; |
| 119 | 126 |
| 120 // See comments in UpdateIsReady() for details of this. | 127 // See comments in UpdateIsReady() for details of this. |
| 121 // | 128 // |
| 122 // While |waiting_for_change_id_| is true DocumentResourceWaiter is an | 129 // While |waiting_for_change_id_| is true DocumentResourceWaiter is an |
| 123 // HTMLFrameTreeManagerObserver on |target_frame_tree_|. | 130 // HTMLFrameTreeManagerObserver on |target_frame_tree_|. |
| 124 bool waiting_for_change_id_; | 131 bool waiting_for_change_id_; |
| 125 | 132 |
| 126 HTMLFrameTreeManager* target_frame_tree_; | 133 HTMLFrameTreeManager* target_frame_tree_; |
| 127 | 134 |
| 128 DISALLOW_COPY_AND_ASSIGN(DocumentResourceWaiter); | 135 DISALLOW_COPY_AND_ASSIGN(DocumentResourceWaiter); |
| 129 }; | 136 }; |
| 130 | 137 |
| 131 } // namespace html_viewer | 138 } // namespace html_viewer |
| 132 | 139 |
| 133 #endif // COMPONENTS_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_ | 140 #endif // COMPONENTS_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_ |
| OLD | NEW |