Index: components/web_view/web_view_impl.cc |
diff --git a/components/web_view/web_view_impl.cc b/components/web_view/web_view_impl.cc |
index 8992496bbc2789309aa2883afe1d67c9f21a474b..545fbe665e99f7b195de6755e239414c96809bae 100644 |
--- a/components/web_view/web_view_impl.cc |
+++ b/components/web_view/web_view_impl.cc |
@@ -4,6 +4,9 @@ |
#include "components/web_view/web_view_impl.h" |
+#include <queue> |
+ |
+#include "base/bind.h" |
#include "base/command_line.h" |
#include "components/devtools_service/public/cpp/switches.h" |
#include "components/mus/public/cpp/scoped_view_ptr.h" |
@@ -44,7 +47,8 @@ WebViewImpl::WebViewImpl(mojo::ApplicationImpl* app, |
binding_(this, request.Pass()), |
root_(nullptr), |
content_(nullptr), |
- navigation_controller_(this) { |
+ navigation_controller_(this), |
+ find_controller_(this) { |
if (EnableRemoteDebugging()) |
devtools_agent_.reset(new FrameDevToolsAgent(app_, this)); |
OnDidNavigate(); |
@@ -110,6 +114,14 @@ void WebViewImpl::GetViewTreeClient( |
mus::ViewTreeConnection::Create(this, view_tree_client.Pass()); |
} |
+void WebViewImpl::Find(int32_t request_id, const mojo::String& search_text) { |
+ find_controller_.Find(request_id, search_text); |
+} |
+ |
+void WebViewImpl::StopFinding() { |
+ find_controller_.StopFinding(); |
+} |
+ |
void WebViewImpl::GoBack() { |
if (!navigation_controller_.CanGoBack()) |
return; |
@@ -203,6 +215,25 @@ void WebViewImpl::DidCommitProvisionalLoad(Frame* frame) { |
navigation_controller_.FrameDidCommitProvisionalLoad(frame); |
} |
+void WebViewImpl::DidDestroyFrame(Frame* frame) { |
+ find_controller_.DidDestroyFrame(frame); |
+} |
+ |
+void WebViewImpl::OnFindInFrameCountUpdated(int32_t request_id, |
+ Frame* frame, |
+ int32_t count, |
+ bool final_update) { |
+ find_controller_.OnFindInFrameCountUpdated(request_id, frame, count, |
+ final_update); |
+} |
+ |
+void WebViewImpl::OnFindInPageSelectionUpdated(int32_t request_id, |
+ Frame* frame, |
+ int32_t active_match_ordinal) { |
+ find_controller_.OnFindInPageSelectionUpdated(request_id, frame, |
+ active_match_ordinal); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// WebViewImpl, FrameDevToolsAgentDelegate implementation: |
@@ -229,4 +260,27 @@ void WebViewImpl::OnDidNavigate() { |
: ButtonState::BUTTON_STATE_DISABLED); |
} |
+//////////////////////////////////////////////////////////////////////////////// |
+// WebViewImpl, FindControllerDelegate implementation: |
+ |
+std::deque<Frame*> WebViewImpl::GetAllFrames() { |
+ std::deque<Frame*> all_frames; |
+ std::queue<Frame*> frames_to_search; |
+ frames_to_search.push(frame_tree_->root()); |
+ while (!frames_to_search.empty()) { |
+ // TODO(erg): This is not in depth first order. I'm not actually sure how |
+ // blink does traversal though. |
+ Frame* current = frames_to_search.front(); |
+ frames_to_search.pop(); |
+ for (Frame* child : current->children()) |
+ frames_to_search.push(child); |
+ all_frames.push_back(current); |
+ } |
+ return all_frames; |
+} |
+ |
+mojom::WebViewClient* WebViewImpl::GetWebViewClient() { |
+ return client_.get(); |
+} |
+ |
} // namespace web_view |