| 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 16 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 244 // IPC message handlers. | 243 // IPC message handlers. |
| 245 // Please keep in alphabetical order. | 244 // Please keep in alphabetical order. |
| 246 void OnAdvanceFocus(int instance_id, bool reverse); | 245 void OnAdvanceFocus(int instance_id, bool reverse); |
| 246 void OnAllocateInstanceIDResponse(int request_id, int instance_id); |
| 247 void OnBuffersSwapped(int instance_id, | 247 void OnBuffersSwapped(int instance_id, |
| 248 const gfx::Size& size, | 248 const gfx::Size& size, |
| 249 std::string mailbox_name, | 249 std::string mailbox_name, |
| 250 int gpu_route_id, | 250 int gpu_route_id, |
| 251 int gpu_host_id); | 251 int gpu_host_id); |
| 252 void OnGuestContentWindowReady(int instance_id, | 252 void OnGuestContentWindowReady(int instance_id, |
| 253 int content_window_routing_id); | 253 int content_window_routing_id); |
| 254 void OnGuestGone(int instance_id, int process_id, int status); | 254 void OnGuestGone(int instance_id, int process_id, int status); |
| 255 void OnGuestResponsive(int instance_id, int process_id); | 255 void OnGuestResponsive(int instance_id, int process_id); |
| 256 void OnGuestUnresponsive(int instance_id, int process_id); | 256 void OnGuestUnresponsive(int instance_id, int process_id); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 bool plugin_focused_; | 306 bool plugin_focused_; |
| 307 // Tracks the visibility of the browser plugin regardless of the whole | 307 // Tracks the visibility of the browser plugin regardless of the whole |
| 308 // embedder RenderView's visibility. | 308 // embedder RenderView's visibility. |
| 309 bool visible_; | 309 bool visible_; |
| 310 std::string name_; | 310 std::string name_; |
| 311 | 311 |
| 312 WebCursor cursor_; | 312 WebCursor cursor_; |
| 313 | 313 |
| 314 gfx::Size last_view_size_; | 314 gfx::Size last_view_size_; |
| 315 bool size_changed_in_flight_; | 315 bool size_changed_in_flight_; |
| 316 bool allocate_instance_id_in_flight_; |
| 316 | 317 |
| 317 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to | 318 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to |
| 318 // store the BrowserPlugin's BrowserPluginManager in a member variable to | 319 // store the BrowserPlugin's BrowserPluginManager in a member variable to |
| 319 // avoid accessing the RenderViewImpl. | 320 // avoid accessing the RenderViewImpl. |
| 320 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; | 321 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; |
| 321 | 322 |
| 322 // Important: Do not add more history state here. | 323 // Important: Do not add more history state here. |
| 323 // We strongly discourage storing additional history state (such as page IDs) | 324 // We strongly discourage storing additional history state (such as page IDs) |
| 324 // in the embedder process, at the risk of having incorrect information that | 325 // in the embedder process, at the risk of having incorrect information that |
| 325 // can lead to broken back/forward logic in apps. | 326 // 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 | 327 // 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 | 328 // 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 | 329 // 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 | 330 // 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 | 331 // the changes are not always obvious. For example, there is a maximum |
| 331 // number of entries and earlier ones will automatically be pruned. | 332 // number of entries and earlier ones will automatically be pruned. |
| 332 int current_nav_entry_index_; | 333 int current_nav_entry_index_; |
| 333 int nav_entry_count_; | 334 int nav_entry_count_; |
| 334 | 335 |
| 335 // Used for HW compositing. | 336 // Used for HW compositing. |
| 336 bool compositing_enabled_; | 337 bool compositing_enabled_; |
| 337 scoped_ptr<BrowserPluginCompositingHelper> compositing_helper_; | 338 scoped_ptr<BrowserPluginCompositingHelper> compositing_helper_; |
| 338 | 339 |
| 339 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 340 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 340 }; | 341 }; |
| 341 | 342 |
| 342 } // namespace content | 343 } // namespace content |
| 343 | 344 |
| 344 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 345 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |