| OLD | NEW |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // Set the maxwidth attribute value. | 53 // Set the maxwidth attribute value. |
| 54 void SetMaxWidthAttribute(int max_width); | 54 void SetMaxWidthAttribute(int max_width); |
| 55 // Get the minheight attribute value. | 55 // Get the minheight attribute value. |
| 56 int min_height_attribute() const { return min_height_; } | 56 int min_height_attribute() const { return min_height_; } |
| 57 // Set the minheight attribute value. | 57 // Set the minheight attribute value. |
| 58 void SetMinHeightAttribute(int minheight); | 58 void SetMinHeightAttribute(int minheight); |
| 59 // Get the minwidth attribute value. | 59 // Get the minwidth attribute value. |
| 60 int min_width_attribute() const { return min_width_; } | 60 int min_width_attribute() const { return min_width_; } |
| 61 // Set the minwidth attribute value. | 61 // Set the minwidth attribute value. |
| 62 void SetMinWidthAttribute(int minwidth); | 62 void SetMinWidthAttribute(int minwidth); |
| 63 bool InAutoSizeBounds(const gfx::Size& size) const; |
| 63 | 64 |
| 64 // Get the guest's DOMWindow proxy. | 65 // Get the guest's DOMWindow proxy. |
| 65 NPObject* GetContentWindow() const; | 66 NPObject* GetContentWindow() const; |
| 66 | 67 |
| 67 // Returns Chrome's process ID for the current guest. | 68 // Returns Chrome's process ID for the current guest. |
| 68 int process_id() const { return process_id_; } | 69 int process_id() const { return process_id_; } |
| 69 // The partition identifier string is stored as UTF-8. | 70 // The partition identifier string is stored as UTF-8. |
| 70 std::string GetPartitionAttribute() const; | 71 std::string GetPartitionAttribute() const; |
| 71 // Query whether the guest can navigate back to the previous entry. | 72 // Query whether the guest can navigate back to the previous entry. |
| 72 bool CanGoBack() const; | 73 bool CanGoBack() const; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 bool IsValidEvent(const std::string& event_name); | 227 bool IsValidEvent(const std::string& event_name); |
| 227 | 228 |
| 228 // Triggers the event-listeners for |event_name|. | 229 // Triggers the event-listeners for |event_name|. |
| 229 void TriggerEvent(const std::string& event_name, | 230 void TriggerEvent(const std::string& event_name, |
| 230 v8::Local<v8::Object>* event); | 231 v8::Local<v8::Object>* event); |
| 231 | 232 |
| 232 // Creates and maps transport dib. Overridden in tests. | 233 // Creates and maps transport dib. Overridden in tests. |
| 233 virtual TransportDIB* CreateTransportDIB(const size_t size); | 234 virtual TransportDIB* CreateTransportDIB(const size_t size); |
| 234 // Frees up the damage buffer. Overridden in tests. | 235 // Frees up the damage buffer. Overridden in tests. |
| 235 virtual void FreeDamageBuffer(); | 236 virtual void FreeDamageBuffer(); |
| 237 // Populates BrowserPluginHostMsg_ResizeGuest_Params with resize state and |
| 238 // returns the newly allocated TransportDIB. |
| 239 TransportDIB* PopulateResizeGuestParameters( |
| 240 BrowserPluginHostMsg_ResizeGuest_Params* params, |
| 241 int view_width, int view_height); |
| 236 | 242 |
| 237 // Populates BrowserPluginHostMsg_AutoSize_Params object with autosize state. | 243 // Populates BrowserPluginHostMsg_AutoSize_Params object with autosize state. |
| 238 void PopulateAutoSizeParameters( | 244 void PopulateAutoSizeParameters( |
| 239 BrowserPluginHostMsg_AutoSize_Params* params) const; | 245 BrowserPluginHostMsg_AutoSize_Params* params); |
| 246 |
| 240 // Informs the guest of an updated autosize state. | 247 // Informs the guest of an updated autosize state. |
| 241 void UpdateGuestAutoSizeState() const; | 248 void UpdateGuestAutoSizeState(); |
| 249 |
| 250 // Informs the BrowserPlugin that guest has changed its size in autosize mode. |
| 251 void SizeChangedDueToAutoSize(const gfx::Size& old_view_size); |
| 242 | 252 |
| 243 int instance_id_; | 253 int instance_id_; |
| 244 base::WeakPtr<RenderViewImpl> render_view_; | 254 base::WeakPtr<RenderViewImpl> render_view_; |
| 245 // We cache the |render_view_|'s routing ID because we need it on destruction. | 255 // We cache the |render_view_|'s routing ID because we need it on destruction. |
| 246 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed | 256 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed |
| 247 // then we will attempt to access a NULL pointer. | 257 // then we will attempt to access a NULL pointer. |
| 248 int render_view_routing_id_; | 258 int render_view_routing_id_; |
| 249 WebKit::WebPluginContainer* container_; | 259 WebKit::WebPluginContainer* container_; |
| 250 scoped_ptr<BrowserPluginBindings> bindings_; | 260 scoped_ptr<BrowserPluginBindings> bindings_; |
| 251 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 261 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 270 int content_window_routing_id_; | 280 int content_window_routing_id_; |
| 271 bool plugin_focused_; | 281 bool plugin_focused_; |
| 272 bool embedder_focused_; | 282 bool embedder_focused_; |
| 273 // Tracks the visibility of the browser plugin regardless of the whole | 283 // Tracks the visibility of the browser plugin regardless of the whole |
| 274 // embedder RenderView's visibility. | 284 // embedder RenderView's visibility. |
| 275 bool visible_; | 285 bool visible_; |
| 276 typedef std::vector<v8::Local<v8::Function> > EventListenersLocal; | 286 typedef std::vector<v8::Local<v8::Function> > EventListenersLocal; |
| 277 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 287 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
| 278 typedef std::map<std::string, EventListeners> EventListenerMap; | 288 typedef std::map<std::string, EventListeners> EventListenerMap; |
| 279 EventListenerMap event_listener_map_; | 289 EventListenerMap event_listener_map_; |
| 290 gfx::Size last_view_size_; |
| 291 bool size_changed_in_flight_; |
| 280 // Important: Do not add more history state here. | 292 // Important: Do not add more history state here. |
| 281 // We strongly discourage storing additional history state (such as page IDs) | 293 // We strongly discourage storing additional history state (such as page IDs) |
| 282 // in the embedder process, at the risk of having incorrect information that | 294 // in the embedder process, at the risk of having incorrect information that |
| 283 // can lead to broken back/forward logic in apps. | 295 // can lead to broken back/forward logic in apps. |
| 284 // It's also important that this state does not get modified by any logic in | 296 // It's also important that this state does not get modified by any logic in |
| 285 // the embedder process. It should only be updated in response to navigation | 297 // the embedder process. It should only be updated in response to navigation |
| 286 // events in the guest. No assumptions should be made about how the index | 298 // events in the guest. No assumptions should be made about how the index |
| 287 // will change after a navigation (e.g., for back, forward, or go), because | 299 // will change after a navigation (e.g., for back, forward, or go), because |
| 288 // the changes are not always obvious. For example, there is a maximum | 300 // the changes are not always obvious. For example, there is a maximum |
| 289 // number of entries and earlier ones will automatically be pruned. | 301 // number of entries and earlier ones will automatically be pruned. |
| 290 int current_nav_entry_index_; | 302 int current_nav_entry_index_; |
| 291 int nav_entry_count_; | 303 int nav_entry_count_; |
| 292 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 304 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 293 }; | 305 }; |
| 294 | 306 |
| 295 } // namespace content | 307 } // namespace content |
| 296 | 308 |
| 297 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 309 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |