| 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, |
| 165 const mojo::String& search_text, |
| 166 const FindCallback& callback) { |
| 167 frame_client_->Find(request_id, search_text, callback); |
| 168 } |
| 169 |
| 170 void Frame::StopFinding(bool clear_selection) { |
| 171 frame_client_->StopFinding(clear_selection); |
| 172 } |
| 173 |
| 174 void Frame::HighlightFindResults(int32_t request_id, |
| 175 const mojo::String& search_text, |
| 176 bool reset) { |
| 177 frame_client_->HighlightFindResults(request_id, search_text, reset); |
| 178 } |
| 179 |
| 180 void Frame::StopHighlightingFindResults() { |
| 181 frame_client_->StopHighlightingFindResults(); |
| 182 } |
| 183 |
| 164 void Frame::InitClient(ClientType client_type, | 184 void Frame::InitClient(ClientType client_type, |
| 165 scoped_ptr<FrameUserDataAndBinding> data_and_binding, | 185 scoped_ptr<FrameUserDataAndBinding> data_and_binding, |
| 166 mojo::ViewTreeClientPtr view_tree_client, | 186 mojo::ViewTreeClientPtr view_tree_client, |
| 167 mojo::InterfaceRequest<mojom::Frame> frame_request) { | 187 mojo::InterfaceRequest<mojom::Frame> frame_request) { |
| 168 if (client_type == ClientType::EXISTING_FRAME_NEW_APP && | 188 if (client_type == ClientType::EXISTING_FRAME_NEW_APP && |
| 169 view_tree_client.get()) { | 189 view_tree_client.get()) { |
| 170 embedded_connection_id_ = kInvalidConnectionId; | 190 embedded_connection_id_ = kInvalidConnectionId; |
| 171 embed_weak_ptr_factory_.InvalidateWeakPtrs(); | 191 embed_weak_ptr_factory_.InvalidateWeakPtrs(); |
| 172 view_->Embed( | 192 view_->Embed( |
| 173 view_tree_client.Pass(), mojo::ViewTree::ACCESS_POLICY_DEFAULT, | 193 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() { | 556 void Frame::DispatchLoadEventToParent() { |
| 537 if (parent_ && !AreAppIdsEqual(app_id_, parent_->app_id_)) { | 557 if (parent_ && !AreAppIdsEqual(app_id_, parent_->app_id_)) { |
| 538 // Send notification to fire a load event in the parent, if the parent is in | 558 // 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 | 559 // 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 | 560 // itself handles firing load event directly and no notification is needed |
| 541 // from our side. | 561 // from our side. |
| 542 parent_->NotifyDispatchFrameLoadEvent(this); | 562 parent_->NotifyDispatchFrameLoadEvent(this); |
| 543 } | 563 } |
| 544 } | 564 } |
| 545 | 565 |
| 566 void Frame::OnFindInFrameCountUpdated(int32_t request_id, |
| 567 int32_t count, |
| 568 bool final_update) { |
| 569 tree_->delegate_->OnFindInFrameCountUpdated(request_id, this, count, |
| 570 final_update); |
| 571 } |
| 572 |
| 573 void Frame::OnFindInPageSelectionUpdated(int32_t request_id, |
| 574 int32_t active_match_ordinal) { |
| 575 tree_->delegate_->OnFindInPageSelectionUpdated(request_id, this, |
| 576 active_match_ordinal); |
| 577 } |
| 578 |
| 546 } // namespace web_view | 579 } // namespace web_view |
| OLD | NEW |