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"
18 template<typename T
> class Local
;
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
{
30 // Called when the BrowserPlugin's geometry has been computed for the first
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
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;
57 virtual ~BrowserPluginDelegate() {}
60 } // namespace content
62 #endif // CONTENT_PUBLIC_RENDERER_BROWSER_PLUGIN_DELEGATE_H_