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
3 // found in the LICENSE file.
5 // This interface is used by RenderView to talk to the pepper plugin delegate.
6 #ifndef CONTENT_RENDERER_RENDER_VIEW_PEPPER_HELPER_H
7 #define CONTENT_RENDERER_RENDER_VIEW_PEPPER_HELPER_H
12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/platform_file.h"
15 #include "base/process.h"
16 #include "ui/base/ime/text_input_type.h"
40 struct WebCompositionUnderline
;
41 struct WebPluginParams
;
47 class RenderViewPepperHelper
{
49 RenderViewPepperHelper() {}
50 virtual ~RenderViewPepperHelper();
52 virtual WebKit::WebPlugin
* CreatePepperWebPlugin(
53 const webkit::WebPluginInfo
& webplugin_info
,
54 const WebKit::WebPluginParams
& params
);
56 // Called by RenderView to implement the corresponding function in its base
57 // class RenderWidget (see that for more).
58 virtual webkit::ppapi::PluginInstance
* GetBitmapForOptimizedPluginPaint(
59 const gfx::Rect
& paint_bounds
,
65 // Called by RenderView to tell us about painting events, these two functions
66 // just correspond to the WillInitiatePaint, DidInitiatePaint and
67 // DidFlushPaint hooks in RenderView.
68 virtual void ViewWillInitiatePaint() {}
69 virtual void ViewInitiatedPaint() {}
70 virtual void ViewFlushedPaint() {}
72 // Called by RenderView when ViewMsg_AsyncOpenFile_ACK.
73 virtual void OnAsyncFileOpened(base::PlatformFileError error_code
,
74 base::PlatformFile file
,
77 // Called by RenderView when ViewMsg_PpapiBrokerChannelCreated.
78 virtual void OnPpapiBrokerChannelCreated(int request_id
,
79 base::ProcessId broker_pid
,
80 const IPC::ChannelHandle
& handle
) {}
82 // Called when we know whether permission to access the PPAPI broker was
84 virtual void OnPpapiBrokerPermissionResult(int request_id
, bool result
) {}
86 // Notification that the render view has been focused or defocused. This
87 // notifies all of the plugins.
88 virtual void OnSetFocus(bool has_focus
) {}
90 // Notification that the page visibility has changed. The default is visible.
91 virtual void PageVisibilityChanged(bool is_visible
) {}
94 virtual bool IsPluginFocused() const;
95 virtual gfx::Rect
GetCaretBounds() const;
96 virtual ui::TextInputType
GetTextInputType() const;
97 virtual bool IsPluginAcceptingCompositionEvents() const;
98 virtual bool CanComposeInline() const;
99 virtual void GetSurroundingText(string16
* text
, ui::Range
* range
) const {}
102 virtual void OnImeSetComposition(
103 const string16
& text
,
104 const std::vector
<WebKit::WebCompositionUnderline
>& underlines
,
106 int selection_end
) {}
107 virtual void OnImeConfirmComposition(const string16
& text
) {}
109 // Notification that a mouse event has arrived at the render view.
110 virtual void WillHandleMouseEvent() {}
113 DISALLOW_COPY_AND_ASSIGN(RenderViewPepperHelper
);
116 } // namespace content
118 #endif // CONTENT_RENDERER_RENDER_VIEW_PEPPER_HELPER_H