| OLD | NEW |
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Returns whether this BrowserPlugin has requested an instance ID. | 99 // Returns whether this BrowserPlugin has requested an instance ID. |
| 100 bool HasNavigated() const; | 100 bool HasNavigated() const; |
| 101 // Returns whether this BrowserPlugin has allocated an instance ID. | 101 // Returns whether this BrowserPlugin has allocated an instance ID. |
| 102 bool HasGuestInstanceID() const; | 102 bool HasGuestInstanceID() const; |
| 103 | 103 |
| 104 // Attaches the window identified by |window_id| to the the given node | 104 // Attaches the window identified by |window_id| to the the given node |
| 105 // encapsulating a BrowserPlugin. | 105 // encapsulating a BrowserPlugin. |
| 106 static bool AttachWindowTo(const WebKit::WebNode& node, | 106 static bool AttachWindowTo(const WebKit::WebNode& node, |
| 107 int window_id); | 107 int window_id); |
| 108 | 108 |
| 109 // Query whether the guest can navigate back to the previous entry. | |
| 110 bool CanGoBack() const; | |
| 111 // Query whether the guest can navigation forward to the next entry. | |
| 112 bool CanGoForward() const; | |
| 113 | |
| 114 // Informs the guest of an updated focus state. | 109 // Informs the guest of an updated focus state. |
| 115 void UpdateGuestFocusState(); | 110 void UpdateGuestFocusState(); |
| 116 // Indicates whether the guest should be focused. | 111 // Indicates whether the guest should be focused. |
| 117 bool ShouldGuestBeFocused() const; | 112 bool ShouldGuestBeFocused() const; |
| 118 | 113 |
| 119 // Embedder's device scale factor changed, we need to update the guest | 114 // Embedder's device scale factor changed, we need to update the guest |
| 120 // renderer. | 115 // renderer. |
| 121 void UpdateDeviceScaleFactor(float device_scale_factor); | 116 void UpdateDeviceScaleFactor(float device_scale_factor); |
| 122 | 117 |
| 123 // Tells the BrowserPlugin to tell the guest to navigate to the previous | |
| 124 // navigation entry in the navigation history. | |
| 125 void Back(); | |
| 126 // Tells the BrowserPlugin to tell the guest to navigate to the next | |
| 127 // navigation entry in the navigation history. | |
| 128 void Forward(); | |
| 129 // Tells the BrowserPlugin to tell the guest to navigate to a position | |
| 130 // relative to the current index in its navigation history. | |
| 131 void Go(int relativeIndex); | |
| 132 // Tells the BrowserPlugin to terminate the guest process. | 118 // Tells the BrowserPlugin to terminate the guest process. |
| 133 void TerminateGuest(); | 119 void TerminateGuest(); |
| 134 | 120 |
| 135 // A request from JavaScript has been made to stop the loading of the page. | 121 // A request from JavaScript has been made to stop the loading of the page. |
| 136 void Stop(); | 122 void Stop(); |
| 137 // A request from JavaScript has been made to reload the page. | 123 // A request from JavaScript has been made to reload the page. |
| 138 void Reload(); | 124 void Reload(); |
| 139 // A request to enable hardware compositing. | 125 // A request to enable hardware compositing. |
| 140 void EnableCompositing(bool enable); | 126 void EnableCompositing(bool enable); |
| 141 // A request from content client to track lifetime of a JavaScript object | 127 // A request from content client to track lifetime of a JavaScript object |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 typedef std::pair<int, base::WeakPtr<BrowserPlugin> > | 412 typedef std::pair<int, base::WeakPtr<BrowserPlugin> > |
| 427 AliveV8PermissionRequestItem; | 413 AliveV8PermissionRequestItem; |
| 428 std::map<int, AliveV8PermissionRequestItem*> | 414 std::map<int, AliveV8PermissionRequestItem*> |
| 429 alive_v8_permission_request_objects_; | 415 alive_v8_permission_request_objects_; |
| 430 | 416 |
| 431 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to | 417 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to |
| 432 // store the BrowserPlugin's BrowserPluginManager in a member variable to | 418 // store the BrowserPlugin's BrowserPluginManager in a member variable to |
| 433 // avoid accessing the RenderViewImpl. | 419 // avoid accessing the RenderViewImpl. |
| 434 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; | 420 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; |
| 435 | 421 |
| 436 // Important: Do not add more history state here. | |
| 437 // We strongly discourage storing additional history state (such as page IDs) | |
| 438 // in the embedder process, at the risk of having incorrect information that | |
| 439 // can lead to broken back/forward logic in apps. | |
| 440 // It's also important that this state does not get modified by any logic in | |
| 441 // the embedder process. It should only be updated in response to navigation | |
| 442 // events in the guest. No assumptions should be made about how the index | |
| 443 // will change after a navigation (e.g., for back, forward, or go), because | |
| 444 // the changes are not always obvious. For example, there is a maximum | |
| 445 // number of entries and earlier ones will automatically be pruned. | |
| 446 int current_nav_entry_index_; | |
| 447 int nav_entry_count_; | |
| 448 | |
| 449 // Used for HW compositing. | 422 // Used for HW compositing. |
| 450 bool compositing_enabled_; | 423 bool compositing_enabled_; |
| 451 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_; | 424 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_; |
| 452 | 425 |
| 453 // Used to identify the plugin to WebBindings. | 426 // Used to identify the plugin to WebBindings. |
| 454 scoped_ptr<struct _NPP> npp_; | 427 scoped_ptr<struct _NPP> npp_; |
| 455 | 428 |
| 456 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might | 429 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
| 457 // get called after BrowserPlugin has been destroyed. | 430 // get called after BrowserPlugin has been destroyed. |
| 458 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 431 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
| 459 | 432 |
| 460 std::vector<EditCommand> edit_commands_; | 433 std::vector<EditCommand> edit_commands_; |
| 461 | 434 |
| 462 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 435 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 463 }; | 436 }; |
| 464 | 437 |
| 465 } // namespace content | 438 } // namespace content |
| 466 | 439 |
| 467 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 440 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |