Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / content / public / browser / browser_plugin_guest_delegate.h
blob000e3b627dad20110acb1d8c6358465416d369e2
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"
13 namespace base {
14 class DictionaryValue;
15 } // namespace base
17 namespace gfx {
18 class Size;
19 } // namespace gfx
21 namespace content {
23 class GuestHost;
25 // Objects implement this interface to get notified about changes in the guest
26 // WebContents and to provide necessary functionality.
27 class CONTENT_EXPORT BrowserPluginGuestDelegate {
28 public:
29 virtual ~BrowserPluginGuestDelegate() {}
31 // Notification that the embedder will begin attachment. This is called
32 // prior to resuming resource loads. |element_instance_id| uniquely identifies
33 // the element that will serve as a container for the guest.
34 // Once the content embedder has completed setting up state for attachment, it
35 // must call the |completion_callback| to complete attachment.
36 virtual void WillAttach(content::WebContents* embedder_web_contents,
37 int element_instance_id,
38 bool is_full_page_plugin,
39 const base::Closure& completion_callback) {}
41 virtual WebContents* CreateNewGuestWindow(
42 const WebContents::CreateParams& create_params);
44 // Asks the delegate whether this guest can run while detached from a
45 // container. A detached guest is a WebContents that has no visual surface
46 // into which it can composite its content. Detached guests can be thought
47 // of as workers with a DOM.
48 virtual bool CanRunInDetachedState() const;
50 // Notification that the embedder has completed attachment. The
51 // |guest_proxy_routing_id| is the routing ID for the RenderView in the
52 // embedder that will serve as a contentWindow proxy for the guest.
53 virtual void DidAttach(int guest_proxy_routing_id) {}
55 // Notification that the guest has detached from its container.
56 virtual void DidDetach() {}
58 // Notification that a valid |url| was dropped over the guest.
59 virtual void DidDropLink(const GURL& url) {}
61 // Notification that the BrowserPlugin has resized.
62 virtual void ElementSizeChanged(const gfx::Size& size) {}
64 // Returns the WebContents that currently owns this guest.
65 virtual WebContents* GetOwnerWebContents() const;
67 // Notifies that the content size of the guest has changed.
68 // Note: In autosize mode, it is possible that the guest size may not match
69 // the element size.
70 virtual void GuestSizeChanged(const gfx::Size& new_size) {}
72 // Asks the delegate if the given guest can lock the pointer.
73 // Invoking the |callback| synchronously is OK.
74 virtual void RequestPointerLockPermission(
75 bool user_gesture,
76 bool last_unlocked_by_target,
77 const base::Callback<void(bool)>& callback) {}
79 // Find the given |search_text| in the page. Returns true if the find request
80 // is handled by this browser plugin guest delegate.
81 virtual bool Find(int request_id,
82 const base::string16& search_text,
83 const blink::WebFindOptions& options);
84 virtual bool StopFinding(StopFindAction action);
86 // Provides the delegate with an interface with which to communicate with the
87 // content module.
88 virtual void SetGuestHost(GuestHost* guest_host) {}
91 } // namespace content
93 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_