| 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" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 154 } |
| 155 | 155 |
| 156 double Frame::GatherProgress(int* frame_count) const { | 156 double Frame::GatherProgress(int* frame_count) const { |
| 157 ++(*frame_count); | 157 ++(*frame_count); |
| 158 double progress = progress_; | 158 double progress = progress_; |
| 159 for (const Frame* child : children_) | 159 for (const Frame* child : children_) |
| 160 progress += child->GatherProgress(frame_count); | 160 progress += child->GatherProgress(frame_count); |
| 161 return progress_; | 161 return progress_; |
| 162 } | 162 } |
| 163 | 163 |
| 164 void Frame::Find(int32 request_id, const mojo::String& search_text) { |
| 165 frame_client_->OnFind(request_id, search_text); |
| 166 } |
| 167 |
| 168 void Frame::StopFinding() { |
| 169 frame_client_->OnStopFinding(); |
| 170 } |
| 171 |
| 164 void Frame::InitClient(ClientType client_type, | 172 void Frame::InitClient(ClientType client_type, |
| 165 scoped_ptr<FrameUserDataAndBinding> data_and_binding, | 173 scoped_ptr<FrameUserDataAndBinding> data_and_binding, |
| 166 mojo::ViewTreeClientPtr view_tree_client, | 174 mojo::ViewTreeClientPtr view_tree_client, |
| 167 mojo::InterfaceRequest<mojom::Frame> frame_request) { | 175 mojo::InterfaceRequest<mojom::Frame> frame_request) { |
| 168 if (client_type == ClientType::EXISTING_FRAME_NEW_APP && | 176 if (client_type == ClientType::EXISTING_FRAME_NEW_APP && |
| 169 view_tree_client.get()) { | 177 view_tree_client.get()) { |
| 170 embedded_connection_id_ = kInvalidConnectionId; | 178 embedded_connection_id_ = kInvalidConnectionId; |
| 171 embed_weak_ptr_factory_.InvalidateWeakPtrs(); | 179 embed_weak_ptr_factory_.InvalidateWeakPtrs(); |
| 172 view_->Embed( | 180 view_->Embed( |
| 173 view_tree_client.Pass(), mojo::ViewTree::ACCESS_POLICY_DEFAULT, | 181 view_tree_client.Pass(), mojo::ViewTree::ACCESS_POLICY_DEFAULT, |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 void Frame::DispatchLoadEventToParent() { | 544 void Frame::DispatchLoadEventToParent() { |
| 537 if (parent_ && !AreAppIdsEqual(app_id_, parent_->app_id_)) { | 545 if (parent_ && !AreAppIdsEqual(app_id_, parent_->app_id_)) { |
| 538 // Send notification to fire a load event in the parent, if the parent is in | 546 // Send notification to fire a load event in the parent, if the parent is in |
| 539 // a different app. If the parent is in the same app, we assume that the app | 547 // a different app. If the parent is in the same app, we assume that the app |
| 540 // itself handles firing load event directly and no notification is needed | 548 // itself handles firing load event directly and no notification is needed |
| 541 // from our side. | 549 // from our side. |
| 542 parent_->NotifyDispatchFrameLoadEvent(this); | 550 parent_->NotifyDispatchFrameLoadEvent(this); |
| 543 } | 551 } |
| 544 } | 552 } |
| 545 | 553 |
| 554 void Frame::ReportFindInPageMatchCount(int32_t request_id, |
| 555 int32_t count, |
| 556 bool final_update) { |
| 557 // TODO(erg): This works well enough for the single origin case. However, it |
| 558 // breaks when we have OOPIFs. Centralize the counting at the top of the |
| 559 // FrameTree. |
| 560 tree_->delegate_->ReportFindInPageMatchCount(request_id, count, final_update); |
| 561 } |
| 562 |
| 563 void Frame::ReportFindInPageSelection(int32_t request_id, |
| 564 int32_t active_match_ordinal) { |
| 565 tree_->delegate_->ReportFindInPageSelection(request_id, active_match_ordinal); |
| 566 } |
| 567 |
| 546 } // namespace web_view | 568 } // namespace web_view |
| OLD | NEW |