| 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 #include "components/web_view/frame.h" | 5 #include "components/web_view/frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "components/mus/public/cpp/window.h" | 13 #include "components/mus/public/cpp/window.h" |
| 14 #include "components/mus/public/cpp/window_property.h" | 14 #include "components/mus/public/cpp/window_property.h" |
| 15 #include "components/web_view/frame_tree.h" | 15 #include "components/web_view/frame_tree.h" |
| 16 #include "components/web_view/frame_tree_delegate.h" | 16 #include "components/web_view/frame_tree_delegate.h" |
| 17 #include "components/web_view/frame_user_data.h" | 17 #include "components/web_view/frame_user_data.h" |
| 18 #include "components/web_view/frame_utils.h" | 18 #include "components/web_view/frame_utils.h" |
| 19 #include "mojo/application/public/interfaces/shell.mojom.h" | 19 #include "mojo/application/public/interfaces/shell.mojom.h" |
| 20 #include "mojo/common/url_type_converters.h" | 20 #include "mojo/common/url_type_converters.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 using mus::Window; | 23 using mus::Window; |
| 24 | 24 |
| 25 DECLARE_WINDOW_PROPERTY_TYPE(web_view::Frame*); | 25 DECLARE_WINDOW_PROPERTY_TYPE(web_view::Frame*); |
| 26 | 26 |
| 27 namespace web_view { | 27 namespace web_view { |
| 28 | 28 |
| 29 // Used to find the Frame associated with a View. | 29 // Used to find the Frame associated with a Window. |
| 30 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Frame*, kFrame, nullptr); | 30 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Frame*, kFrame, nullptr); |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 const uint32_t kNoParentId = 0u; | 34 const uint32_t kNoParentId = 0u; |
| 35 const mus::ConnectionSpecificId kInvalidConnectionId = 0u; | 35 const mus::ConnectionSpecificId kInvalidConnectionId = 0u; |
| 36 | 36 |
| 37 mojom::FrameDataPtr FrameToFrameData(const Frame* frame) { | 37 mojom::FrameDataPtr FrameToFrameData(const Frame* frame) { |
| 38 mojom::FrameDataPtr frame_data(mojom::FrameData::New()); | 38 mojom::FrameDataPtr frame_data(mojom::FrameData::New()); |
| 39 frame_data->frame_id = frame->id(); | 39 frame_data->frame_id = frame->id(); |
| 40 frame_data->parent_id = frame->parent() ? frame->parent()->id() : kNoParentId; | 40 frame_data->parent_id = frame->parent() ? frame->parent()->id() : kNoParentId; |
| 41 frame_data->client_properties = | 41 frame_data->client_properties = |
| 42 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From( | 42 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From( |
| 43 frame->client_properties()); | 43 frame->client_properties()); |
| 44 return frame_data.Pass(); | 44 return frame_data.Pass(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 struct Frame::FrameUserDataAndBinding { | 49 struct Frame::FrameUserDataAndBinding { |
| 50 scoped_ptr<FrameUserData> user_data; | 50 scoped_ptr<FrameUserData> user_data; |
| 51 scoped_ptr<mojo::Binding<mojom::Frame>> frame_binding; | 51 scoped_ptr<mojo::Binding<mojom::Frame>> frame_binding; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 Frame::Frame(FrameTree* tree, | 54 Frame::Frame(FrameTree* tree, |
| 55 Window* view, | 55 Window* window, |
| 56 uint32_t frame_id, | 56 uint32_t frame_id, |
| 57 uint32_t app_id, | 57 uint32_t app_id, |
| 58 ViewOwnership view_ownership, | 58 WindowOwnership window_ownership, |
| 59 mojom::FrameClient* frame_client, | 59 mojom::FrameClient* frame_client, |
| 60 scoped_ptr<FrameUserData> user_data, | 60 scoped_ptr<FrameUserData> user_data, |
| 61 const ClientPropertyMap& client_properties) | 61 const ClientPropertyMap& client_properties) |
| 62 : tree_(tree), | 62 : tree_(tree), |
| 63 view_(nullptr), | 63 window_(nullptr), |
| 64 embedded_connection_id_(kInvalidConnectionId), | 64 embedded_connection_id_(kInvalidConnectionId), |
| 65 id_(frame_id), | 65 id_(frame_id), |
| 66 app_id_(app_id), | 66 app_id_(app_id), |
| 67 parent_(nullptr), | 67 parent_(nullptr), |
| 68 view_ownership_(view_ownership), | 68 window_ownership_(window_ownership), |
| 69 user_data_(user_data.Pass()), | 69 user_data_(user_data.Pass()), |
| 70 frame_client_(frame_client), | 70 frame_client_(frame_client), |
| 71 loading_(false), | 71 loading_(false), |
| 72 progress_(0.f), | 72 progress_(0.f), |
| 73 client_properties_(client_properties), | 73 client_properties_(client_properties), |
| 74 waiting_for_on_will_navigate_ack_(false), | 74 waiting_for_on_will_navigate_ack_(false), |
| 75 embed_weak_ptr_factory_(this), | 75 embed_weak_ptr_factory_(this), |
| 76 navigate_weak_ptr_factory_(this) { | 76 navigate_weak_ptr_factory_(this) { |
| 77 if (view) | 77 if (window) |
| 78 SetView(view); | 78 SetWindow(window); |
| 79 } | 79 } |
| 80 | 80 |
| 81 Frame::~Frame() { | 81 Frame::~Frame() { |
| 82 DVLOG(2) << "~Frame id=" << id_ << " this=" << this; | 82 DVLOG(2) << "~Frame id=" << id_ << " this=" << this; |
| 83 if (view_) | 83 if (window_) |
| 84 view_->RemoveObserver(this); | 84 window_->RemoveObserver(this); |
| 85 while (!children_.empty()) | 85 while (!children_.empty()) |
| 86 delete children_[0]; | 86 delete children_[0]; |
| 87 if (parent_) | 87 if (parent_) |
| 88 parent_->Remove(this); | 88 parent_->Remove(this); |
| 89 if (view_) { | 89 if (window_) { |
| 90 view_->ClearLocalProperty(kFrame); | 90 window_->ClearLocalProperty(kFrame); |
| 91 if (view_ownership_ == ViewOwnership::OWNS_VIEW) | 91 if (window_ownership_ == WindowOwnership::OWNS_WINDOW) |
| 92 view_->Destroy(); | 92 window_->Destroy(); |
| 93 } | 93 } |
| 94 tree_->delegate_->DidDestroyFrame(this); | 94 tree_->delegate_->DidDestroyFrame(this); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void Frame::Init(Frame* parent, | 97 void Frame::Init(Frame* parent, |
| 98 mus::mojom::WindowTreeClientPtr window_tree_client, | 98 mus::mojom::WindowTreeClientPtr window_tree_client, |
| 99 mojo::InterfaceRequest<mojom::Frame> frame_request, | 99 mojo::InterfaceRequest<mojom::Frame> frame_request, |
| 100 base::TimeTicks navigation_start_time) { | 100 base::TimeTicks navigation_start_time) { |
| 101 { | 101 { |
| 102 // Set the FrameClient to null so that we don't notify the client of the | 102 // Set the FrameClient to null so that we don't notify the client of the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 113 InitClient(client_type, nullptr, window_tree_client.Pass(), | 113 InitClient(client_type, nullptr, window_tree_client.Pass(), |
| 114 frame_request.Pass(), navigation_start_time); | 114 frame_request.Pass(), navigation_start_time); |
| 115 | 115 |
| 116 tree_->delegate_->DidCreateFrame(this); | 116 tree_->delegate_->DidCreateFrame(this); |
| 117 | 117 |
| 118 DVLOG(2) << "Frame id=" << id_ << " parent=" << (parent_ ? parent_->id_ : 0) | 118 DVLOG(2) << "Frame id=" << id_ << " parent=" << (parent_ ? parent_->id_ : 0) |
| 119 << " app_id=" << app_id_ << " this=" << this; | 119 << " app_id=" << app_id_ << " this=" << this; |
| 120 } | 120 } |
| 121 | 121 |
| 122 // static | 122 // static |
| 123 Frame* Frame::FindFirstFrameAncestor(Window* view) { | 123 Frame* Frame::FindFirstFrameAncestor(Window* window) { |
| 124 while (view && !view->GetLocalProperty(kFrame)) | 124 while (window && !window->GetLocalProperty(kFrame)) |
| 125 view = view->parent(); | 125 window = window->parent(); |
| 126 return view ? view->GetLocalProperty(kFrame) : nullptr; | 126 return window ? window->GetLocalProperty(kFrame) : nullptr; |
| 127 } | 127 } |
| 128 | 128 |
| 129 const Frame* Frame::FindFrame(uint32_t id) const { | 129 const Frame* Frame::FindFrame(uint32_t id) const { |
| 130 if (id == id_) | 130 if (id == id_) |
| 131 return this; | 131 return this; |
| 132 | 132 |
| 133 for (const Frame* child : children_) { | 133 for (const Frame* child : children_) { |
| 134 const Frame* match = child->FindFrame(id); | 134 const Frame* match = child->FindFrame(id); |
| 135 if (match) | 135 if (match) |
| 136 return match; | 136 return match; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 void Frame::InitClient(ClientType client_type, | 191 void Frame::InitClient(ClientType client_type, |
| 192 scoped_ptr<FrameUserDataAndBinding> data_and_binding, | 192 scoped_ptr<FrameUserDataAndBinding> data_and_binding, |
| 193 mus::mojom::WindowTreeClientPtr window_tree_client, | 193 mus::mojom::WindowTreeClientPtr window_tree_client, |
| 194 mojo::InterfaceRequest<mojom::Frame> frame_request, | 194 mojo::InterfaceRequest<mojom::Frame> frame_request, |
| 195 base::TimeTicks navigation_start_time) { | 195 base::TimeTicks navigation_start_time) { |
| 196 if (client_type == ClientType::EXISTING_FRAME_NEW_APP && | 196 if (client_type == ClientType::EXISTING_FRAME_NEW_APP && |
| 197 window_tree_client.get()) { | 197 window_tree_client.get()) { |
| 198 embedded_connection_id_ = kInvalidConnectionId; | 198 embedded_connection_id_ = kInvalidConnectionId; |
| 199 embed_weak_ptr_factory_.InvalidateWeakPtrs(); | 199 embed_weak_ptr_factory_.InvalidateWeakPtrs(); |
| 200 view_->Embed( | 200 window_->Embed( |
| 201 window_tree_client.Pass(), | 201 window_tree_client.Pass(), |
| 202 mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT, | 202 mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT, |
| 203 base::Bind(&Frame::OnEmbedAck, embed_weak_ptr_factory_.GetWeakPtr())); | 203 base::Bind(&Frame::OnEmbedAck, embed_weak_ptr_factory_.GetWeakPtr())); |
| 204 } | 204 } |
| 205 | 205 |
| 206 if (client_type == ClientType::NEW_CHILD_FRAME) { | 206 if (client_type == ClientType::NEW_CHILD_FRAME) { |
| 207 // Don't install an error handler. We allow for the target to only | 207 // Don't install an error handler. We allow for the target to only |
| 208 // implement WindowTreeClient. | 208 // implement WindowTreeClient. |
| 209 // This frame (and client) was created by an existing FrameClient. There | 209 // This frame (and client) was created by an existing FrameClient. There |
| 210 // is no need to send it OnConnect(). | 210 // is no need to send it OnConnect(). |
| 211 frame_binding_.reset( | 211 frame_binding_.reset( |
| 212 new mojo::Binding<mojom::Frame>(this, frame_request.Pass())); | 212 new mojo::Binding<mojom::Frame>(this, frame_request.Pass())); |
| 213 frame_client_->OnConnect( | 213 frame_client_->OnConnect( |
| 214 nullptr, tree_->change_id(), id_, mojom::VIEW_CONNECT_TYPE_USE_NEW, | 214 nullptr, tree_->change_id(), id_, mojom::WINDOW_CONNECT_TYPE_USE_NEW, |
| 215 mojo::Array<mojom::FrameDataPtr>(), | 215 mojo::Array<mojom::FrameDataPtr>(), |
| 216 navigation_start_time.ToInternalValue(), | 216 navigation_start_time.ToInternalValue(), |
| 217 base::Bind(&OnConnectAck, base::Passed(&data_and_binding))); | 217 base::Bind(&OnConnectAck, base::Passed(&data_and_binding))); |
| 218 } else { | 218 } else { |
| 219 std::vector<const Frame*> frames; | 219 std::vector<const Frame*> frames; |
| 220 tree_->root()->BuildFrameTree(&frames); | 220 tree_->root()->BuildFrameTree(&frames); |
| 221 | 221 |
| 222 mojo::Array<mojom::FrameDataPtr> array(frames.size()); | 222 mojo::Array<mojom::FrameDataPtr> array(frames.size()); |
| 223 for (size_t i = 0; i < frames.size(); ++i) | 223 for (size_t i = 0; i < frames.size(); ++i) |
| 224 array[i] = FrameToFrameData(frames[i]).Pass(); | 224 array[i] = FrameToFrameData(frames[i]).Pass(); |
| 225 | 225 |
| 226 mojom::FramePtr frame_ptr; | 226 mojom::FramePtr frame_ptr; |
| 227 // Don't install an error handler. We allow for the target to only | 227 // Don't install an error handler. We allow for the target to only |
| 228 // implement WindowTreeClient. | 228 // implement WindowTreeClient. |
| 229 frame_binding_.reset( | 229 frame_binding_.reset( |
| 230 new mojo::Binding<mojom::Frame>(this, GetProxy(&frame_ptr).Pass())); | 230 new mojo::Binding<mojom::Frame>(this, GetProxy(&frame_ptr).Pass())); |
| 231 frame_client_->OnConnect( | 231 frame_client_->OnConnect( |
| 232 frame_ptr.Pass(), tree_->change_id(), id_, | 232 frame_ptr.Pass(), tree_->change_id(), id_, |
| 233 client_type == ClientType::EXISTING_FRAME_SAME_APP | 233 client_type == ClientType::EXISTING_FRAME_SAME_APP |
| 234 ? mojom::VIEW_CONNECT_TYPE_USE_EXISTING | 234 ? mojom::WINDOW_CONNECT_TYPE_USE_EXISTING |
| 235 : mojom::VIEW_CONNECT_TYPE_USE_NEW, | 235 : mojom::WINDOW_CONNECT_TYPE_USE_NEW, |
| 236 array.Pass(), navigation_start_time.ToInternalValue(), | 236 array.Pass(), navigation_start_time.ToInternalValue(), |
| 237 base::Bind(&OnConnectAck, base::Passed(&data_and_binding))); | 237 base::Bind(&OnConnectAck, base::Passed(&data_and_binding))); |
| 238 tree_->delegate_->DidStartNavigation(this); | 238 tree_->delegate_->DidStartNavigation(this); |
| 239 | 239 |
| 240 // We need |embedded_connection_id_| is order to validate requests to | 240 // We need |embedded_connection_id_| is order to validate requests to |
| 241 // create a child frame (OnCreatedFrame()). Pause incoming methods until | 241 // create a child frame (OnCreatedFrame()). Pause incoming methods until |
| 242 // we get the id to prevent race conditions. | 242 // we get the id to prevent race conditions. |
| 243 if (embedded_connection_id_ == kInvalidConnectionId) | 243 if (embedded_connection_id_ == kInvalidConnectionId) |
| 244 frame_binding_->PauseIncomingMethodCallProcessing(); | 244 frame_binding_->PauseIncomingMethodCallProcessing(); |
| 245 } | 245 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 base::TimeTicks navigation_start_time) { | 296 base::TimeTicks navigation_start_time) { |
| 297 DCHECK(waiting_for_on_will_navigate_ack_); | 297 DCHECK(waiting_for_on_will_navigate_ack_); |
| 298 DVLOG(2) << "Frame::OnWillNavigateAck id=" << id_; | 298 DVLOG(2) << "Frame::OnWillNavigateAck id=" << id_; |
| 299 waiting_for_on_will_navigate_ack_ = false; | 299 waiting_for_on_will_navigate_ack_ = false; |
| 300 ChangeClient(frame_client, user_data.Pass(), window_tree_client.Pass(), | 300 ChangeClient(frame_client, user_data.Pass(), window_tree_client.Pass(), |
| 301 app_id, navigation_start_time); | 301 app_id, navigation_start_time); |
| 302 if (pending_navigate_.get()) | 302 if (pending_navigate_.get()) |
| 303 StartNavigate(pending_navigate_.Pass()); | 303 StartNavigate(pending_navigate_.Pass()); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void Frame::SetView(mus::Window* view) { | 306 void Frame::SetWindow(mus::Window* window) { |
| 307 DCHECK(!view_); | 307 DCHECK(!window_); |
| 308 DCHECK_EQ(id_, view->id()); | 308 DCHECK_EQ(id_, window->id()); |
| 309 view_ = view; | 309 window_ = window; |
| 310 view_->SetLocalProperty(kFrame, this); | 310 window_->SetLocalProperty(kFrame, this); |
| 311 view_->AddObserver(this); | 311 window_->AddObserver(this); |
| 312 if (pending_navigate_.get()) | 312 if (pending_navigate_.get()) |
| 313 StartNavigate(pending_navigate_.Pass()); | 313 StartNavigate(pending_navigate_.Pass()); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void Frame::BuildFrameTree(std::vector<const Frame*>* frames) const { | 316 void Frame::BuildFrameTree(std::vector<const Frame*>* frames) const { |
| 317 frames->push_back(this); | 317 frames->push_back(this); |
| 318 for (const Frame* frame : children_) | 318 for (const Frame* frame : children_) |
| 319 frame->BuildFrameTree(frames); | 319 frame->BuildFrameTree(frames); |
| 320 } | 320 } |
| 321 | 321 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 341 void Frame::StartNavigate(mojo::URLRequestPtr request) { | 341 void Frame::StartNavigate(mojo::URLRequestPtr request) { |
| 342 if (waiting_for_on_will_navigate_ack_) { | 342 if (waiting_for_on_will_navigate_ack_) { |
| 343 // We're waiting for OnWillNavigate(). We need to wait until that completes | 343 // We're waiting for OnWillNavigate(). We need to wait until that completes |
| 344 // before attempting any other loads. | 344 // before attempting any other loads. |
| 345 pending_navigate_ = request.Pass(); | 345 pending_navigate_ = request.Pass(); |
| 346 return; | 346 return; |
| 347 } | 347 } |
| 348 | 348 |
| 349 pending_navigate_.reset(); | 349 pending_navigate_.reset(); |
| 350 | 350 |
| 351 // We need a View to navigate. When we get the View we'll complete the | 351 // We need a Window to navigate. When we get the Window we'll complete the |
| 352 // navigation. | 352 // navigation. |
| 353 if (!view_) { | 353 if (!window_) { |
| 354 pending_navigate_ = request.Pass(); | 354 pending_navigate_ = request.Pass(); |
| 355 return; | 355 return; |
| 356 } | 356 } |
| 357 | 357 |
| 358 // Drop any pending navigation requests. | 358 // Drop any pending navigation requests. |
| 359 navigate_weak_ptr_factory_.InvalidateWeakPtrs(); | 359 navigate_weak_ptr_factory_.InvalidateWeakPtrs(); |
| 360 | 360 |
| 361 DVLOG(2) << "Frame::StartNavigate id=" << id_ << " url=" << request->url; | 361 DVLOG(2) << "Frame::StartNavigate id=" << id_ << " url=" << request->url; |
| 362 | 362 |
| 363 const GURL requested_url(request->url); | 363 const GURL requested_url(request->url); |
| 364 base::TimeTicks navigation_start_time = | 364 base::TimeTicks navigation_start_time = |
| 365 base::TimeTicks::FromInternalValue(request->originating_time_ticks); | 365 base::TimeTicks::FromInternalValue(request->originating_time_ticks); |
| 366 tree_->delegate_->CanNavigateFrame( | 366 tree_->delegate_->CanNavigateFrame( |
| 367 this, request.Pass(), base::Bind(&Frame::OnCanNavigateFrame, | 367 this, request.Pass(), base::Bind(&Frame::OnCanNavigateFrame, |
| 368 navigate_weak_ptr_factory_.GetWeakPtr(), | 368 navigate_weak_ptr_factory_.GetWeakPtr(), |
| 369 requested_url, navigation_start_time)); | 369 requested_url, navigation_start_time)); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void Frame::OnCanNavigateFrame( | 372 void Frame::OnCanNavigateFrame( |
| 373 const GURL& url, | 373 const GURL& url, |
| 374 base::TimeTicks navigation_start_time, | 374 base::TimeTicks navigation_start_time, |
| 375 uint32_t app_id, | 375 uint32_t app_id, |
| 376 mojom::FrameClient* frame_client, | 376 mojom::FrameClient* frame_client, |
| 377 scoped_ptr<FrameUserData> user_data, | 377 scoped_ptr<FrameUserData> user_data, |
| 378 mus::mojom::WindowTreeClientPtr window_tree_client) { | 378 mus::mojom::WindowTreeClientPtr window_tree_client) { |
| 379 DVLOG(2) << "Frame::OnCanNavigateFrame id=" << id_ | 379 DVLOG(2) << "Frame::OnCanNavigateFrame id=" << id_ |
| 380 << " equal=" << (AreAppIdsEqual(app_id, app_id_) ? "true" : "false"); | 380 << " equal=" << (AreAppIdsEqual(app_id, app_id_) ? "true" : "false"); |
| 381 if (AreAppIdsEqual(app_id, app_id_)) { | 381 if (AreAppIdsEqual(app_id, app_id_)) { |
| 382 // The app currently rendering the frame will continue rendering it. In this | 382 // The app currently rendering the frame will continue rendering it. In this |
| 383 // case we do not use the WindowTreeClient (because the app has a View | 383 // case we do not use the WindowTreeClient (because the app has a Window |
| 384 // already | 384 // already |
| 385 // and ends up reusing it). | 385 // and ends up reusing it). |
| 386 DCHECK(!window_tree_client.get()); | 386 DCHECK(!window_tree_client.get()); |
| 387 ChangeClient(frame_client, user_data.Pass(), window_tree_client.Pass(), | 387 ChangeClient(frame_client, user_data.Pass(), window_tree_client.Pass(), |
| 388 app_id, navigation_start_time); | 388 app_id, navigation_start_time); |
| 389 } else { | 389 } else { |
| 390 waiting_for_on_will_navigate_ack_ = true; | 390 waiting_for_on_will_navigate_ack_ = true; |
| 391 DCHECK(window_tree_client.get()); | 391 DCHECK(window_tree_client.get()); |
| 392 // TODO(sky): url isn't correct here, it should be a security origin. | 392 // TODO(sky): url isn't correct here, it should be a security origin. |
| 393 frame_client_->OnWillNavigate( | 393 frame_client_->OnWillNavigate( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 frame_client_->OnFrameLoadingStateChanged(frame->id(), loading); | 434 frame_client_->OnFrameLoadingStateChanged(frame->id(), loading); |
| 435 } | 435 } |
| 436 | 436 |
| 437 void Frame::NotifyDispatchFrameLoadEvent(const Frame* frame) { | 437 void Frame::NotifyDispatchFrameLoadEvent(const Frame* frame) { |
| 438 frame_client_->OnDispatchFrameLoadEvent(frame->id()); | 438 frame_client_->OnDispatchFrameLoadEvent(frame->id()); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void Frame::OnTreeChanged(const TreeChangeParams& params) { | 441 void Frame::OnTreeChanged(const TreeChangeParams& params) { |
| 442 if (params.new_parent && this == tree_->root()) { | 442 if (params.new_parent && this == tree_->root()) { |
| 443 Frame* child_frame = FindFrame(params.target->id()); | 443 Frame* child_frame = FindFrame(params.target->id()); |
| 444 if (child_frame && !child_frame->view_) | 444 if (child_frame && !child_frame->window_) |
| 445 child_frame->SetView(params.target); | 445 child_frame->SetWindow(params.target); |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 | 448 |
| 449 void Frame::OnWindowDestroying(mus::Window* view) { | 449 void Frame::OnWindowDestroying(mus::Window* window) { |
| 450 if (parent_) | 450 if (parent_) |
| 451 parent_->Remove(this); | 451 parent_->Remove(this); |
| 452 | 452 |
| 453 // Reset |view_ownership_| so we don't attempt to delete |view_| in the | 453 // Reset |window_ownership_| so we don't attempt to delete |window_| in the |
| 454 // destructor. | 454 // destructor. |
| 455 view_ownership_ = ViewOwnership::DOESNT_OWN_VIEW; | 455 window_ownership_ = WindowOwnership::DOESNT_OWN_WINDOW; |
| 456 | 456 |
| 457 if (tree_->root() == this) { | 457 if (tree_->root() == this) { |
| 458 view_->RemoveObserver(this); | 458 window_->RemoveObserver(this); |
| 459 view_ = nullptr; | 459 window_ = nullptr; |
| 460 return; | 460 return; |
| 461 } | 461 } |
| 462 | 462 |
| 463 delete this; | 463 delete this; |
| 464 } | 464 } |
| 465 | 465 |
| 466 void Frame::OnWindowEmbeddedAppDisconnected(mus::Window* view) { | 466 void Frame::OnWindowEmbeddedAppDisconnected(mus::Window* window) { |
| 467 // See FrameTreeDelegate::OnWindowEmbeddedAppDisconnected() for details of | 467 // See FrameTreeDelegate::OnWindowEmbeddedAppDisconnected() for details of |
| 468 // when | 468 // when |
| 469 // this happens. | 469 // this happens. |
| 470 // | 470 // |
| 471 // Currently we have no way to distinguish between the cases that lead to this | 471 // Currently we have no way to distinguish between the cases that lead to this |
| 472 // being called, so we assume we can continue on. Continuing on is important | 472 // being called, so we assume we can continue on. Continuing on is important |
| 473 // for html as it's entirely possible for a page to create a frame, navigate | 473 // for html as it's entirely possible for a page to create a frame, navigate |
| 474 // to a bogus url and expect the frame to still exist. | 474 // to a bogus url and expect the frame to still exist. |
| 475 tree_->delegate_->OnWindowEmbeddedInFrameDisconnected(this); | 475 tree_->delegate_->OnWindowEmbeddedInFrameDisconnected(this); |
| 476 } | 476 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 final_update); | 593 final_update); |
| 594 } | 594 } |
| 595 | 595 |
| 596 void Frame::OnFindInPageSelectionUpdated(int32_t request_id, | 596 void Frame::OnFindInPageSelectionUpdated(int32_t request_id, |
| 597 int32_t active_match_ordinal) { | 597 int32_t active_match_ordinal) { |
| 598 tree_->delegate_->OnFindInPageSelectionUpdated(request_id, this, | 598 tree_->delegate_->OnFindInPageSelectionUpdated(request_id, this, |
| 599 active_match_ordinal); | 599 active_match_ordinal); |
| 600 } | 600 } |
| 601 | 601 |
| 602 } // namespace web_view | 602 } // namespace web_view |
| OLD | NEW |