blob: e2ce697ea4cac598214f81f223ca1d8ff998004f [file] [log] [blame]
[email protected]b25b3ee2012-01-13 05:19:541// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]d4cff272011-05-02 15:46:012// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]86a7d3c2011-09-12 16:45:325#ifndef CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_
6#define CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_
[email protected]d4cff272011-05-02 15:46:017
avi1023d012015-12-25 02:39:148#include "base/macros.h"
[email protected]d4cff272011-05-02 15:46:019#include "build/build_config.h"
[email protected]3a034ebb2011-10-03 19:19:4410#include "content/public/renderer/render_view_observer.h"
brettw4b461082016-11-19 18:55:1611#include "ppapi/features/features.h"
tfarina655f81d2014-12-23 02:38:5012#include "ui/gfx/geometry/point.h"
[email protected]db4fc1e2013-09-06 20:01:5113#include "ui/gfx/range/range.h"
[email protected]d4cff272011-05-02 15:46:0114
[email protected]180ef242013-11-07 06:50:4615namespace blink {
ekaramad330ba4232016-09-23 17:57:4716class WebFrameWidget;
17class WebLocalFrame;
[email protected]d4cff272011-05-02 15:46:0118}
19
[email protected]e9ff79c2012-10-19 21:31:2620namespace content {
21
ekaramad330ba4232016-09-23 17:57:4722class PepperPluginInstanceImpl;
23class RenderWidget;
[email protected]e9ff79c2012-10-19 21:31:2624
[email protected]d4cff272011-05-02 15:46:0125// This is the renderer-side message filter that generates the replies for the
26// messages sent by the TextInputClientMac. See
[email protected]86a7d3c2011-09-12 16:45:3227// content/browser/renderer_host/text_input_client_mac.h for more information.
ekaramad330ba4232016-09-23 17:57:4728class TextInputClientObserver : public IPC::Listener, public IPC::Sender {
[email protected]d4cff272011-05-02 15:46:0129 public:
ekaramad330ba4232016-09-23 17:57:4730 explicit TextInputClientObserver(RenderWidget* render_widget);
dcheng6d18e402014-10-21 12:32:5231 ~TextInputClientObserver() override;
[email protected]d4cff272011-05-02 15:46:0132
ekaramad330ba4232016-09-23 17:57:4733 // IPC::Listener override.
dcheng6d18e402014-10-21 12:32:5234 bool OnMessageReceived(const IPC::Message& message) override;
[email protected]d4cff272011-05-02 15:46:0135
ekaramad330ba4232016-09-23 17:57:4736 // IPC::Sender override.
37 bool Send(IPC::Message* message) override;
xjz694b50a92016-06-07 21:49:3738
ekaramad330ba4232016-09-23 17:57:4739 private:
40 // The render widget corresponding to this TextInputClientObserver.
41 blink::WebFrameWidget* GetWebFrameWidget() const;
42
43 blink::WebLocalFrame* GetFocusedFrame() const;
44
brettw4b461082016-11-19 18:55:1645#if BUILDFLAG(ENABLE_PLUGINS)
ekaramad330ba4232016-09-23 17:57:4746 // Returns the currently focused pepper plugin on the page. The expectation is
47 // that the focused pepper plugin is inside a frame whose local root is equal
48 // to GetWebFrameWidget()->localRoot().
49 PepperPluginInstanceImpl* GetFocusedPepperPlugin() const;
50#endif
[email protected]d4cff272011-05-02 15:46:0151
52 // IPC Message handlers:
[email protected]6623d872014-03-18 17:43:1353 void OnStringAtPoint(gfx::Point point);
[email protected]d4cff272011-05-02 15:46:0154 void OnCharacterIndexForPoint(gfx::Point point);
[email protected]db4fc1e2013-09-06 20:01:5155 void OnFirstRectForCharacterRange(gfx::Range range);
56 void OnStringForRange(gfx::Range range);
[email protected]d4cff272011-05-02 15:46:0157
ekaramad330ba4232016-09-23 17:57:4758 // The RenderWidget owning this instance of the observer.
59 RenderWidget* render_widget_;
[email protected]b25b3ee2012-01-13 05:19:5460
[email protected]d4cff272011-05-02 15:46:0161 DISALLOW_COPY_AND_ASSIGN(TextInputClientObserver);
62};
63
[email protected]e9ff79c2012-10-19 21:31:2664} // namespace content
65
[email protected]86a7d3c2011-09-12 16:45:3266#endif // CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_