1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
content / browser / find_in_page_client.h [blame]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_FIND_IN_PAGE_CLIENT_H_
#define CONTENT_BROWSER_FIND_IN_PAGE_CLIENT_H_
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
namespace content {
class RenderFrameHostImpl;
class FindRequestManager;
// Per-frame client of FindInPage, owned by FindRequestManager.
// Keeps track of the current match count for the frame.
class CONTENT_EXPORT FindInPageClient : public blink::mojom::FindInPageClient {
public:
FindInPageClient(FindRequestManager* find_request_manager,
RenderFrameHostImpl* rfh);
FindInPageClient(const FindInPageClient&) = delete;
FindInPageClient& operator=(const FindInPageClient&) = delete;
~FindInPageClient() override;
#if BUILDFLAG(IS_ANDROID)
void ActivateNearestFindResult(int request_id, const gfx::PointF& point);
#endif
// Current number of matches for this frame.
int number_of_matches() { return number_of_matches_; }
// blink::mojom::FindInPageClient overrides
void SetNumberOfMatches(
int request_id,
unsigned int current_number_of_matches,
blink::mojom::FindMatchUpdateType update_type) override;
void SetActiveMatch(int request_id,
const gfx::Rect& active_match_rect,
int active_match_ordinal,
blink::mojom::FindMatchUpdateType update_type) override;
private:
void HandleUpdateType(int request_id,
blink::mojom::FindMatchUpdateType update_type);
const raw_ptr<RenderFrameHostImpl> frame_;
const raw_ptr<FindRequestManager> find_request_manager_;
mojo::Receiver<blink::mojom::FindInPageClient> receiver_{this};
int number_of_matches_ = 0;
};
} // namespace content
#endif // CONTENT_BROWSER_FIND_IN_PAGE_CLIENT_H_