| 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 WebView; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class RenderViewImpl; | 20 class RenderFrameImpl; |
| 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 explicit TextInputClientObserver(RenderFrameImpl* render_frame); |
| 28 ~TextInputClientObserver() override; | 29 ~TextInputClientObserver() override; |
| 29 | 30 |
| 30 // RenderViewObserver overrides: | 31 // IPC::Listener override. |
| 31 bool OnMessageReceived(const IPC::Message& message) override; | 32 bool OnMessageReceived(const IPC::Message& message) override; |
| 32 | 33 |
| 34 // IPC::Sender override. |
| 35 bool Send(IPC::Message* message) override; |
| 36 |
| 33 private: | 37 private: |
| 34 // RenderViewObserver implementation. | 38 // The render widget corresponding to this TextInputClientObserver. |
| 35 void OnDestruct() override; | 39 RenderWidget* GetRenderWidget(); |
| 36 | 40 |
| 37 // Returns the WebView of the RenderView. | 41 // Returns the WebView corresponding to the page. |
| 38 blink::WebView* webview(); | 42 blink::WebView* GetWebView(); |
| 43 |
| 44 // The routing ID of the RenderWidget. |
| 45 int32_t GetRoutingID(); |
| 39 | 46 |
| 40 // IPC Message handlers: | 47 // IPC Message handlers: |
| 41 void OnStringAtPoint(gfx::Point point); | 48 void OnStringAtPoint(gfx::Point point); |
| 42 void OnCharacterIndexForPoint(gfx::Point point); | 49 void OnCharacterIndexForPoint(gfx::Point point); |
| 43 void OnFirstRectForCharacterRange(gfx::Range range); | 50 void OnFirstRectForCharacterRange(gfx::Range range); |
| 44 void OnStringForRange(gfx::Range range); | 51 void OnStringForRange(gfx::Range range); |
| 45 | 52 |
| 46 #if defined(ENABLE_PLUGINS) | 53 // RenderFrameImpl owning this instance of the observer. |
| 47 RenderViewImpl* const render_view_impl_; | 54 RenderFrameImpl* render_frame_; |
| 48 #endif | |
| 49 | 55 |
| 50 DISALLOW_COPY_AND_ASSIGN(TextInputClientObserver); | 56 DISALLOW_COPY_AND_ASSIGN(TextInputClientObserver); |
| 51 }; | 57 }; |
| 52 | 58 |
| 53 } // namespace content | 59 } // namespace content |
| 54 | 60 |
| 55 #endif // CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ | 61 #endif // CONTENT_RENDERER_TEXT_INPUT_CLIENT_OBSERVER_H_ |
| OLD | NEW |