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

Side by Side Diff: components/web_view/frame.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
« no previous file with comments | « components/pdf_viewer/pdf_viewer.cc ('k') | components/web_view/frame_apptest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/web_view/frame.h" 5 #include "components/web_view/frame.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void Frame::InitClient(ClientType client_type, 194 void Frame::InitClient(ClientType client_type,
195 scoped_ptr<FrameUserDataAndBinding> data_and_binding, 195 scoped_ptr<FrameUserDataAndBinding> data_and_binding,
196 mus::mojom::WindowTreeClientPtr window_tree_client, 196 mus::mojom::WindowTreeClientPtr window_tree_client,
197 mojo::InterfaceRequest<mojom::Frame> frame_request, 197 mojo::InterfaceRequest<mojom::Frame> frame_request,
198 base::TimeTicks navigation_start_time) { 198 base::TimeTicks navigation_start_time) {
199 if (client_type == ClientType::EXISTING_FRAME_NEW_APP && window_tree_client) { 199 if (client_type == ClientType::EXISTING_FRAME_NEW_APP && window_tree_client) {
200 embedded_connection_id_ = kInvalidConnectionId; 200 embedded_connection_id_ = kInvalidConnectionId;
201 embed_weak_ptr_factory_.InvalidateWeakPtrs(); 201 embed_weak_ptr_factory_.InvalidateWeakPtrs();
202 window_->Embed( 202 window_->Embed(
203 std::move(window_tree_client), 203 std::move(window_tree_client),
204 mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT, 204 mus::mojom::WindowTree::kAccessPolicyDefault,
205 base::Bind(&Frame::OnEmbedAck, embed_weak_ptr_factory_.GetWeakPtr())); 205 base::Bind(&Frame::OnEmbedAck, embed_weak_ptr_factory_.GetWeakPtr()));
206 } 206 }
207 207
208 if (client_type == ClientType::NEW_CHILD_FRAME) { 208 if (client_type == ClientType::NEW_CHILD_FRAME) {
209 // Don't install an error handler. We allow for the target to only 209 // Don't install an error handler. We allow for the target to only
210 // implement WindowTreeClient. 210 // implement WindowTreeClient.
211 // This frame (and client) was created by an existing FrameClient. There 211 // This frame (and client) was created by an existing FrameClient. There
212 // is no need to send it OnConnect(). 212 // is no need to send it OnConnect().
213 frame_binding_.reset( 213 frame_binding_.reset(
214 new mojo::Binding<mojom::Frame>(this, std::move(frame_request))); 214 new mojo::Binding<mojom::Frame>(this, std::move(frame_request)));
215 frame_client_->OnConnect( 215 frame_client_->OnConnect(
216 nullptr, tree_->change_id(), id_, mojom::WINDOW_CONNECT_TYPE_USE_NEW, 216 nullptr, tree_->change_id(), id_, mojom::WindowConnectType::USE_NEW,
217 mojo::Array<mojom::FrameDataPtr>(), 217 mojo::Array<mojom::FrameDataPtr>(),
218 navigation_start_time.ToInternalValue(), 218 navigation_start_time.ToInternalValue(),
219 base::Bind(&OnConnectAck, base::Passed(&data_and_binding))); 219 base::Bind(&OnConnectAck, base::Passed(&data_and_binding)));
220 } else { 220 } else {
221 std::vector<const Frame*> frames; 221 std::vector<const Frame*> frames;
222 tree_->root()->BuildFrameTree(&frames); 222 tree_->root()->BuildFrameTree(&frames);
223 223
224 mojo::Array<mojom::FrameDataPtr> array(frames.size()); 224 mojo::Array<mojom::FrameDataPtr> array(frames.size());
225 for (size_t i = 0; i < frames.size(); ++i) 225 for (size_t i = 0; i < frames.size(); ++i)
226 array[i] = FrameToFrameData(frames[i]); 226 array[i] = FrameToFrameData(frames[i]);
227 227
228 mojom::FramePtr frame_ptr; 228 mojom::FramePtr frame_ptr;
229 // Don't install an error handler. We allow for the target to only 229 // Don't install an error handler. We allow for the target to only
230 // implement WindowTreeClient. 230 // implement WindowTreeClient.
231 frame_binding_.reset( 231 frame_binding_.reset(
232 new mojo::Binding<mojom::Frame>(this, GetProxy(&frame_ptr))); 232 new mojo::Binding<mojom::Frame>(this, GetProxy(&frame_ptr)));
233 frame_client_->OnConnect( 233 frame_client_->OnConnect(
234 std::move(frame_ptr), tree_->change_id(), id_, 234 std::move(frame_ptr), tree_->change_id(), id_,
235 client_type == ClientType::EXISTING_FRAME_SAME_APP 235 client_type == ClientType::EXISTING_FRAME_SAME_APP
236 ? mojom::WINDOW_CONNECT_TYPE_USE_EXISTING 236 ? mojom::WindowConnectType::USE_EXISTING
237 : mojom::WINDOW_CONNECT_TYPE_USE_NEW, 237 : mojom::WindowConnectType::USE_NEW,
238 std::move(array), navigation_start_time.ToInternalValue(), 238 std::move(array), navigation_start_time.ToInternalValue(),
239 base::Bind(&OnConnectAck, base::Passed(&data_and_binding))); 239 base::Bind(&OnConnectAck, base::Passed(&data_and_binding)));
240 tree_->delegate_->DidStartNavigation(this); 240 tree_->delegate_->DidStartNavigation(this);
241 241
242 // We need |embedded_connection_id_| is order to validate requests to 242 // We need |embedded_connection_id_| is order to validate requests to
243 // create a child frame (OnCreatedFrame()). Pause incoming methods until 243 // create a child frame (OnCreatedFrame()). Pause incoming methods until
244 // we get the id to prevent race conditions. 244 // we get the id to prevent race conditions.
245 if (embedded_connection_id_ == kInvalidConnectionId) 245 if (embedded_connection_id_ == kInvalidConnectionId)
246 frame_binding_->PauseIncomingMethodCallProcessing(); 246 frame_binding_->PauseIncomingMethodCallProcessing();
247 } 247 }
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 556
557 Frame* child_frame = tree_->CreateChildFrame( 557 Frame* child_frame = tree_->CreateChildFrame(
558 this, std::move(frame_request), std::move(client), frame_id, app_id_, 558 this, std::move(frame_request), std::move(client), frame_id, app_id_,
559 client_properties.To<ClientPropertyMap>()); 559 client_properties.To<ClientPropertyMap>());
560 child_frame->embedded_connection_id_ = embedded_connection_id_; 560 child_frame->embedded_connection_id_ = embedded_connection_id_;
561 } 561 }
562 562
563 void Frame::RequestNavigate(mojom::NavigationTargetType target_type, 563 void Frame::RequestNavigate(mojom::NavigationTargetType target_type,
564 uint32_t target_frame_id, 564 uint32_t target_frame_id,
565 mojo::URLRequestPtr request) { 565 mojo::URLRequestPtr request) {
566 if (target_type == mojom::NAVIGATION_TARGET_TYPE_EXISTING_FRAME) { 566 if (target_type == mojom::NavigationTargetType::EXISTING_FRAME) {
567 // |target_frame| is allowed to come from another connection. 567 // |target_frame| is allowed to come from another connection.
568 Frame* target_frame = tree_->root()->FindFrame(target_frame_id); 568 Frame* target_frame = tree_->root()->FindFrame(target_frame_id);
569 if (!target_frame) { 569 if (!target_frame) {
570 DVLOG(1) << "RequestNavigate EXISTING_FRAME with no matching frame"; 570 DVLOG(1) << "RequestNavigate EXISTING_FRAME with no matching frame";
571 return; 571 return;
572 } 572 }
573 if (target_frame != tree_->root()) { 573 if (target_frame != tree_->root()) {
574 target_frame->StartNavigate(std::move(request)); 574 target_frame->StartNavigate(std::move(request));
575 return; 575 return;
576 } 576 }
(...skipping 23 matching lines...) Expand all
600 final_update); 600 final_update);
601 } 601 }
602 602
603 void Frame::OnFindInPageSelectionUpdated(int32_t request_id, 603 void Frame::OnFindInPageSelectionUpdated(int32_t request_id,
604 int32_t active_match_ordinal) { 604 int32_t active_match_ordinal) {
605 tree_->delegate_->OnFindInPageSelectionUpdated(request_id, this, 605 tree_->delegate_->OnFindInPageSelectionUpdated(request_id, this,
606 active_match_ordinal); 606 active_match_ordinal);
607 } 607 }
608 608
609 } // namespace web_view 609 } // namespace web_view
OLDNEW
« no previous file with comments | « components/pdf_viewer/pdf_viewer.cc ('k') | components/web_view/frame_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698