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

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

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: rebase Created 4 years, 11 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 #include "components/html_viewer/document_resource_waiter.h" 5 #include "components/html_viewer/document_resource_waiter.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "components/html_viewer/global_state.h" 9 #include "components/html_viewer/global_state.h"
10 #include "components/html_viewer/html_document.h" 10 #include "components/html_viewer/html_document.h"
11 #include "components/html_viewer/html_frame_tree_manager.h" 11 #include "components/html_viewer/html_frame_tree_manager.h"
12 #include "components/mus/public/cpp/window.h" 12 #include "components/mus/public/cpp/window.h"
13 13
14 using web_view::mojom::WindowConnectType; 14 using web_view::mojom::WindowConnectType;
15 15
16 namespace html_viewer { 16 namespace html_viewer {
17 17
18 DocumentResourceWaiter::DocumentResourceWaiter(GlobalState* global_state, 18 DocumentResourceWaiter::DocumentResourceWaiter(GlobalState* global_state,
19 mojo::URLResponsePtr response, 19 mojo::URLResponsePtr response,
20 HTMLDocument* document) 20 HTMLDocument* document)
21 : global_state_(global_state), 21 : global_state_(global_state),
22 document_(document), 22 document_(document),
23 response_(std::move(response)), 23 response_(std::move(response)),
24 root_(nullptr), 24 root_(nullptr),
25 change_id_(0u), 25 change_id_(0u),
26 window_id_(0u), 26 window_id_(0u),
27 window_connect_type_(web_view::mojom::WINDOW_CONNECT_TYPE_USE_NEW), 27 window_connect_type_(web_view::mojom::WindowConnectType::USE_NEW),
28 frame_client_binding_(this), 28 frame_client_binding_(this),
29 is_ready_(false), 29 is_ready_(false),
30 waiting_for_change_id_(false), 30 waiting_for_change_id_(false),
31 target_frame_tree_(nullptr) {} 31 target_frame_tree_(nullptr) {}
32 32
33 DocumentResourceWaiter::~DocumentResourceWaiter() { 33 DocumentResourceWaiter::~DocumentResourceWaiter() {
34 if (root_) 34 if (root_)
35 root_->RemoveObserver(this); 35 root_->RemoveObserver(this);
36 if (target_frame_tree_) 36 if (target_frame_tree_)
37 target_frame_tree_->RemoveObserver(this); 37 target_frame_tree_->RemoveObserver(this);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // (|frame_data_| is valid) and we have a window with valid metrics. The 93 // (|frame_data_| is valid) and we have a window with valid metrics. The
94 // window is not necessary is WindowConnectType is USE_EXISTING, which means 94 // window is not necessary is WindowConnectType is USE_EXISTING, which means
95 // the 95 // the
96 // application is not asked for a ViewTreeClient. The metrics are necessary 96 // application is not asked for a ViewTreeClient. The metrics are necessary
97 // to initialize ResourceBundle. If USE_EXISTING is true, it means a Window 97 // to initialize ResourceBundle. If USE_EXISTING is true, it means a Window
98 // has already been provided to another HTMLDocument and there is no need to 98 // has already been provided to another HTMLDocument and there is no need to
99 // wait for metrics. 99 // wait for metrics.
100 bool is_ready = 100 bool is_ready =
101 (!frame_data_.is_null() && 101 (!frame_data_.is_null() &&
102 ((window_connect_type_ == 102 ((window_connect_type_ ==
103 web_view::mojom::WINDOW_CONNECT_TYPE_USE_EXISTING) || 103 web_view::mojom::WindowConnectType::USE_EXISTING) ||
104 (root_ && root_->viewport_metrics().device_pixel_ratio != 0.0f))); 104 (root_ && root_->viewport_metrics().device_pixel_ratio != 0.0f)));
105 if (is_ready) { 105 if (is_ready) {
106 HTMLFrameTreeManager* frame_tree = 106 HTMLFrameTreeManager* frame_tree =
107 HTMLFrameTreeManager::FindFrameTreeWithRoot(frame_data_[0]->frame_id); 107 HTMLFrameTreeManager::FindFrameTreeWithRoot(frame_data_[0]->frame_id);
108 // Once we've received OnConnect() and the window (if necessary), we 108 // Once we've received OnConnect() and the window (if necessary), we
109 // determine which HTMLFrameTreeManager the new frame ends up in. If there 109 // determine which HTMLFrameTreeManager the new frame ends up in. If there
110 // is an existing HTMLFrameTreeManager then we must wait for the change_id 110 // is an existing HTMLFrameTreeManager then we must wait for the change_id
111 // supplied to OnConnect() to be <= that of the HTMLFrameTreeManager's 111 // supplied to OnConnect() to be <= that of the HTMLFrameTreeManager's
112 // change_id. If we did not wait for the change id to be <= then the 112 // change_id. If we did not wait for the change id to be <= then the
113 // structure of the tree is not in the expected state and it's possible the 113 // structure of the tree is not in the expected state and it's possible the
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 void DocumentResourceWaiter::OnHTMLFrameTreeManagerChangeIdAdvanced() { 235 void DocumentResourceWaiter::OnHTMLFrameTreeManagerChangeIdAdvanced() {
236 UpdateIsReady(); 236 UpdateIsReady();
237 } 237 }
238 238
239 void DocumentResourceWaiter::OnHTMLFrameTreeManagerDestroyed() { 239 void DocumentResourceWaiter::OnHTMLFrameTreeManagerDestroyed() {
240 document_->Destroy(); // This destroys us. 240 document_->Destroy(); // This destroys us.
241 } 241 }
242 242
243 } // namespace html_viewer 243 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/blink_text_input_type_converters.cc ('k') | components/html_viewer/html_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698