blob: c2c485561550081cbfcc6ee9fef622d7ce9bd6ea [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/macros.h"
#include "build/build_config.h"
#include "content/public/renderer/render_view_observer.h"
#include "ppapi/buildflags/buildflags.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/range/range.h"
namespace blink {
class WebFrameWidget;
class WebLocalFrame;
namespace content {
class PepperPluginInstanceImpl;
class RenderWidget;
// This is the renderer-side message filter that generates the replies for the
// messages sent by the TextInputClientMac. See
// content/browser/renderer_host/text_input_client_mac.h for more information.
class TextInputClientObserver : public IPC::Listener, public IPC::Sender {
explicit TextInputClientObserver(RenderWidget* render_widget);
~TextInputClientObserver() override;
// IPC::Listener override.
bool OnMessageReceived(const IPC::Message& message) override;
// IPC::Sender override.
bool Send(IPC::Message* message) override;
// The render widget corresponding to this TextInputClientObserver.
blink::WebFrameWidget* GetWebFrameWidget() const;
blink::WebLocalFrame* GetFocusedFrame() const;
// Returns the currently focused pepper plugin on the page. The expectation is
// that the focused pepper plugin is inside a frame whose local root is equal
// to GetWebFrameWidget()->localRoot().
PepperPluginInstanceImpl* GetFocusedPepperPlugin() const;
// IPC Message handlers:
void OnStringAtPoint(gfx::Point point);
void OnCharacterIndexForPoint(gfx::Point point);
void OnFirstRectForCharacterRange(gfx::Range range);
void OnStringForRange(gfx::Range range);
// The RenderWidget owning this instance of the observer.
RenderWidget* render_widget_;
} // namespace content