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

Unified Diff: components/web_view/web_view_impl.h

Issue 1371773003: mandoline: Add find in page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT to fix patch failure. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/web_view/web_view_impl.h
diff --git a/components/web_view/web_view_impl.h b/components/web_view/web_view_impl.h
index c7a49d4a2bea75e664dfc693cc850fcc328e3357..d1a096ba84a39a3f43df36603f1b8cbd4258458e 100644
--- a/components/web_view/web_view_impl.h
+++ b/components/web_view/web_view_impl.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_
#define COMPONENTS_WEB_VIEW_WEB_VIEW_IMPL_H_
+#include <deque>
#include <string>
#include "base/macros.h"
@@ -49,14 +50,27 @@ class WebViewImpl : public mojom::WebView,
private:
friend class PendingWebViewLoad;
+ struct MatchData {
+ int count;
+ bool final_update;
+ };
+
// See description above |pending_load_| for details.
void OnLoad(const GURL& pending_url);
+ std::deque<Frame*> GetAllFrames();
+
+ // Callback method invoked by Find().
+ void OnContinueFinding(int32_t request_id, const mojo::String& search_text,
+ bool found);
+
// Overridden from WebView:
void LoadRequest(mojo::URLRequestPtr request) override;
void GetViewTreeClient(
mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client)
override;
+ void Find(int32_t request_id, const mojo::String& search_text) override;
+ void StopFinding() override;
void GoBack() override;
void GoForward() override;
@@ -84,6 +98,14 @@ class WebViewImpl : public mojom::WebView,
const CanNavigateFrameCallback& callback) override;
void DidStartNavigation(Frame* frame) override;
void DidCommitProvisionalLoad(Frame* frame) override;
+ void DidDestroyFrame(Frame* frame) override;
+ void OnReportFindInFrameMatchCount(int32_t request_id,
+ Frame* frame,
+ int32_t count,
+ bool final_update) override;
+ void OnReportFindInPageSelection(int32_t request_id,
+ Frame* frame,
+ int32_t active_match_ordinal) override;
// Overridden from FrameDevToolsAgent::Delegate:
void HandlePageNavigateRequest(const GURL& url) override;
@@ -108,6 +130,16 @@ class WebViewImpl : public mojom::WebView,
NavigationController navigation_controller_;
+ // A list of Frames which we have not sent a Find() command to. Initialized
+ // in Find(), and read from OnContinueFinding().
+ std::deque<Frame*> pending_find_frames_;
sky 2015/10/02 16:03:40 Can the find related code be moved into it's own c
+
+ // Current find
+ int current_find_request_;
+
+ // The current callback data from various frames.
+ std::map<Frame*, MatchData> returned_find_data_;
+
DISALLOW_COPY_AND_ASSIGN(WebViewImpl);
};

Powered by Google App Engine
This is Rietveld 408576698