OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ | 5 #ifndef CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ |
6 #define CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ | 6 #define CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "content/public/renderer/render_view_observer.h" | 10 #include "content/public/renderer/render_view_observer.h" |
11 #include "ui/gfx/geometry/point.h" | 11 #include "ui/gfx/geometry/point.h" |
12 #include "ui/gfx/range/range.h" | 12 #include "ui/gfx/range/range.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 class WebView; | 15 class WebFrameWidget; |
| 16 class WebLocalFrame; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class RenderViewImpl; | 21 class PepperPluginInstanceImpl; |
| 22 class RenderWidget; |
21 | 23 |
22 // This is the renderer-side message filter that generates the replies for the | 24 // This is the renderer-side message filter that generates the replies for the |
23 // messages sent by the TextInputClientMac. See | 25 // messages sent by the TextInputClientMac. See |
24 // content/browser/renderer_host/text_input_client_mac.h for more information. | 26 // content/browser/renderer_host/text_input_client_mac.h for more information. |
25 class TextInputClientObserver : public RenderViewObserver { | 27 class TextInputClientObserver : public IPC::Listener, public IPC::Sender { |
26 public: | 28 public: |
27 explicit TextInputClientObserver(RenderViewImpl* render_view); | 29 explicit TextInputClientObserver(RenderWidget* render_widget); |
28 ~TextInputClientObserver() override; | 30 ~TextInputClientObserver() override; |
29 | 31 |
30 // RenderViewObserver overrides: | 32 // IPC::Listener override. |
31 bool OnMessageReceived(const IPC::Message& message) override; | 33 bool OnMessageReceived(const IPC::Message& message) override; |
32 | 34 |
| 35 // IPC::Sender override. |
| 36 bool Send(IPC::Message* message) override; |
| 37 |
33 private: | 38 private: |
34 // RenderViewObserver implementation. | 39 // The render widget corresponding to this TextInputClientObserver. |
35 void OnDestruct() override; | 40 blink::WebFrameWidget* GetWebFrameWidget() const; |
36 | 41 |
37 // Returns the WebView of the RenderView. | 42 blink::WebLocalFrame* GetFocusedFrame() const; |
38 blink::WebView* webview(); | 43 |
| 44 #if defined(ENABLE_PLUGINS) |
| 45 // Returns the currently focused pepper plugin on the page. The expectation is |
| 46 // that the focused pepper plugin is inside a frame whose local root is equal |
| 47 // to GetWebFrameWidget()->localRoot(). |
| 48 PepperPluginInstanceImpl* GetFocusedPepperPlugin() const; |
| 49 #endif |
39 | 50 |
40 // IPC Message handlers: | 51 // IPC Message handlers: |
41 void OnStringAtPoint(gfx::Point point); | 52 void OnStringAtPoint(gfx::Point point); |
42 void OnCharacterIndexForPoint(gfx::Point point); | 53 void OnCharacterIndexForPoint(gfx::Point point); |
43 void OnFirstRectForCharacterRange(gfx::Range range); | 54 void OnFirstRectForCharacterRange(gfx::Range range); |
44 void OnStringForRange(gfx::Range range); | 55 void OnStringForRange(gfx::Range range); |
45 | 56 |
46 #if defined(ENABLE_PLUGINS) | 57 // The RenderWidget owning this instance of the observer. |
47 RenderViewImpl* const render_view_impl_; | 58 RenderWidget* render_widget_; |
48 #endif | |
49 | 59 |
50 DISALLOW_COPY_AND_ASSIGN(TextInputClientObserver); | 60 DISALLOW_COPY_AND_ASSIGN(TextInputClientObserver); |
51 }; | 61 }; |
52 | 62 |
53 } // namespace content | 63 } // namespace content |
54 | 64 |
55 #endif // CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ | 65 #endif // CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ |
OLD | NEW |