Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: content/public/browser/browser_plugin_guest_delegate.h

Issue 910073003: <webview>: Make contentWindow available prior to attachment (on display:none). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed creis' comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/process/kill.h" 9 #include "base/process/kill.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "content/public/browser/guest_sizer.h"
12 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
13 12
14 namespace base { 13 namespace base {
15 class DictionaryValue; 14 class DictionaryValue;
16 } // namespace base 15 } // namespace base
17 16
18 namespace gfx { 17 namespace gfx {
19 class Size; 18 class Size;
20 } // namespace gfx 19 } // namespace gfx
21 20
22 namespace content { 21 namespace content {
23 22
23 class GuestProxyHost;
24
24 // Objects implement this interface to get notified about changes in the guest 25 // Objects implement this interface to get notified about changes in the guest
25 // WebContents and to provide necessary functionality. 26 // WebContents and to provide necessary functionality.
26 class CONTENT_EXPORT BrowserPluginGuestDelegate { 27 class CONTENT_EXPORT BrowserPluginGuestDelegate {
27 public: 28 public:
28 virtual ~BrowserPluginGuestDelegate() {} 29 virtual ~BrowserPluginGuestDelegate() {}
29 30
30 // Notification that the embedder will begin attachment. This is called 31 // Notification that the embedder will begin attachment. This is called
31 // prior to resuming resource loads. |element_instance_id| uniquely identifies 32 // prior to resuming resource loads. |element_instance_id| uniquely identifies
32 // the element that will serve as a container for the guest. 33 // the element that will serve as a container for the guest.
33 virtual void WillAttach(content::WebContents* embedder_web_contents, 34 virtual void WillAttach(content::WebContents* embedder_web_contents,
34 int element_instance_id, 35 int element_instance_id,
35 bool is_full_page_plugin) {} 36 bool is_full_page_plugin) {}
36 37
37 virtual WebContents* CreateNewGuestWindow( 38 virtual WebContents* CreateNewGuestWindow(
38 const WebContents::CreateParams& create_params); 39 const WebContents::CreateParams& create_params);
39 40
40 // Asks the delegate whether this guest can run while detached from a 41 // Asks the delegate whether this guest can run while detached from a
41 // container. A detached guest is a WebContents that has no visual surface 42 // container. A detached guest is a WebContents that has no visual surface
42 // into which it can composite its content. Detached guests can be thought 43 // into which it can composite its content. Detached guests can be thought
43 // of as workers with a DOM. 44 // of as workers with a DOM.
44 virtual bool CanRunInDetachedState() const; 45 virtual bool CanRunInDetachedState() const;
45 46
46 // Notification that the embedder has completed attachment. The 47 // Notification that the embedder has completed attachment.
47 // |guest_proxy_routing_id| is the routing ID for the RenderView in the
48 // embedder that will serve as a contentWindow proxy for the guest.
Charlie Reis 2015/03/09 18:52:59 Why delete this comment? I agree it would be nice
Fady Samuel 2015/03/09 23:02:41 Done.
49 virtual void DidAttach(int guest_proxy_routing_id) {} 48 virtual void DidAttach(int guest_proxy_routing_id) {}
50 49
51 // Notification that the guest has detached from its container. 50 // Notification that the guest has detached from its container.
52 virtual void DidDetach() {} 51 virtual void DidDetach() {}
53 52
54 // Notification that a valid |url| was dropped over the guest. 53 // Notification that a valid |url| was dropped over the guest.
55 virtual void DidDropLink(const GURL& url) {} 54 virtual void DidDropLink(const GURL& url) {}
56 55
57 // Notification that the BrowserPlugin has resized. 56 // Notification that the BrowserPlugin has resized.
58 virtual void ElementSizeChanged(const gfx::Size& size) {} 57 virtual void ElementSizeChanged(const gfx::Size& size) {}
59 58
60 // Returns the WebContents that currently owns this guest. 59 // Returns the WebContents that currently owns this guest.
61 virtual WebContents* GetOwnerWebContents() const; 60 virtual WebContents* GetOwnerWebContents() const;
62 61
63 // Notifies that the content size of the guest has changed. 62 // Notifies that the content size of the guest has changed.
64 // Note: In autosize mode, it is possible that the guest size may not match 63 // Note: In autosize mode, it is possible that the guest size may not match
65 // the element size. 64 // the element size.
66 virtual void GuestSizeChanged(const gfx::Size& new_size) {} 65 virtual void GuestSizeChanged(const gfx::Size& new_size) {}
67 66
68 // Asks the delegate if the given guest can lock the pointer. 67 // Asks the delegate if the given guest can lock the pointer.
69 // Invoking the |callback| synchronously is OK. 68 // Invoking the |callback| synchronously is OK.
70 virtual void RequestPointerLockPermission( 69 virtual void RequestPointerLockPermission(
71 bool user_gesture, 70 bool user_gesture,
72 bool last_unlocked_by_target, 71 bool last_unlocked_by_target,
73 const base::Callback<void(bool)>& callback) {} 72 const base::Callback<void(bool)>& callback) {}
74 73
75 // Registers a |callback| with the delegate that the delegate would call when
76 // it is about to be destroyed.
77 typedef base::Callback<void()> DestructionCallback;
78 virtual void RegisterDestructionCallback(
79 const DestructionCallback& callback) {}
80
81 // Find the given |search_text| in the page. Returns true if the find request 74 // Find the given |search_text| in the page. Returns true if the find request
82 // is handled by this browser plugin guest delegate. 75 // is handled by this browser plugin guest delegate.
83 virtual bool Find(int request_id, 76 virtual bool Find(int request_id,
84 const base::string16& search_text, 77 const base::string16& search_text,
85 const blink::WebFindOptions& options); 78 const blink::WebFindOptions& options);
86 virtual bool StopFinding(StopFindAction action); 79 virtual bool StopFinding(StopFindAction action);
87 80
88 // Provides the delegate with an interface with which to size the guest. 81 // Provides the delegate with an interface with which to size the guest.
Charlie Reis 2015/03/09 18:52:58 nit: Update comment.
Fady Samuel 2015/03/09 23:02:41 Done.
89 virtual void SetGuestSizer(GuestSizer* guest_sizer) {} 82 virtual void SetGuestProxyHost(GuestProxyHost* guest_proxy_host) {}
90 }; 83 };
91 84
92 } // namespace content 85 } // namespace content
93 86
94 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ 87 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698