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 28 matching lines...) Expand all Loading... |
39 public MouseLockDispatcher::LockTarget { | 39 public MouseLockDispatcher::LockTarget { |
40 public: | 40 public: |
41 RenderViewImpl* render_view() const { return render_view_.get(); } | 41 RenderViewImpl* render_view() const { return render_view_.get(); } |
42 int render_view_routing_id() const { return render_view_routing_id_; } | 42 int render_view_routing_id() const { return render_view_routing_id_; } |
43 int guest_instance_id() const { return guest_instance_id_; } | 43 int guest_instance_id() const { return guest_instance_id_; } |
44 bool attached() const { return attached_; } | 44 bool attached() const { return attached_; } |
45 BrowserPluginManager* browser_plugin_manager() const { | 45 BrowserPluginManager* browser_plugin_manager() const { |
46 return browser_plugin_manager_.get(); | 46 return browser_plugin_manager_.get(); |
47 } | 47 } |
48 | 48 |
49 static BrowserPlugin* FromContainer(blink::WebPluginContainer* container); | |
50 | |
51 bool OnMessageReceived(const IPC::Message& msg); | 49 bool OnMessageReceived(const IPC::Message& msg); |
52 | 50 |
53 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value | 51 // Update Browser Plugin's DOM Node attribute |attribute_name| with the value |
54 // |attribute_value|. | 52 // |attribute_value|. |
55 void UpdateDOMAttribute(const std::string& attribute_name, | 53 void UpdateDOMAttribute(const std::string& attribute_name, |
56 const std::string& attribute_value); | 54 const std::string& attribute_value); |
57 // Remove the DOM Node attribute with the name |attribute_name|. | 55 // Remove the DOM Node attribute with the name |attribute_name|. |
58 void RemoveDOMAttribute(const std::string& attribute_name); | 56 void RemoveDOMAttribute(const std::string& attribute_name); |
59 // Get Browser Plugin's DOM Node attribute |attribute_name|'s value. | 57 // Get Browser Plugin's DOM Node attribute |attribute_name|'s value. |
60 std::string GetDOMAttributeValue(const std::string& attribute_name) const; | 58 std::string GetDOMAttributeValue(const std::string& attribute_name) const; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Get the guest's DOMWindow proxy. | 100 // Get the guest's DOMWindow proxy. |
103 NPObject* GetContentWindow() const; | 101 NPObject* GetContentWindow() const; |
104 | 102 |
105 // Returns whether the guest process has crashed. | 103 // Returns whether the guest process has crashed. |
106 bool guest_crashed() const { return guest_crashed_; } | 104 bool guest_crashed() const { return guest_crashed_; } |
107 // Returns whether this BrowserPlugin has requested an instance ID. | 105 // Returns whether this BrowserPlugin has requested an instance ID. |
108 bool HasNavigated() const; | 106 bool HasNavigated() const; |
109 // Returns whether this BrowserPlugin has allocated an instance ID. | 107 // Returns whether this BrowserPlugin has allocated an instance ID. |
110 bool HasGuestInstanceID() const; | 108 bool HasGuestInstanceID() const; |
111 | 109 |
112 // Attaches the window identified by |window_id| to the the given node | |
113 // encapsulating a BrowserPlugin. | |
114 static bool AttachWindowTo(const blink::WebNode& node, | |
115 int window_id); | |
116 | |
117 // Informs the guest of an updated focus state. | 110 // Informs the guest of an updated focus state. |
118 void UpdateGuestFocusState(); | 111 void UpdateGuestFocusState(); |
119 // Indicates whether the guest should be focused. | 112 // Indicates whether the guest should be focused. |
120 bool ShouldGuestBeFocused() const; | 113 bool ShouldGuestBeFocused() const; |
121 | 114 |
122 // Embedder's device scale factor changed, we need to update the guest | 115 // Embedder's device scale factor changed, we need to update the guest |
123 // renderer. | 116 // renderer. |
124 void UpdateDeviceScaleFactor(float device_scale_factor); | 117 void UpdateDeviceScaleFactor(float device_scale_factor); |
125 | 118 |
126 // A request to enable hardware compositing. | 119 // A request to enable hardware compositing. |
127 void EnableCompositing(bool enable); | 120 void EnableCompositing(bool enable); |
128 | 121 |
129 // Called when a guest instance ID has been allocated by the browser process. | 122 // Called when a guest instance ID has been allocated by the browser process. |
130 void OnInstanceIDAllocated(int guest_instance_id); | 123 void OnInstanceIDAllocated(int guest_instance_id); |
131 // Provided that a guest instance ID has been allocated, this method attaches | 124 // Provided that a guest instance ID has been allocated, this method attaches |
132 // this BrowserPlugin instance to that guest. |extra_params| are parameters | 125 // this BrowserPlugin instance to that guest. |extra_params| are parameters |
133 // passed in by the content embedder to the browser process. | 126 // passed in by the content embedder to the browser process. |
134 void Attach(scoped_ptr<base::DictionaryValue> extra_params); | 127 void Attach(int guest_instance_id, |
| 128 scoped_ptr<base::DictionaryValue> extra_params); |
135 | 129 |
136 // Notify the plugin about a compositor commit so that frame ACKs could be | 130 // Notify the plugin about a compositor commit so that frame ACKs could be |
137 // sent, if needed. | 131 // sent, if needed. |
138 void DidCommitCompositorFrame(); | 132 void DidCommitCompositorFrame(); |
139 | 133 |
140 // Returns whether a message should be forwarded to BrowserPlugin. | 134 // Returns whether a message should be forwarded to BrowserPlugin. |
141 static bool ShouldForwardToBrowserPlugin(const IPC::Message& message); | 135 static bool ShouldForwardToBrowserPlugin(const IPC::Message& message); |
142 | 136 |
143 // blink::WebPlugin implementation. | 137 // blink::WebPlugin implementation. |
144 virtual blink::WebPluginContainer* container() const OVERRIDE; | 138 virtual blink::WebPluginContainer* container() const OVERRIDE; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might | 365 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
372 // get called after BrowserPlugin has been destroyed. | 366 // get called after BrowserPlugin has been destroyed. |
373 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 367 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
374 | 368 |
375 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 369 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
376 }; | 370 }; |
377 | 371 |
378 } // namespace content | 372 } // namespace content |
379 | 373 |
380 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 374 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |