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

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

Issue 11956022: Browser Plugin: Allocate Instance IDs in BrowserPluginEmbedder instead of BrowserPluginManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/Source/WebKit/chromium/public/WebPlugin.h" 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h"
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 16 matching lines...) Expand all
27 namespace content { 27 namespace content {
28 28
29 class BrowserPluginCompositingHelper; 29 class BrowserPluginCompositingHelper;
30 class BrowserPluginManager; 30 class BrowserPluginManager;
31 class MockBrowserPlugin; 31 class MockBrowserPlugin;
32 32
33 class CONTENT_EXPORT BrowserPlugin : 33 class CONTENT_EXPORT BrowserPlugin :
34 NON_EXPORTED_BASE(public WebKit::WebPlugin) { 34 NON_EXPORTED_BASE(public WebKit::WebPlugin) {
35 public: 35 public:
36 RenderViewImpl* render_view() const { return render_view_.get(); } 36 RenderViewImpl* render_view() const { return render_view_.get(); }
37 int render_view_routing_id() const { return render_view_routing_id_; }
37 38
38 bool OnMessageReceived(const IPC::Message& msg); 39 bool OnMessageReceived(const IPC::Message& msg);
39 40
40 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value 41 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value
41 // |attribute_value|. 42 // |attribute_value|.
42 void UpdateDOMAttribute(const std::string& attribute_name, 43 void UpdateDOMAttribute(const std::string& attribute_name,
43 const std::string& attribute_value); 44 const std::string& attribute_value);
44 45
45 // Get the name attribute value. 46 // Get the name attribute value.
46 std::string name_attribute() const { return name_; } 47 std::string name_attribute() const { return name_; }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // For unit/integration tests. 169 // For unit/integration tests.
169 friend class MockBrowserPlugin; 170 friend class MockBrowserPlugin;
170 171
171 // A BrowserPlugin object is a controller that represents an instance of a 172 // A BrowserPlugin object is a controller that represents an instance of a
172 // browser plugin within the embedder renderer process. Each BrowserPlugin 173 // browser plugin within the embedder renderer process. Each BrowserPlugin
173 // within a process has a unique instance_id that is used to route messages 174 // within a process has a unique instance_id that is used to route messages
174 // to it. It takes in a RenderViewImpl that it's associated with along 175 // to it. It takes in a RenderViewImpl that it's associated with along
175 // with the frame within which it lives and the initial attributes assigned 176 // with the frame within which it lives and the initial attributes assigned
176 // to it on creation. 177 // to it on creation.
177 BrowserPlugin( 178 BrowserPlugin(
178 int instance_id,
179 RenderViewImpl* render_view, 179 RenderViewImpl* render_view,
180 WebKit::WebFrame* frame, 180 WebKit::WebFrame* frame,
181 const WebKit::WebPluginParams& params); 181 const WebKit::WebPluginParams& params);
182 182
183 virtual ~BrowserPlugin(); 183 virtual ~BrowserPlugin();
184 184
185 int width() const { return plugin_rect_.width(); } 185 int width() const { return plugin_rect_.width(); }
186 int height() const { return plugin_rect_.height(); } 186 int height() const { return plugin_rect_.height(); }
187 int instance_id() const { return instance_id_; } 187 int instance_id() const { return instance_id_; }
188 int render_view_routing_id() const { return render_view_routing_id_; }
189 BrowserPluginManager* browser_plugin_manager() const { 188 BrowserPluginManager* browser_plugin_manager() const {
190 return browser_plugin_manager_; 189 return browser_plugin_manager_;
191 } 190 }
192 191
193 // Virtual to allow for mocking in tests. 192 // Virtual to allow for mocking in tests.
194 virtual float GetDeviceScaleFactor() const; 193 virtual float GetDeviceScaleFactor() const;
195 194
196 // Parses the attributes of the browser plugin from the element's attributes 195 // Parses the attributes of the browser plugin from the element's attributes
197 // and sets them appropriately. 196 // and sets them appropriately.
198 void ParseAttributes(const WebKit::WebPluginParams& params); 197 void ParseAttributes(const WebKit::WebPluginParams& params);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Indicates whether a damage buffer was used by the guest process for the 233 // Indicates whether a damage buffer was used by the guest process for the
235 // provided |params|. 234 // provided |params|.
236 static bool UsesDamageBuffer( 235 static bool UsesDamageBuffer(
237 const BrowserPluginMsg_UpdateRect_Params& params); 236 const BrowserPluginMsg_UpdateRect_Params& params);
238 237
239 // Indicates whether the |pending_damage_buffer_| was used to copy over pixels 238 // Indicates whether the |pending_damage_buffer_| was used to copy over pixels
240 // given the provided |params|. 239 // given the provided |params|.
241 bool UsesPendingDamageBuffer( 240 bool UsesPendingDamageBuffer(
242 const BrowserPluginMsg_UpdateRect_Params& params); 241 const BrowserPluginMsg_UpdateRect_Params& params);
243 242
243 // Sets the instance ID of the BrowserPlugin and requests a guest from the
244 // browser process.
245 void SetInstanceID(int instance_id);
246
244 // IPC message handlers. 247 // IPC message handlers.
245 // Please keep in alphabetical order. 248 // Please keep in alphabetical order.
246 void OnAdvanceFocus(int instance_id, bool reverse); 249 void OnAdvanceFocus(int instance_id, bool reverse);
247 void OnBuffersSwapped(int instance_id, 250 void OnBuffersSwapped(int instance_id,
248 const gfx::Size& size, 251 const gfx::Size& size,
249 std::string mailbox_name, 252 std::string mailbox_name,
250 int gpu_route_id, 253 int gpu_route_id,
251 int gpu_host_id); 254 int gpu_host_id);
252 void OnGuestContentWindowReady(int instance_id, 255 void OnGuestContentWindowReady(int instance_id,
253 int content_window_routing_id); 256 int content_window_routing_id);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 bool plugin_focused_; 309 bool plugin_focused_;
307 // Tracks the visibility of the browser plugin regardless of the whole 310 // Tracks the visibility of the browser plugin regardless of the whole
308 // embedder RenderView's visibility. 311 // embedder RenderView's visibility.
309 bool visible_; 312 bool visible_;
310 std::string name_; 313 std::string name_;
311 314
312 WebCursor cursor_; 315 WebCursor cursor_;
313 316
314 gfx::Size last_view_size_; 317 gfx::Size last_view_size_;
315 bool size_changed_in_flight_; 318 bool size_changed_in_flight_;
319 bool allocate_instance_id_sent_;
316 320
317 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to 321 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to
318 // store the BrowserPlugin's BrowserPluginManager in a member variable to 322 // store the BrowserPlugin's BrowserPluginManager in a member variable to
319 // avoid accessing the RenderViewImpl. 323 // avoid accessing the RenderViewImpl.
320 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; 324 scoped_refptr<BrowserPluginManager> browser_plugin_manager_;
321 325
322 // Important: Do not add more history state here. 326 // Important: Do not add more history state here.
323 // We strongly discourage storing additional history state (such as page IDs) 327 // We strongly discourage storing additional history state (such as page IDs)
324 // in the embedder process, at the risk of having incorrect information that 328 // in the embedder process, at the risk of having incorrect information that
325 // can lead to broken back/forward logic in apps. 329 // can lead to broken back/forward logic in apps.
326 // It's also important that this state does not get modified by any logic in 330 // It's also important that this state does not get modified by any logic in
327 // the embedder process. It should only be updated in response to navigation 331 // the embedder process. It should only be updated in response to navigation
328 // events in the guest. No assumptions should be made about how the index 332 // events in the guest. No assumptions should be made about how the index
329 // will change after a navigation (e.g., for back, forward, or go), because 333 // will change after a navigation (e.g., for back, forward, or go), because
330 // the changes are not always obvious. For example, there is a maximum 334 // the changes are not always obvious. For example, there is a maximum
331 // number of entries and earlier ones will automatically be pruned. 335 // number of entries and earlier ones will automatically be pruned.
332 int current_nav_entry_index_; 336 int current_nav_entry_index_;
333 int nav_entry_count_; 337 int nav_entry_count_;
334 338
335 // Used for HW compositing. 339 // Used for HW compositing.
336 bool compositing_enabled_; 340 bool compositing_enabled_;
337 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_; 341 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_;
338 342
339 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); 343 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
340 }; 344 };
341 345
342 } // namespace content 346 } // namespace content
343 347
344 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 348 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
OLDNEW
« no previous file with comments | « content/common/browser_plugin_messages.h ('k') | content/renderer/browser_plugin/browser_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698