1 // Copyright 2013 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_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_
8 #include "base/callback_forward.h"
9 #include "base/process/kill.h"
10 #include "content/common/content_export.h"
11 #include "content/public/browser/web_contents.h"
14 class DictionaryValue;
23 // Objects implement this interface to get notified about changes in the guest
24 // WebContents and to provide necessary functionality.
25 class CONTENT_EXPORT BrowserPluginGuestDelegate {
27 virtual ~BrowserPluginGuestDelegate() {}
29 // Notification that the embedder will begin attachment. This is called
30 // prior to resuming resource loads. |element_instance_id| uniquely identifies
31 // the element that will serve as a container for the guest.
32 virtual void WillAttach(content::WebContents* embedder_web_contents,
33 int element_instance_id) {}
35 virtual WebContents* CreateNewGuestWindow(
36 const WebContents::CreateParams& create_params);
38 // Notification that the embedder has completed attachment. The
39 // |guest_proxy_routing_id| is the routing ID for the RenderView in the
40 // embedder that will serve as a contentWindow proxy for the guest.
41 virtual void DidAttach(int guest_proxy_routing_id) {}
43 // Notification that the BrowserPlugin has resized.
44 virtual void ElementSizeChanged(const gfx::Size& old_size,
45 const gfx::Size& new_size) {}
47 // Notifies that the content size of the guest has changed.
48 // Note: In autosize mode, it si possible that the guest size may not match
50 virtual void GuestSizeChanged(const gfx::Size& old_size,
51 const gfx::Size& new_size) {}
53 // Asks the delegate if the given guest can lock the pointer.
54 // Invoking the |callback| synchronously is OK.
55 virtual void RequestPointerLockPermission(
57 bool last_unlocked_by_target,
58 const base::Callback<void(bool)>& callback) {}
60 // Registers a |callback| with the delegate that the delegate would call when
61 // it is about to be destroyed.
62 typedef base::Callback<void()> DestructionCallback;
63 virtual void RegisterDestructionCallback(
64 const DestructionCallback& callback) {}
66 // Find the given |search_text| in the page. Returns true if the find request
67 // is handled by this browser plugin guest delegate.
68 virtual bool Find(int request_id,
69 const base::string16& search_text,
70 const blink::WebFindOptions& options,
71 bool is_full_page_plugin);
74 } // namespace content
76 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_