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 "base/time/time.h" |
10 #include "components/html_viewer/html_frame_tree_manager_observer.h" | 10 #include "components/html_viewer/html_frame_tree_manager_observer.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 HTMLDocument* document); | 31 HTMLDocument* document); |
32 ~DocumentResourceWaiter() override; | 32 ~DocumentResourceWaiter() override; |
33 | 33 |
34 // Releases all the resources that have been accumulated. | 34 // Releases all the resources that have been accumulated. |
35 void Release(mojo::InterfaceRequest<web_view::mojom::FrameClient>* | 35 void Release(mojo::InterfaceRequest<web_view::mojom::FrameClient>* |
36 frame_client_request, | 36 frame_client_request, |
37 web_view::mojom::FramePtr* frame, | 37 web_view::mojom::FramePtr* frame, |
38 mojo::Array<web_view::mojom::FrameDataPtr>* frame_data, | 38 mojo::Array<web_view::mojom::FrameDataPtr>* frame_data, |
39 uint32_t* window_id, | 39 uint32_t* window_id, |
40 uint32_t* change_id, | 40 uint32_t* change_id, |
41 web_view::mojom::ViewConnectType* view_connect_type, | 41 web_view::mojom::WindowConnectType* window_connect_type, |
42 OnConnectCallback* on_connect_callback); | 42 OnConnectCallback* on_connect_callback); |
43 | 43 |
44 uint32_t change_id() const { return change_id_; } | 44 uint32_t change_id() const { return change_id_; } |
45 | 45 |
46 mojo::URLResponsePtr ReleaseURLResponse(); | 46 mojo::URLResponsePtr ReleaseURLResponse(); |
47 | 47 |
48 // See class description. | 48 // See class description. |
49 bool is_ready() const { return is_ready_; } | 49 bool is_ready() const { return is_ready_; } |
50 | 50 |
51 base::TimeTicks navigation_start_time() const { | 51 base::TimeTicks navigation_start_time() const { |
52 return navigation_start_time_; | 52 return navigation_start_time_; |
53 } | 53 } |
54 | 54 |
55 void SetRoot(mus::Window* root); | 55 void SetRoot(mus::Window* root); |
56 mus::Window* root() { return root_; } | 56 mus::Window* root() { return root_; } |
57 | 57 |
58 void Bind(mojo::InterfaceRequest<web_view::mojom::FrameClient> request); | 58 void Bind(mojo::InterfaceRequest<web_view::mojom::FrameClient> request); |
59 | 59 |
60 private: | 60 private: |
61 // Updates |is_ready_|, and if ready starts the Load() in the document. | 61 // Updates |is_ready_|, and if ready starts the Load() in the document. |
62 void UpdateIsReady(); | 62 void UpdateIsReady(); |
63 | 63 |
64 // web_view::mojom::FrameClient: | 64 // web_view::mojom::FrameClient: |
65 void OnConnect(web_view::mojom::FramePtr frame, | 65 void OnConnect(web_view::mojom::FramePtr frame, |
66 uint32_t change_id, | 66 uint32_t change_id, |
67 uint32_t window_id, | 67 uint32_t window_id, |
68 web_view::mojom::ViewConnectType view_connect_type, | 68 web_view::mojom::WindowConnectType window_connect_type, |
69 mojo::Array<web_view::mojom::FrameDataPtr> frame_data, | 69 mojo::Array<web_view::mojom::FrameDataPtr> frame_data, |
70 int64_t navigation_start_time_ticks, | 70 int64_t navigation_start_time_ticks, |
71 const OnConnectCallback& callback) override; | 71 const OnConnectCallback& callback) override; |
72 void OnFrameAdded(uint32_t change_id, | 72 void OnFrameAdded(uint32_t change_id, |
73 web_view::mojom::FrameDataPtr frame_data) override; | 73 web_view::mojom::FrameDataPtr frame_data) override; |
74 void OnFrameRemoved(uint32_t change_id, uint32_t frame_id) override; | 74 void OnFrameRemoved(uint32_t change_id, uint32_t frame_id) override; |
75 void OnFrameClientPropertyChanged(uint32_t frame_id, | 75 void OnFrameClientPropertyChanged(uint32_t frame_id, |
76 const mojo::String& name, | 76 const mojo::String& name, |
77 mojo::Array<uint8_t> new_value) override; | 77 mojo::Array<uint8_t> new_value) override; |
78 void OnPostMessageEvent(uint32_t source_frame_id, | 78 void OnPostMessageEvent(uint32_t source_frame_id, |
(...skipping 28 matching lines...) Expand all Loading... |
107 | 107 |
108 GlobalState* global_state_; | 108 GlobalState* global_state_; |
109 HTMLDocument* document_; | 109 HTMLDocument* document_; |
110 mojo::URLResponsePtr response_; | 110 mojo::URLResponsePtr response_; |
111 mus::Window* root_; | 111 mus::Window* root_; |
112 web_view::mojom::FramePtr frame_; | 112 web_view::mojom::FramePtr frame_; |
113 mojo::Array<web_view::mojom::FrameDataPtr> frame_data_; | 113 mojo::Array<web_view::mojom::FrameDataPtr> frame_data_; |
114 uint32_t change_id_; | 114 uint32_t change_id_; |
115 uint32_t window_id_; | 115 uint32_t window_id_; |
116 base::TimeTicks navigation_start_time_; | 116 base::TimeTicks navigation_start_time_; |
117 web_view::mojom::ViewConnectType view_connect_type_; | 117 web_view::mojom::WindowConnectType window_connect_type_; |
118 OnConnectCallback on_connect_callback_; | 118 OnConnectCallback on_connect_callback_; |
119 | 119 |
120 // Once we get OnConnect() we unbind |frame_client_binding_| and put it here. | 120 // Once we get OnConnect() we unbind |frame_client_binding_| and put it here. |
121 mojo::InterfaceRequest<web_view::mojom::FrameClient> frame_client_request_; | 121 mojo::InterfaceRequest<web_view::mojom::FrameClient> frame_client_request_; |
122 mojo::Binding<web_view::mojom::FrameClient> frame_client_binding_; | 122 mojo::Binding<web_view::mojom::FrameClient> frame_client_binding_; |
123 | 123 |
124 bool is_ready_; | 124 bool is_ready_; |
125 | 125 |
126 // See comments in UpdateIsReady() for details of this. | 126 // See comments in UpdateIsReady() for details of this. |
127 // | 127 // |
128 // While |waiting_for_change_id_| is true DocumentResourceWaiter is an | 128 // While |waiting_for_change_id_| is true DocumentResourceWaiter is an |
129 // HTMLFrameTreeManagerObserver on |target_frame_tree_|. | 129 // HTMLFrameTreeManagerObserver on |target_frame_tree_|. |
130 bool waiting_for_change_id_; | 130 bool waiting_for_change_id_; |
131 | 131 |
132 HTMLFrameTreeManager* target_frame_tree_; | 132 HTMLFrameTreeManager* target_frame_tree_; |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(DocumentResourceWaiter); | 134 DISALLOW_COPY_AND_ASSIGN(DocumentResourceWaiter); |
135 }; | 135 }; |
136 | 136 |
137 } // namespace html_viewer | 137 } // namespace html_viewer |
138 | 138 |
139 #endif // COMPONENTS_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_ | 139 #endif // COMPONENTS_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_ |
OLD | NEW |