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

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

Issue 801173002: Fix message routing for BrowserPlugin in iframe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup Created 6 years 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"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/sequenced_task_runner_helpers.h" 12 #include "base/sequenced_task_runner_helpers.h"
13 #include "content/renderer/mouse_lock_dispatcher.h" 13 #include "content/renderer/mouse_lock_dispatcher.h"
14 #include "content/renderer/render_view_impl.h" 14 #include "content/renderer/render_view_impl.h"
15 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 15 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
16 #include "third_party/WebKit/public/web/WebDragStatus.h" 16 #include "third_party/WebKit/public/web/WebDragStatus.h"
17 #include "third_party/WebKit/public/web/WebNode.h" 17 #include "third_party/WebKit/public/web/WebNode.h"
18 #include "third_party/WebKit/public/web/WebWidget.h" 18 #include "third_party/WebKit/public/web/WebWidget.h"
19 19
20 struct BrowserPluginHostMsg_ResizeGuest_Params; 20 struct BrowserPluginHostMsg_ResizeGuest_Params;
21 struct FrameMsg_BuffersSwapped_Params; 21 struct FrameMsg_BuffersSwapped_Params;
22 22
23 namespace content { 23 namespace content {
24 24
25 class BrowserPluginDelegate; 25 class BrowserPluginDelegate;
26 class ChildFrameCompositingHelper; 26 class ChildFrameCompositingHelper;
27 class BrowserPluginManager; 27 class BrowserPluginManager;
28 class MockBrowserPlugin;
lazyboy 2014/12/16 23:57:30 This was lingering around it seems, great! nit: Ca
Fady Samuel 2014/12/17 19:30:35 Done.
29 28
30 class CONTENT_EXPORT BrowserPlugin : 29 class CONTENT_EXPORT BrowserPlugin :
31 NON_EXPORTED_BASE(public blink::WebPlugin), 30 NON_EXPORTED_BASE(public blink::WebPlugin),
32 public MouseLockDispatcher::LockTarget { 31 public MouseLockDispatcher::LockTarget {
33 public: 32 public:
34 static BrowserPlugin* GetFromNode(blink::WebNode& node); 33 static BrowserPlugin* GetFromNode(blink::WebNode& node);
35 34
36 RenderViewImpl* render_view() const { return render_view_.get(); } 35 RenderViewImpl* render_view() const { return render_view_.get(); }
37 int render_view_routing_id() const { return render_view_routing_id_; } 36 int render_view_routing_id() const { return render_view_routing_id_; }
38 int browser_plugin_instance_id() const { return browser_plugin_instance_id_; } 37 int browser_plugin_instance_id() const { return browser_plugin_instance_id_; }
39 bool attached() const { return attached_; } 38 bool attached() const { return attached_; }
40 BrowserPluginManager* browser_plugin_manager() const {
41 return browser_plugin_manager_.get();
42 }
43 39
44 bool OnMessageReceived(const IPC::Message& msg); 40 bool OnMessageReceived(const IPC::Message& msg);
45 41
46 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value 42 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value
47 // |attribute_value|. 43 // |attribute_value|.
48 void UpdateDOMAttribute(const std::string& attribute_name, 44 void UpdateDOMAttribute(const std::string& attribute_name,
49 const base::string16& attribute_value); 45 const base::string16& attribute_value);
50 46
51 // Returns whether the guest process has crashed. 47 // Returns whether the guest process has crashed.
52 bool guest_crashed() const { return guest_crashed_; } 48 bool guest_crashed() const { return guest_crashed_; }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // MouseLockDispatcher::LockTarget implementation. 130 // MouseLockDispatcher::LockTarget implementation.
135 void OnLockMouseACK(bool succeeded) override; 131 void OnLockMouseACK(bool succeeded) override;
136 void OnMouseLockLost() override; 132 void OnMouseLockLost() override;
137 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override; 133 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override;
138 134
139 private: 135 private:
140 friend class base::DeleteHelper<BrowserPlugin>; 136 friend class base::DeleteHelper<BrowserPlugin>;
141 // Only the manager is allowed to create a BrowserPlugin. 137 // Only the manager is allowed to create a BrowserPlugin.
142 friend class BrowserPluginManager; 138 friend class BrowserPluginManager;
143 139
144 // For unit/integration tests.
145 friend class MockBrowserPlugin;
146
147 // 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
148 // browser plugin within the embedder renderer process. Once a BrowserPlugin 141 // browser plugin within the embedder renderer process. Once a BrowserPlugin
149 // 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
150 // 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
151 // uniquely identifies a guest WebContents that's hosted by this 144 // uniquely identifies a guest WebContents that's hosted by this
152 // BrowserPlugin. 145 // BrowserPlugin.
153 BrowserPlugin(RenderViewImpl* render_view, 146 BrowserPlugin(RenderViewImpl* render_view,
154 blink::WebFrame* frame, 147 blink::WebFrame* frame,
155 scoped_ptr<BrowserPluginDelegate> delegate); 148 scoped_ptr<BrowserPluginDelegate> delegate);
156 149
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // embedder RenderView's visibility. 194 // embedder RenderView's visibility.
202 bool visible_; 195 bool visible_;
203 196
204 WebCursor cursor_; 197 WebCursor cursor_;
205 198
206 bool mouse_locked_; 199 bool mouse_locked_;
207 200
208 // This indicates that the BrowserPlugin has a geometry. 201 // This indicates that the BrowserPlugin has a geometry.
209 bool ready_; 202 bool ready_;
210 203
211 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to
212 // store the BrowserPlugin's BrowserPluginManager in a member variable to
213 // avoid accessing the RenderViewImpl.
214 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_;
215
216 // Used for HW compositing. 204 // Used for HW compositing.
217 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; 205 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
218 206
219 // URL for the embedder frame. 207 // URL for the embedder frame.
220 int browser_plugin_instance_id_; 208 int browser_plugin_instance_id_;
221 209
222 // Indicates whether the guest content is opaque. 210 // Indicates whether the guest content is opaque.
223 bool contents_opaque_; 211 bool contents_opaque_;
224 212
225 std::vector<EditCommand> edit_commands_; 213 std::vector<EditCommand> edit_commands_;
226 214
227 scoped_ptr<BrowserPluginDelegate> delegate_; 215 scoped_ptr<BrowserPluginDelegate> delegate_;
228 216
229 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might 217 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might
230 // get called after BrowserPlugin has been destroyed. 218 // get called after BrowserPlugin has been destroyed.
231 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; 219 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_;
232 220
233 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); 221 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
234 }; 222 };
235 223
236 } // namespace content 224 } // namespace content
237 225
238 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 226 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698