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 "base/memory/ref_counted.h" | |
9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
10 #include "content/public/renderer/render_view_observer.h" | 11 #include "content/public/renderer/render_view_observer.h" |
11 #include "ui/gfx/geometry/point.h" | 12 #include "ui/gfx/geometry/point.h" |
12 #include "ui/gfx/range/range.h" | 13 #include "ui/gfx/range/range.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 class WebView; | 16 class WebView; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class RenderViewImpl; | 21 class RenderWidget; |
21 | 22 |
22 // This is the renderer-side message filter that generates the replies for the | 23 // This is the renderer-side message filter that generates the replies for the |
23 // messages sent by the TextInputClientMac. See | 24 // messages sent by the TextInputClientMac. See |
24 // content/browser/renderer_host/text_input_client_mac.h for more information. | 25 // content/browser/renderer_host/text_input_client_mac.h for more information. |
25 class TextInputClientObserver : public RenderViewObserver { | 26 class TextInputClientObserver : public IPC::Listener, public IPC::Sender { |
26 public: | 27 public: |
27 explicit TextInputClientObserver(RenderViewImpl* render_view); | 28 TextInputClientObserver(scoped_refptr<RenderWidget> render_widget, |
29 blink::WebView* webv_iew); | |
erikchen
2016/09/01 00:04:29
s/webv_iew/web_view
EhsanK
2016/09/01 21:58:37
Thanks. Changed the constructors signature and thi
| |
28 ~TextInputClientObserver() override; | 30 ~TextInputClientObserver() override; |
29 | 31 |
30 // RenderViewObserver overrides: | 32 // RenderViewObserver overrides: |
31 bool OnMessageReceived(const IPC::Message& message) override; | 33 bool OnMessageReceived(const IPC::Message& message) override; |
32 | 34 |
35 bool Send(IPC::Message* message) override; | |
36 | |
37 const RenderWidget* render_widget() const { return render_widget_.get(); } | |
38 | |
33 private: | 39 private: |
34 // RenderViewObserver implementation. | |
35 void OnDestruct() override; | |
36 | |
37 // Returns the WebView of the RenderView. | 40 // Returns the WebView of the RenderView. |
38 blink::WebView* webview(); | 41 blink::WebView* webview(); |
39 | 42 |
43 int32_t GetRoutingID(); | |
44 | |
40 // IPC Message handlers: | 45 // IPC Message handlers: |
41 void OnStringAtPoint(gfx::Point point); | 46 void OnStringAtPoint(gfx::Point point); |
42 void OnCharacterIndexForPoint(gfx::Point point); | 47 void OnCharacterIndexForPoint(gfx::Point point); |
43 void OnFirstRectForCharacterRange(gfx::Range range); | 48 void OnFirstRectForCharacterRange(gfx::Range range); |
44 void OnStringForRange(gfx::Range range); | 49 void OnStringForRange(gfx::Range range); |
45 | 50 |
46 #if defined(ENABLE_PLUGINS) | 51 // The render widget whose incoming TextInputClientMac IPCs are handled. |
47 RenderViewImpl* const render_view_impl_; | 52 scoped_refptr<RenderWidget> render_widget_; |
48 #endif | 53 |
54 // TODO(ekaramad): We should not be using a WebView here. Everything should | |
55 // go through WebWidget. Unfortunately, WebSubStringUril uses WebView for some | |
56 // of the methods used and casting WebWidget to WebViewImpl is no longer | |
57 // possible. The whole logic should be changed so that we only use WebWidget. | |
58 // The WebView used to apply hit testing to query string and character index. | |
59 blink::WebView* web_view_; | |
49 | 60 |
50 DISALLOW_COPY_AND_ASSIGN(TextInputClientObserver); | 61 DISALLOW_COPY_AND_ASSIGN(TextInputClientObserver); |
51 }; | 62 }; |
52 | 63 |
53 } // namespace content | 64 } // namespace content |
54 | 65 |
55 #endif // CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ | 66 #endif // CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ |
OLD | NEW |