Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / public / renderer / browser_plugin_delegate.h
blobd741e032558c5293b13f1a7206357c0e06655b03
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 "base/memory/weak_ptr.h"
9 #include "content/common/content_export.h"
11 namespace gfx {
12 class Size;
15 namespace v8 {
16 class Isolate;
17 class Object;
18 template<typename T> class Local;
19 } // namespace v8
21 namespace content {
23 class RenderFrame;
25 // A delegate for BrowserPlugin which gets notified about the plugin load.
26 // Implementations can provide additional steps necessary to change the load
27 // behavior of the plugin.
28 class CONTENT_EXPORT BrowserPluginDelegate {
29 public:
30 // Called when the BrowserPlugin's geometry has been computed for the first
31 // time.
32 virtual void Ready() {}
34 // Called when plugin document has finished loading.
35 virtual void DidFinishLoading() {}
37 // Called when plugin document receives data.
38 virtual void DidReceiveData(const char* data, int data_length) {}
40 // Sets the instance ID that idenfies the plugin within current render
41 // process.
42 virtual void SetElementInstanceID(int element_instance_id) {}
44 // Called when the plugin resizes.
45 virtual void DidResizeElement(const gfx::Size& new_size) {}
47 // Called when the plugin is about to be destroyed.
48 virtual void DidDestroyElement() {}
50 // Returns a scriptable object for the plugin.
51 virtual v8::Local<v8::Object> V8ScriptableObject(v8::Isolate* isolate);
53 // Returns a weak pointer to this delegate.
54 virtual base::WeakPtr<BrowserPluginDelegate> GetWeakPtr() = 0;
56 protected:
57 virtual ~BrowserPluginDelegate() {}
60 } // namespace content
62 #endif // CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_DELEGATE_H_