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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.h

Issue 1162053003: Move BrowserPluginDelegate's lifetime mgmt out of content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync @tott Created 5 years, 6 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
7 7
8 #include "third_party/WebKit/public/web/WebPlugin.h" 8 #include "third_party/WebKit/public/web/WebPlugin.h"
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 // Informs the guest of an updated focus state. 49 // Informs the guest of an updated focus state.
50 void UpdateGuestFocusState(blink::WebFocusType focus_type); 50 void UpdateGuestFocusState(blink::WebFocusType focus_type);
51 51
52 // Indicates whether the guest should be focused. 52 // Indicates whether the guest should be focused.
53 bool ShouldGuestBeFocused() const; 53 bool ShouldGuestBeFocused() const;
54 54
55 // A request to enable hardware compositing. 55 // A request to enable hardware compositing.
56 void EnableCompositing(bool enable); 56 void EnableCompositing(bool enable);
57 57
58 void UpdateInternalInstanceId();
59
60 // Provided that a guest instance ID has been allocated, this method attaches 58 // Provided that a guest instance ID has been allocated, this method attaches
61 // this BrowserPlugin instance to that guest. 59 // this BrowserPlugin instance to that guest.
62 void Attach(); 60 void Attach();
63 61
64 // This method detaches this BrowserPlugin instance from the guest that it's 62 // This method detaches this BrowserPlugin instance from the guest that it's
65 // currently attached to, if any. 63 // currently attached to, if any.
66 void Detach(); 64 void Detach();
67 65
68 // Notify the plugin about a compositor commit so that frame ACKs could be 66 // Notify the plugin about a compositor commit so that frame ACKs could be
69 // sent, if needed. 67 // sent, if needed.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // Only the manager is allowed to create a BrowserPlugin. 137 // Only the manager is allowed to create a BrowserPlugin.
140 friend class BrowserPluginManager; 138 friend class BrowserPluginManager;
141 139
142 // A BrowserPlugin object is a controller that represents an instance of a 140 // A BrowserPlugin object is a controller that represents an instance of a
143 // browser plugin within the embedder renderer process. Once a BrowserPlugin 141 // browser plugin within the embedder renderer process. Once a BrowserPlugin
144 // does an initial navigation or is attached to a newly created guest, it 142 // does an initial navigation or is attached to a newly created guest, it
145 // acquires a browser_plugin_instance_id as well. The guest instance ID 143 // acquires a browser_plugin_instance_id as well. The guest instance ID
146 // uniquely identifies a guest WebContents that's hosted by this 144 // uniquely identifies a guest WebContents that's hosted by this
147 // BrowserPlugin. 145 // BrowserPlugin.
148 BrowserPlugin(RenderFrame* render_frame, 146 BrowserPlugin(RenderFrame* render_frame,
149 scoped_ptr<BrowserPluginDelegate> delegate); 147 BrowserPluginDelegate* delegate);
150 148
151 ~BrowserPlugin() override; 149 ~BrowserPlugin() override;
152 150
153 gfx::Rect view_rect() const { return view_rect_; } 151 gfx::Rect view_rect() const { return view_rect_; }
154 152
155 void ShowSadGraphic(); 153 void ShowSadGraphic();
154 void UpdateInternalInstanceId();
156 155
157 // IPC message handlers. 156 // IPC message handlers.
158 // Please keep in alphabetical order. 157 // Please keep in alphabetical order.
159 void OnAdvanceFocus(int instance_id, bool reverse); 158 void OnAdvanceFocus(int instance_id, bool reverse);
160 void OnCompositorFrameSwapped(const IPC::Message& message); 159 void OnCompositorFrameSwapped(const IPC::Message& message);
161 void OnGuestGone(int instance_id); 160 void OnGuestGone(int instance_id);
162 void OnSetContentsOpaque(int instance_id, bool opaque); 161 void OnSetContentsOpaque(int instance_id, bool opaque);
163 void OnSetCursor(int instance_id, const WebCursor& cursor); 162 void OnSetCursor(int instance_id, const WebCursor& cursor);
164 void OnSetMouseLock(int instance_id, bool enable); 163 void OnSetMouseLock(int instance_id, bool enable);
165 void OnSetTooltipText(int browser_plugin_instance_id, 164 void OnSetTooltipText(int browser_plugin_instance_id,
(...skipping 28 matching lines...) Expand all
194 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; 193 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
195 194
196 // URL for the embedder frame. 195 // URL for the embedder frame.
197 int browser_plugin_instance_id_; 196 int browser_plugin_instance_id_;
198 197
199 // Indicates whether the guest content is opaque. 198 // Indicates whether the guest content is opaque.
200 bool contents_opaque_; 199 bool contents_opaque_;
201 200
202 std::vector<EditCommand> edit_commands_; 201 std::vector<EditCommand> edit_commands_;
203 202
204 scoped_ptr<BrowserPluginDelegate> delegate_; 203 // We call lifetime managing methods on |delegate_|, but we do not directly
204 // own this. The delegate destroys itself.
205 BrowserPluginDelegate* delegate_;
205 206
206 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might 207 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might
207 // get called after BrowserPlugin has been destroyed. 208 // get called after BrowserPlugin has been destroyed.
208 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; 209 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_;
209 210
210 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); 211 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
211 }; 212 };
212 213
213 } // namespace content 214 } // namespace content
214 215
215 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 216 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
OLDNEW
« no previous file with comments | « content/public/renderer/browser_plugin_delegate.h ('k') | content/renderer/browser_plugin/browser_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698