Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / renderer / browser_plugin_delegate.h
blobdc68d8bac5fa236e27ed61d8c817200175877899
1 // Copyright 2014 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 #ifndef CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_DELEGATE_H_
6 #define CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_DELEGATE_H_
8 #include <string>
10 #include "content/common/content_export.h"
11 #include "ipc/ipc_message.h"
13 namespace gfx {
14 class Size;
17 namespace v8 {
18 class Isolate;
19 class Object;
20 template<typename T> class Local;
21 } // namespace v8
23 namespace content {
25 class RenderFrame;
27 // A delegate for BrowserPlugin which gets notified about the plugin load.
28 // Implementations can provide additional steps necessary to change the load
29 // behavior of the plugin.
30 class CONTENT_EXPORT BrowserPluginDelegate {
31 public:
32 virtual ~BrowserPluginDelegate() {}
34 // Called when the BrowserPlugin's geometry has been computed for the first
35 // time.
36 virtual void Ready() {}
38 // Called when plugin document has finished loading.
39 virtual void DidFinishLoading() {}
41 // Called when plugin document receives data.
42 virtual void DidReceiveData(const char* data, int data_length) {}
44 // Sets the instance ID that idenfies the plugin within current render
45 // process.
46 virtual void SetElementInstanceID(int element_instance_id) {}
48 // Called when the plugin resizes.
49 virtual void DidResizeElement(const gfx::Size& old_size,
50 const gfx::Size& new_size) {}
52 // Called when a message is received. Returns true iff the message was
53 // handled.
54 virtual bool OnMessageReceived(const IPC::Message& message);
56 // Return a scriptable object for the plugin.
57 virtual v8::Local<v8::Object> V8ScriptableObject(v8::Isolate* isolate);
60 } // namespace content
62 #endif // CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_DELEGATE_H_