[email protected] | b25b3ee | 2012-01-13 05:19:54 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 86a7d3c | 2011-09-12 16:45:32 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ |
6 | #define CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ | ||||
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 7 | |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 8 | #include "base/macros.h" |
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 9 | #include "build/build_config.h" |
[email protected] | 3a034ebb | 2011-10-03 19:19:44 | [diff] [blame] | 10 | #include "content/public/renderer/render_view_observer.h" |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame^] | 11 | #include "ppapi/features/features.h" |
tfarina | 655f81d | 2014-12-23 02:38:50 | [diff] [blame] | 12 | #include "ui/gfx/geometry/point.h" |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 13 | #include "ui/gfx/range/range.h" |
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 14 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 15 | namespace blink { |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 16 | class WebFrameWidget; |
17 | class WebLocalFrame; | ||||
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 18 | } |
19 | |||||
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 20 | namespace content { |
21 | |||||
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 22 | class PepperPluginInstanceImpl; |
23 | class RenderWidget; | ||||
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 24 | |
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 25 | // This is the renderer-side message filter that generates the replies for the |
26 | // messages sent by the TextInputClientMac. See | ||||
[email protected] | 86a7d3c | 2011-09-12 16:45:32 | [diff] [blame] | 27 | // content/browser/renderer_host/text_input_client_mac.h for more information. |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 28 | class TextInputClientObserver : public IPC::Listener, public IPC::Sender { |
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 29 | public: |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 30 | explicit TextInputClientObserver(RenderWidget* render_widget); |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 31 | ~TextInputClientObserver() override; |
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 32 | |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 33 | // IPC::Listener override. |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 34 | bool OnMessageReceived(const IPC::Message& message) override; |
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 35 | |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 36 | // IPC::Sender override. |
37 | bool Send(IPC::Message* message) override; | ||||
xjz | 694b50a9 | 2016-06-07 21:49:37 | [diff] [blame] | 38 | |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 39 | private: |
40 | // The render widget corresponding to this TextInputClientObserver. | ||||
41 | blink::WebFrameWidget* GetWebFrameWidget() const; | ||||
42 | |||||
43 | blink::WebLocalFrame* GetFocusedFrame() const; | ||||
44 | |||||
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame^] | 45 | #if BUILDFLAG(ENABLE_PLUGINS) |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 46 | // 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] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 51 | |
52 | // IPC Message handlers: | ||||
[email protected] | 6623d87 | 2014-03-18 17:43:13 | [diff] [blame] | 53 | void OnStringAtPoint(gfx::Point point); |
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 54 | void OnCharacterIndexForPoint(gfx::Point point); |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 55 | void OnFirstRectForCharacterRange(gfx::Range range); |
56 | void OnStringForRange(gfx::Range range); | ||||
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 57 | |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 58 | // The RenderWidget owning this instance of the observer. |
59 | RenderWidget* render_widget_; | ||||
[email protected] | b25b3ee | 2012-01-13 05:19:54 | [diff] [blame] | 60 | |
[email protected] | d4cff27 | 2011-05-02 15:46:01 | [diff] [blame] | 61 | DISALLOW_COPY_AND_ASSIGN(TextInputClientObserver); |
62 | }; | ||||
63 | |||||
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 64 | } // namespace content |
65 | |||||
[email protected] | 86a7d3c | 2011-09-12 16:45:32 | [diff] [blame] | 66 | #endif // CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ |