summaryrefslogtreecommitdiffstats
path: root/content/public/renderer/browser_plugin_delegate.h
blob: dc68d8bac5fa236e27ed61d8c817200175877899 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2014 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.

#ifndef CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_DELEGATE_H_
#define CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_DELEGATE_H_

#include <string>

#include "content/common/content_export.h"
#include "ipc/ipc_message.h"

namespace gfx {
class Size;
}

namespace v8 {
class Isolate;
class Object;
template<typename T> class Local;
}  // namespace v8

namespace content {

class RenderFrame;

// A delegate for BrowserPlugin which gets notified about the plugin load.
// Implementations can provide additional steps necessary to change the load
// behavior of the plugin.
class CONTENT_EXPORT BrowserPluginDelegate {
 public:
  virtual ~BrowserPluginDelegate() {}

  // Called when the BrowserPlugin's geometry has been computed for the first
  // time.
  virtual void Ready() {}

  // Called when plugin document has finished loading.
  virtual void DidFinishLoading() {}

  // Called when plugin document receives data.
  virtual void DidReceiveData(const char* data, int data_length) {}

  // Sets the instance ID that idenfies the plugin within current render
  // process.
  virtual void SetElementInstanceID(int element_instance_id) {}

  // Called when the plugin resizes.
  virtual void DidResizeElement(const gfx::Size& old_size,
                                const gfx::Size& new_size) {}

  // Called when a message is received.  Returns true iff the message was
  // handled.
  virtual bool OnMessageReceived(const IPC::Message& message);

  // Return a scriptable object for the plugin.
  virtual v8::Local<v8::Object> V8ScriptableObject(v8::Isolate* isolate);
};

}  // namespace content

#endif  // CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_DELEGATE_H_