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

Side by Side Diff: components/web_view/find_controller.h

Issue 1371773003: mandoline: Add find in page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final documentation changes. Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « components/web_view/BUILD.gn ('k') | components/web_view/find_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_WEB_VIEW_FIND_CONTROLLER_H_
6 #define COMPONENTS_WEB_VIEW_FIND_CONTROLLER_H_
7
8 #include <deque>
9
10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h"
12 #include "components/web_view/public/interfaces/web_view.mojom.h"
13
14 namespace web_view {
15
16 class FindControllerDelegate;
17 class Frame;
18
19 // Contains all the find code used by WebViewImpl.
20 class FindController {
21 public:
22 FindController(FindControllerDelegate* delegate);
23 ~FindController();
24
25 // Starts a find session looking for |search_text|. This method will first
26 // scan through frames one by one to look for the first instance of
27 // |search_text|, and return the data through
28 // OnFindInPageSelectionUpdated(). If found, it will highlight all instances
29 // of the text and report the final total count through
30 // FindInPageMatchCountUpdated().
31 void Find(int32_t request_id, const mojo::String& search_text);
32
33 // Unhighlights all find instances on the page.
34 void StopFinding();
35
36 void OnFindInFrameCountUpdated(int32_t request_id,
37 Frame* frame,
38 int32_t count,
39 bool final_update);
40 void OnFindInPageSelectionUpdated(int32_t request_id,
41 Frame* frame,
42 int32_t active_match_ordinal);
43
44 void DidDestroyFrame(Frame* frame);
45
46 private:
47 struct MatchData {
48 int count;
49 bool final_update;
50 };
51
52 // Callback method invoked by Find().
53 void OnContinueFinding(int32_t request_id,
54 const mojo::String& search_text,
55 bool found);
56
57 // Our owner.
58 FindControllerDelegate* delegate_;
59
60 // A list of Frames which we have not sent a Find() command to. Initialized
61 // in Find(), and read from OnContinueFinding().
62 std::deque<Frame*> pending_find_frames_;
63
64 // Current find session number. We keep track of this to prevent recording
65 // stale callbacks.
66 int current_find_request_;
67
68 // The current callback data from various frames.
69 std::map<Frame*, MatchData> returned_find_data_;
70
71 base::WeakPtrFactory<FindController> weak_ptr_factory_;
72
73 DISALLOW_COPY_AND_ASSIGN(FindController);
74 };
75
76 } // namespace web_view
77
78 #endif // COMPONENTS_WEB_VIEW_FIND_CONTROLLER_H_
OLDNEW
« no previous file with comments | « components/web_view/BUILD.gn ('k') | components/web_view/find_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698