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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_IMPL_H_ |
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_IMPL_H_ | 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 class BrowserPluginCompositingHelper; | 31 class BrowserPluginCompositingHelper; |
32 class BrowserPluginManager; | 32 class BrowserPluginManager; |
33 class BrowserPluginObserver; | 33 class BrowserPluginObserver; |
34 class MockBrowserPlugin; | 34 class MockBrowserPlugin; |
35 | 35 |
36 class CONTENT_EXPORT BrowserPluginImpl : | 36 class CONTENT_EXPORT BrowserPluginImpl : |
37 NON_EXPORTED_BASE(public WebKit::WebPlugin), | 37 NON_EXPORTED_BASE(public WebKit::WebPlugin), |
38 public BrowserPlugin { | 38 public BrowserPlugin { |
39 public: | 39 public: |
40 RenderViewImpl* render_view() const { return render_view_.get(); } | |
41 int render_view_routing_id() const { return render_view_routing_id_; } | |
42 | |
43 bool OnMessageReceived(const IPC::Message& msg); | 40 bool OnMessageReceived(const IPC::Message& msg); |
44 | 41 |
45 // Get the name attribute value. | 42 // Get the name attribute value. |
46 std::string GetNameAttribute() const; | 43 std::string GetNameAttribute() const; |
47 // Parse the name attribute value. | 44 // Parse the name attribute value. |
48 void ParseNameAttribute(); | 45 void ParseNameAttribute(); |
49 // Get the src attribute value of the BrowserPlugin instance. | 46 // Get the src attribute value of the BrowserPlugin instance. |
50 std::string GetSrcAttribute() const; | 47 std::string GetSrcAttribute() const; |
51 // Parse the src attribute value of the BrowserPlugin instance. | 48 // Parse the src attribute value of the BrowserPlugin instance. |
52 bool ParseSrcAttribute(std::string* error_message); | 49 bool ParseSrcAttribute(std::string* error_message); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 84 |
88 // Query whether the guest can navigate back to the previous entry. | 85 // Query whether the guest can navigate back to the previous entry. |
89 bool CanGoBack() const; | 86 bool CanGoBack() const; |
90 // Query whether the guest can navigation forward to the next entry. | 87 // Query whether the guest can navigation forward to the next entry. |
91 bool CanGoForward() const; | 88 bool CanGoForward() const; |
92 | 89 |
93 // Informs the guest of an updated focus state. | 90 // Informs the guest of an updated focus state. |
94 void UpdateGuestFocusState(); | 91 void UpdateGuestFocusState(); |
95 // Indicates whether the guest should be focused. | 92 // Indicates whether the guest should be focused. |
96 bool ShouldGuestBeFocused() const; | 93 bool ShouldGuestBeFocused() const; |
97 | |
98 // Tells the BrowserPlugin to tell the guest to navigate to the previous | |
99 // navigation entry in the navigation history. | |
100 void Back(); | |
101 // Tells the BrowserPlugin to tell the guest to navigate to the next | |
102 // navigation entry in the navigation history. | |
103 void Forward(); | |
104 // Tells the BrowserPlugin to tell the guest to navigate to a position | |
105 // relative to the current index in its navigation history. | |
106 void Go(int relativeIndex); | |
107 // Tells the BrowserPlugin to terminate the guest process. | 94 // Tells the BrowserPlugin to terminate the guest process. |
108 void TerminateGuest(); | 95 void TerminateGuest(); |
109 | 96 |
110 // A request from JavaScript has been made to stop the loading of the page. | 97 // A request from JavaScript has been made to stop the loading of the page. |
111 void Stop(); | 98 void Stop(); |
112 // A request from JavaScript has been made to reload the page. | 99 // A request from JavaScript has been made to reload the page. |
113 void Reload(); | 100 void Reload(); |
114 // A request to enable hardware compositing. | 101 // A request to enable hardware compositing. |
115 void EnableCompositing(bool enable); | 102 void EnableCompositing(bool enable); |
116 // A request from content client to track lifetime of a JavaScript object | 103 // A request from content client to track lifetime of a JavaScript object |
117 // related to a permission request object. | 104 // related to a permission request object. |
118 // This is used to clean up hanging permission request objects. | 105 // This is used to clean up hanging permission request objects. |
119 void PersistRequestObject(const NPVariant* request, | 106 void PersistRequestObject(const NPVariant* request, |
120 const std::string& type, | 107 const std::string& type, |
121 int id); | 108 int id); |
122 | 109 |
123 // Returns true if |point| lies within the bounds of the plugin rectangle. | 110 // Returns true if |point| lies within the bounds of the plugin rectangle. |
124 // Not OK to use this function for making security-sensitive decision since it | 111 // Not OK to use this function for making security-sensitive decision since it |
125 // can return false positives when the plugin has rotation transformation | 112 // can return false positives when the plugin has rotation transformation |
126 // applied. | 113 // applied. |
127 bool InBounds(const gfx::Point& point) const; | 114 bool InBounds(const gfx::Point& point) const; |
128 | 115 |
129 gfx::Point ToLocalCoordinates(const gfx::Point& point) const; | 116 gfx::Point ToLocalCoordinates(const gfx::Point& point) const; |
130 // Called by browser plugin binding. | 117 // Called by browser plugin binding. |
131 void OnEmbedderDecidedPermission(int request_id, bool allow); | 118 void OnEmbedderDecidedPermission(int request_id, bool allow); |
132 | 119 |
133 | 120 |
134 // BrowserPlugin implementation. | 121 // BrowserPlugin implementation. |
135 virtual RenderView* GetRenderView() const OVERRIDE; | |
136 virtual WebKit::WebPluginContainer* GetContainer() const OVERRIDE; | |
137 virtual void AddMethodBinding( | 122 virtual void AddMethodBinding( |
138 BrowserPluginMethodBinding* method_binding) OVERRIDE; | 123 BrowserPluginMethodBinding* method_binding) OVERRIDE; |
139 virtual void AddPropertyBinding( | 124 virtual void AddPropertyBinding( |
140 BrowserPluginPropertyBinding* method_binding) OVERRIDE; | 125 BrowserPluginPropertyBinding* method_binding) OVERRIDE; |
| 126 virtual RenderView* GetRenderView() const OVERRIDE; |
| 127 virtual int GetRoutingID() const OVERRIDE; |
| 128 virtual WebKit::WebPluginContainer* GetContainer() const OVERRIDE; |
141 virtual void TriggerEvent( | 129 virtual void TriggerEvent( |
142 const std::string& event_name, | 130 const std::string& event_name, |
143 std::map<std::string, base::Value*>* props) OVERRIDE; | 131 std::map<std::string, base::Value*>* props) OVERRIDE; |
144 virtual void UpdateDOMAttribute(const std::string& attribute_name, | 132 virtual void UpdateDOMAttribute(const std::string& attribute_name, |
145 const std::string& attribute_value) OVERRIDE; | 133 const std::string& attribute_value) OVERRIDE; |
146 virtual void RemoveDOMAttribute(const std::string& attribute_name) OVERRIDE; | 134 virtual void RemoveDOMAttribute(const std::string& attribute_name) OVERRIDE; |
147 virtual std::string GetDOMAttributeValue( | 135 virtual std::string GetDOMAttributeValue( |
148 const std::string& attribute_name) const OVERRIDE; | 136 const std::string& attribute_name) const OVERRIDE; |
149 virtual bool HasDOMAttribute( | 137 virtual bool HasDOMAttribute( |
150 const std::string& attribute_name) const OVERRIDE; | 138 const std::string& attribute_name) const OVERRIDE; |
151 virtual bool HasNavigated() const OVERRIDE; | 139 virtual bool HasGuest() const OVERRIDE; |
152 | 140 |
153 // IPC::Sender implementation. | 141 // IPC::Sender implementation. |
154 virtual bool Send(IPC::Message* message) OVERRIDE; | 142 virtual bool Send(IPC::Message* message) OVERRIDE; |
155 | 143 |
156 // WebKit::WebPlugin implementation. | 144 // WebKit::WebPlugin implementation. |
157 virtual WebKit::WebPluginContainer* container() const OVERRIDE; | 145 virtual WebKit::WebPluginContainer* container() const OVERRIDE; |
158 virtual bool initialize(WebKit::WebPluginContainer* container) OVERRIDE; | 146 virtual bool initialize(WebKit::WebPluginContainer* container) OVERRIDE; |
159 virtual void destroy() OVERRIDE; | 147 virtual void destroy() OVERRIDE; |
160 virtual NPObject* scriptableObject() OVERRIDE; | 148 virtual NPObject* scriptableObject() OVERRIDE; |
161 virtual bool supportsKeyboardFocus() const OVERRIDE; | 149 virtual bool supportsKeyboardFocus() const OVERRIDE; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 scoped_ptr<base::SharedMemory> current_damage_buffer_; | 343 scoped_ptr<base::SharedMemory> current_damage_buffer_; |
356 scoped_ptr<base::SharedMemory> pending_damage_buffer_; | 344 scoped_ptr<base::SharedMemory> pending_damage_buffer_; |
357 uint32 damage_buffer_sequence_id_; | 345 uint32 damage_buffer_sequence_id_; |
358 bool resize_ack_received_; | 346 bool resize_ack_received_; |
359 gfx::Rect plugin_rect_; | 347 gfx::Rect plugin_rect_; |
360 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 348 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
361 SkBitmap* sad_guest_; | 349 SkBitmap* sad_guest_; |
362 bool guest_crashed_; | 350 bool guest_crashed_; |
363 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; | 351 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; |
364 // True if we have ever sent a NavigateGuest message to the embedder. | 352 // True if we have ever sent a NavigateGuest message to the embedder. |
365 bool navigate_src_sent_; | 353 bool guest_allocated_; |
366 bool auto_size_ack_pending_; | 354 bool auto_size_ack_pending_; |
367 int guest_process_id_; | 355 int guest_process_id_; |
368 int guest_route_id_; | 356 int guest_route_id_; |
369 std::string storage_partition_id_; | 357 std::string storage_partition_id_; |
370 bool persist_storage_; | 358 bool persist_storage_; |
371 bool valid_partition_id_; | 359 bool valid_partition_id_; |
372 int content_window_routing_id_; | 360 int content_window_routing_id_; |
373 bool plugin_focused_; | 361 bool plugin_focused_; |
374 // Tracks the visibility of the browser plugin regardless of the whole | 362 // Tracks the visibility of the browser plugin regardless of the whole |
375 // embedder RenderView's visibility. | 363 // embedder RenderView's visibility. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might | 408 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
421 // get called after BrowserPlugin has been destroyed. | 409 // get called after BrowserPlugin has been destroyed. |
422 base::WeakPtrFactory<BrowserPluginImpl> weak_ptr_factory_; | 410 base::WeakPtrFactory<BrowserPluginImpl> weak_ptr_factory_; |
423 | 411 |
424 DISALLOW_COPY_AND_ASSIGN(BrowserPluginImpl); | 412 DISALLOW_COPY_AND_ASSIGN(BrowserPluginImpl); |
425 }; | 413 }; |
426 | 414 |
427 } // namespace content | 415 } // namespace content |
428 | 416 |
429 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_IMPL_H_ | 417 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_IMPL_H_ |
OLD | NEW |