Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: components/html_viewer/document_resource_waiter.h

Issue 1351013002: Revert of Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/html_viewer/html_frame_tree_manager_observer.h" 9 #include "components/html_viewer/html_frame_tree_manager_observer.h"
10 #include "components/mus/public/cpp/view_observer.h" 10 #include "components/mus/public/cpp/view_observer.h"
11 #include "components/web_view/public/interfaces/frame_tree.mojom.h" 11 #include "components/web_view/public/interfaces/frame_tree.mojom.h"
12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" 12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 class View; 16 class View;
17 } 17 }
18 18
19 namespace html_viewer { 19 namespace html_viewer {
20 20
21 class HTMLDocument; 21 class HTMLDocument;
22 class HTMLFrameTreeManager; 22 class HTMLFrameTreeManager;
23 class GlobalState; 23 class GlobalState;
24 24
25 // DocumentResourceWaiter waits for the necessary resources needed to load an 25 // DocumentResourceWaiter waits for the necessary resources needed to load an
26 // HTMLDocument. Once ready it calls to HTMLDocument::Load(). Once ready it is 26 // HTMLDocument. Once ready it calls to HTMLDocument::Load(). Once ready it is
27 // assumed HTMLDocument will call back for the FrameTreeClient and FrameData. 27 // assumed HTMLDocument will call back for the FrameTreeClient and FrameData.
28 class DocumentResourceWaiter : public web_view::FrameTreeClient, 28 class DocumentResourceWaiter : public web_view::FrameTreeClient,
29 public HTMLFrameTreeManagerObserver, 29 public HTMLFrameTreeManagerObserver,
30 public mus::ViewObserver { 30 public mojo::ViewObserver {
31 public: 31 public:
32 DocumentResourceWaiter(GlobalState* global_state, 32 DocumentResourceWaiter(GlobalState* global_state,
33 mojo::URLResponsePtr response, 33 mojo::URLResponsePtr response,
34 HTMLDocument* document); 34 HTMLDocument* document);
35 ~DocumentResourceWaiter() override; 35 ~DocumentResourceWaiter() override;
36 36
37 // Releases all the resources that have been accumulated. 37 // Releases all the resources that have been accumulated.
38 void Release(mojo::InterfaceRequest<web_view::FrameTreeClient>* 38 void Release(mojo::InterfaceRequest<web_view::FrameTreeClient>*
39 frame_tree_client_request, 39 frame_tree_client_request,
40 web_view::FrameTreeServerPtr* frame_tree_server, 40 web_view::FrameTreeServerPtr* frame_tree_server,
41 mojo::Array<web_view::FrameDataPtr>* frame_data, 41 mojo::Array<web_view::FrameDataPtr>* frame_data,
42 uint32_t* view_id, 42 uint32_t* view_id,
43 uint32_t* change_id, 43 uint32_t* change_id,
44 web_view::ViewConnectType* view_connect_type, 44 web_view::ViewConnectType* view_connect_type,
45 OnConnectCallback* on_connect_callback); 45 OnConnectCallback* on_connect_callback);
46 46
47 uint32_t change_id() const { return change_id_; } 47 uint32_t change_id() const { return change_id_; }
48 48
49 mojo::URLResponsePtr ReleaseURLResponse(); 49 mojo::URLResponsePtr ReleaseURLResponse();
50 50
51 // See class description. 51 // See class description.
52 bool is_ready() const { return is_ready_; } 52 bool is_ready() const { return is_ready_; }
53 53
54 void SetRoot(mus::View* root); 54 void SetRoot(mojo::View* root);
55 mus::View* root() { return root_; } 55 mojo::View* root() { return root_; }
56 56
57 void Bind(mojo::InterfaceRequest<web_view::FrameTreeClient> request); 57 void Bind(mojo::InterfaceRequest<web_view::FrameTreeClient> request);
58 58
59 private: 59 private:
60 // Updates |is_ready_|, and if ready starts the Load() in the document. 60 // Updates |is_ready_|, and if ready starts the Load() in the document.
61 void UpdateIsReady(); 61 void UpdateIsReady();
62 62
63 // web_view::FrameTreeClient: 63 // web_view::FrameTreeClient:
64 void OnConnect(web_view::FrameTreeServerPtr server, 64 void OnConnect(web_view::FrameTreeServerPtr server,
65 uint32_t change_id, 65 uint32_t change_id,
66 uint32_t view_id, 66 uint32_t view_id,
67 web_view::ViewConnectType view_connect_type, 67 web_view::ViewConnectType view_connect_type,
68 mojo::Array<web_view::FrameDataPtr> frame_data, 68 mojo::Array<web_view::FrameDataPtr> frame_data,
69 const OnConnectCallback& callback) override; 69 const OnConnectCallback& callback) override;
70 void OnFrameAdded(uint32_t change_id, 70 void OnFrameAdded(uint32_t change_id,
71 web_view::FrameDataPtr frame_data) override; 71 web_view::FrameDataPtr frame_data) override;
72 void OnFrameRemoved(uint32_t change_id, uint32_t frame_id) override; 72 void OnFrameRemoved(uint32_t change_id, uint32_t frame_id) override;
73 void OnFrameClientPropertyChanged(uint32_t frame_id, 73 void OnFrameClientPropertyChanged(uint32_t frame_id,
74 const mojo::String& name, 74 const mojo::String& name,
75 mojo::Array<uint8_t> new_value) override; 75 mojo::Array<uint8_t> new_value) override;
76 void OnPostMessageEvent(uint32_t source_frame_id, 76 void OnPostMessageEvent(uint32_t source_frame_id,
77 uint32_t target_frame_id, 77 uint32_t target_frame_id,
78 web_view::HTMLMessageEventPtr event) override; 78 web_view::HTMLMessageEventPtr event) override;
79 void OnWillNavigate(uint32_t target_frame_id) override; 79 void OnWillNavigate(uint32_t target_frame_id) override;
80 80
81 // ViewObserver: 81 // ViewObserver:
82 void OnViewViewportMetricsChanged( 82 void OnViewViewportMetricsChanged(
83 mus::View* view, 83 mojo::View* view,
84 const mojo::ViewportMetrics& old_metrics, 84 const mojo::ViewportMetrics& old_metrics,
85 const mojo::ViewportMetrics& new_metrics) override; 85 const mojo::ViewportMetrics& new_metrics) override;
86 void OnViewDestroyed(mus::View* view) override; 86 void OnViewDestroyed(mojo::View* view) override;
87 87
88 // HTMLFrameTreeManagerObserver: 88 // HTMLFrameTreeManagerObserver:
89 void OnHTMLFrameTreeManagerChangeIdAdvanced() override; 89 void OnHTMLFrameTreeManagerChangeIdAdvanced() override;
90 void OnHTMLFrameTreeManagerDestroyed() override; 90 void OnHTMLFrameTreeManagerDestroyed() override;
91 91
92 GlobalState* global_state_; 92 GlobalState* global_state_;
93 HTMLDocument* document_; 93 HTMLDocument* document_;
94 mojo::URLResponsePtr response_; 94 mojo::URLResponsePtr response_;
95 mus::View* root_; 95 mojo::View* root_;
96 web_view::FrameTreeServerPtr server_; 96 web_view::FrameTreeServerPtr server_;
97 mojo::Array<web_view::FrameDataPtr> frame_data_; 97 mojo::Array<web_view::FrameDataPtr> frame_data_;
98 uint32_t change_id_; 98 uint32_t change_id_;
99 uint32_t view_id_; 99 uint32_t view_id_;
100 web_view::ViewConnectType view_connect_type_; 100 web_view::ViewConnectType view_connect_type_;
101 OnConnectCallback on_connect_callback_; 101 OnConnectCallback on_connect_callback_;
102 102
103 // Once we get OnConnect() we unbind |frame_tree_client_binding_| and put it 103 // Once we get OnConnect() we unbind |frame_tree_client_binding_| and put it
104 // here. 104 // here.
105 mojo::InterfaceRequest<web_view::FrameTreeClient> frame_tree_client_request_; 105 mojo::InterfaceRequest<web_view::FrameTreeClient> frame_tree_client_request_;
106 mojo::Binding<web_view::FrameTreeClient> frame_tree_client_binding_; 106 mojo::Binding<web_view::FrameTreeClient> frame_tree_client_binding_;
107 107
108 bool is_ready_; 108 bool is_ready_;
109 109
110 // See comments in UpdateIsReady() for details of this. 110 // See comments in UpdateIsReady() for details of this.
111 // 111 //
112 // While |waiting_for_change_id_| is true DocumentResourceWaiter is an 112 // While |waiting_for_change_id_| is true DocumentResourceWaiter is an
113 // HTMLFrameTreeManagerObserver on |target_frame_tree_|. 113 // HTMLFrameTreeManagerObserver on |target_frame_tree_|.
114 bool waiting_for_change_id_; 114 bool waiting_for_change_id_;
115 115
116 HTMLFrameTreeManager* target_frame_tree_; 116 HTMLFrameTreeManager* target_frame_tree_;
117 117
118 DISALLOW_COPY_AND_ASSIGN(DocumentResourceWaiter); 118 DISALLOW_COPY_AND_ASSIGN(DocumentResourceWaiter);
119 }; 119 };
120 120
121 } // namespace html_viewer 121 } // namespace html_viewer
122 122
123 #endif // COMPONENTS_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_ 123 #endif // COMPONENTS_HTML_VIEWER_DOCUMENT_RESOURCE_WAITER_H_
OLDNEW
« no previous file with comments | « components/html_viewer/ax_provider_apptest.cc ('k') | components/html_viewer/document_resource_waiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698