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

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

Issue 299753011: Move allocate instance id to chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refactor one method, Created 6 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // Get Browser Plugin's DOM Node attribute |attribute_name|'s value. 53 // Get Browser Plugin's DOM Node attribute |attribute_name|'s value.
54 std::string GetDOMAttributeValue(const std::string& attribute_name) const; 54 std::string GetDOMAttributeValue(const std::string& attribute_name) const;
55 // Checks if the attribute |attribute_name| exists in the DOM. 55 // Checks if the attribute |attribute_name| exists in the DOM.
56 bool HasDOMAttribute(const std::string& attribute_name) const; 56 bool HasDOMAttribute(const std::string& attribute_name) const;
57 57
58 // Get the allowtransparency attribute value. 58 // Get the allowtransparency attribute value.
59 bool GetAllowTransparencyAttribute() const; 59 bool GetAllowTransparencyAttribute() const;
60 // Parse the allowtransparency attribute and adjust transparency of 60 // Parse the allowtransparency attribute and adjust transparency of
61 // BrowserPlugin accordingly. 61 // BrowserPlugin accordingly.
62 void ParseAllowTransparencyAttribute(); 62 void ParseAllowTransparencyAttribute();
63 // Get the src attribute value of the BrowserPlugin instance.
64 std::string GetSrcAttribute() const;
65 // Parse the src attribute value of the BrowserPlugin instance.
66 bool ParseSrcAttribute(std::string* error_message);
67 // Get the autosize attribute value. 63 // Get the autosize attribute value.
68 bool GetAutoSizeAttribute() const; 64 bool GetAutoSizeAttribute() const;
69 // Parses the autosize attribute value. 65 // Parses the autosize attribute value.
70 void ParseAutoSizeAttribute(); 66 void ParseAutoSizeAttribute();
71 // Get the maxheight attribute value. 67 // Get the maxheight attribute value.
72 int GetMaxHeightAttribute() const; 68 int GetMaxHeightAttribute() const;
73 // Get the maxwidth attribute value. 69 // Get the maxwidth attribute value.
74 int GetMaxWidthAttribute() const; 70 int GetMaxWidthAttribute() const;
75 // Get the minheight attribute value. 71 // Get the minheight attribute value.
76 int GetMinHeightAttribute() const; 72 int GetMinHeightAttribute() const;
77 // Get the minwidth attribute value. 73 // Get the minwidth attribute value.
78 int GetMinWidthAttribute() const; 74 int GetMinWidthAttribute() const;
79 // Parse the minwidth, maxwidth, minheight, and maxheight attribute values. 75 // Parse the minwidth, maxwidth, minheight, and maxheight attribute values.
80 void ParseSizeContraintsChanged(); 76 void ParseSizeContraintsChanged();
81 // The partition identifier string is stored as UTF-8.
82 std::string GetPartitionAttribute() const;
83 // This method can be successfully called only before the first navigation for
84 // this instance of BrowserPlugin. If an error occurs, the |error_message| is
85 // set appropriately to indicate the failure reason.
86 bool ParsePartitionAttribute(std::string* error_message);
87 // True if the partition attribute can be removed. 77 // True if the partition attribute can be removed.
88 bool CanRemovePartitionAttribute(std::string* error_message); 78 bool CanRemovePartitionAttribute(std::string* error_message);
89 79
90 bool InAutoSizeBounds(const gfx::Size& size) const; 80 bool InAutoSizeBounds(const gfx::Size& size) const;
91 81
92 // Get the guest's DOMWindow proxy. 82 // Get the guest's DOMWindow proxy.
93 NPObject* GetContentWindow() const; 83 NPObject* GetContentWindow() const;
94 84
95 // Returns whether the guest process has crashed. 85 // Returns whether the guest process has crashed.
96 bool guest_crashed() const { return guest_crashed_; } 86 bool guest_crashed() const { return guest_crashed_; }
97 // Returns whether this BrowserPlugin has requested an instance ID.
98 bool HasNavigated() const;
99 // Returns whether this BrowserPlugin has allocated an instance ID. 87 // Returns whether this BrowserPlugin has allocated an instance ID.
100 bool HasGuestInstanceID() const; 88 bool HasGuestInstanceID() const;
101 89
102 // Informs the guest of an updated focus state. 90 // Informs the guest of an updated focus state.
103 void UpdateGuestFocusState(); 91 void UpdateGuestFocusState();
104 // Indicates whether the guest should be focused. 92 // Indicates whether the guest should be focused.
105 bool ShouldGuestBeFocused() const; 93 bool ShouldGuestBeFocused() const;
106 94
107 // Embedder's device scale factor changed, we need to update the guest 95 // Embedder's device scale factor changed, we need to update the guest
108 // renderer. 96 // renderer.
109 void UpdateDeviceScaleFactor(float device_scale_factor); 97 void UpdateDeviceScaleFactor(float device_scale_factor);
110 98
111 // A request to enable hardware compositing. 99 // A request to enable hardware compositing.
112 void EnableCompositing(bool enable); 100 void EnableCompositing(bool enable);
113 101
114 // Called when a guest instance ID has been allocated by the browser process.
115 void OnInstanceIDAllocated(int guest_instance_id);
116 // Provided that a guest instance ID has been allocated, this method attaches 102 // Provided that a guest instance ID has been allocated, this method attaches
117 // this BrowserPlugin instance to that guest. |extra_params| are parameters 103 // this BrowserPlugin instance to that guest. |extra_params| are parameters
118 // passed in by the content embedder to the browser process. 104 // passed in by the content embedder to the browser process.
119 void Attach(int guest_instance_id, 105 void Attach(int guest_instance_id,
120 scoped_ptr<base::DictionaryValue> extra_params); 106 scoped_ptr<base::DictionaryValue> extra_params);
121 107
122 // Notify the plugin about a compositor commit so that frame ACKs could be 108 // Notify the plugin about a compositor commit so that frame ACKs could be
123 // sent, if needed. 109 // sent, if needed.
124 void DidCommitCompositorFrame(); 110 void DidCommitCompositorFrame();
125 111
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Gets the Min Height value used for auto size. 202 // Gets the Min Height value used for auto size.
217 int GetAdjustedMinHeight() const; 203 int GetAdjustedMinHeight() const;
218 // Gets the Min Width value used for auto size. 204 // Gets the Min Width value used for auto size.
219 int GetAdjustedMinWidth() const; 205 int GetAdjustedMinWidth() const;
220 206
221 // Virtual to allow for mocking in tests. 207 // Virtual to allow for mocking in tests.
222 virtual float GetDeviceScaleFactor() const; 208 virtual float GetDeviceScaleFactor() const;
223 209
224 void ShowSadGraphic(); 210 void ShowSadGraphic();
225 211
226 // Parses the attributes of the browser plugin from the element's attributes
227 // and sets them appropriately.
228 void ParseAttributes();
229
230 // Triggers the event-listeners for |event_name|. Note that the function 212 // Triggers the event-listeners for |event_name|. Note that the function
231 // frees all the values in |props|. 213 // frees all the values in |props|.
232 void TriggerEvent(const std::string& event_name, 214 void TriggerEvent(const std::string& event_name,
233 std::map<std::string, base::Value*>* props); 215 std::map<std::string, base::Value*>* props);
234 216
235 // Populates BrowserPluginHostMsg_ResizeGuest_Params with resize state. 217 // Populates BrowserPluginHostMsg_ResizeGuest_Params with resize state.
236 void PopulateResizeGuestParameters( 218 void PopulateResizeGuestParameters(
237 BrowserPluginHostMsg_ResizeGuest_Params* params, 219 BrowserPluginHostMsg_ResizeGuest_Params* params,
238 const gfx::Rect& view_size, 220 const gfx::Rect& view_size,
239 bool needs_repaint); 221 bool needs_repaint);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 bool paint_ack_received_; 272 bool paint_ack_received_;
291 gfx::Rect plugin_rect_; 273 gfx::Rect plugin_rect_;
292 float last_device_scale_factor_; 274 float last_device_scale_factor_;
293 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. 275 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer.
294 SkBitmap* sad_guest_; 276 SkBitmap* sad_guest_;
295 bool guest_crashed_; 277 bool guest_crashed_;
296 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; 278 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_;
297 bool is_auto_size_state_dirty_; 279 bool is_auto_size_state_dirty_;
298 // Maximum size constraint for autosize. 280 // Maximum size constraint for autosize.
299 gfx::Size max_auto_size_; 281 gfx::Size max_auto_size_;
300 std::string storage_partition_id_;
301 bool persist_storage_;
302 bool valid_partition_id_;
303 int content_window_routing_id_; 282 int content_window_routing_id_;
304 bool plugin_focused_; 283 bool plugin_focused_;
305 // Tracks the visibility of the browser plugin regardless of the whole 284 // Tracks the visibility of the browser plugin regardless of the whole
306 // embedder RenderView's visibility. 285 // embedder RenderView's visibility.
307 bool visible_; 286 bool visible_;
308 287
309 const bool auto_navigate_; 288 const bool auto_navigate_;
310 std::string html_string_; 289 std::string html_string_;
311 290
312 WebCursor cursor_; 291 WebCursor cursor_;
313 292
314 gfx::Size last_view_size_; 293 gfx::Size last_view_size_;
315 bool before_first_navigation_;
316 bool mouse_locked_; 294 bool mouse_locked_;
317 295
318 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to 296 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to
319 // store the BrowserPlugin's BrowserPluginManager in a member variable to 297 // store the BrowserPlugin's BrowserPluginManager in a member variable to
320 // avoid accessing the RenderViewImpl. 298 // avoid accessing the RenderViewImpl.
321 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; 299 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_;
322 300
323 // Used for HW compositing. 301 // Used for HW compositing.
324 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; 302 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
325 303
326 // Used to identify the plugin to WebBindings. 304 // Used to identify the plugin to WebBindings.
327 scoped_ptr<struct _NPP> npp_; 305 scoped_ptr<struct _NPP> npp_;
328 306
329 // URL for the embedder frame. 307 // URL for the embedder frame.
330 const GURL embedder_frame_url_; 308 const GURL embedder_frame_url_;
331 309
332 std::vector<EditCommand> edit_commands_; 310 std::vector<EditCommand> edit_commands_;
333 311
334 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might 312 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might
335 // get called after BrowserPlugin has been destroyed. 313 // get called after BrowserPlugin has been destroyed.
336 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; 314 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_;
337 315
338 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); 316 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
339 }; 317 };
340 318
341 } // namespace content 319 } // namespace content
342 320
343 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 321 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698