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 #include "content/renderer/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #if defined (OS_WIN) | 9 #if defined (OS_WIN) |
10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 // such a message, subsequent SetSrcAttribute() calls must always send | 130 // such a message, subsequent SetSrcAttribute() calls must always send |
131 // NavigateGuest messages to the embedder (even if |src| is empty), so | 131 // NavigateGuest messages to the embedder (even if |src| is empty), so |
132 // resize works correctly for all cases (e.g. The embedder can reset the | 132 // resize works correctly for all cases (e.g. The embedder can reset the |
133 // guest's |src| to empty value, resize and then set the |src| to a | 133 // guest's |src| to empty value, resize and then set the |src| to a |
134 // non-empty value). | 134 // non-empty value). |
135 // Additionally, once this instance has navigated, the storage partition | 135 // Additionally, once this instance has navigated, the storage partition |
136 // cannot be changed, so this value is used for enforcing this. | 136 // cannot be changed, so this value is used for enforcing this. |
137 navigate_src_sent_ = true; | 137 navigate_src_sent_ = true; |
138 } | 138 } |
139 src_ = src; | 139 src_ = src; |
140 guest_crashed_ = false; | |
141 } | 140 } |
142 | 141 |
143 std::string BrowserPlugin::GetPartitionAttribute() const { | 142 std::string BrowserPlugin::GetPartitionAttribute() const { |
144 std::string value; | 143 std::string value; |
145 if (persist_storage_) | 144 if (persist_storage_) |
146 value.append(kPersistPrefix); | 145 value.append(kPersistPrefix); |
147 | 146 |
148 value.append(storage_partition_id_); | 147 value.append(storage_partition_id_); |
149 return value; | 148 return value; |
150 } | 149 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 if (!navigate_src_sent_) | 258 if (!navigate_src_sent_) |
260 return; | 259 return; |
261 BrowserPluginManager::Get()->Send( | 260 BrowserPluginManager::Get()->Send( |
262 new BrowserPluginHostMsg_Stop(render_view_->GetRoutingID(), | 261 new BrowserPluginHostMsg_Stop(render_view_->GetRoutingID(), |
263 instance_id_)); | 262 instance_id_)); |
264 } | 263 } |
265 | 264 |
266 void BrowserPlugin::Reload() { | 265 void BrowserPlugin::Reload() { |
267 if (!navigate_src_sent_) | 266 if (!navigate_src_sent_) |
268 return; | 267 return; |
269 guest_crashed_ = false; | |
270 BrowserPluginManager::Get()->Send( | 268 BrowserPluginManager::Get()->Send( |
271 new BrowserPluginHostMsg_Reload(render_view_->GetRoutingID(), | 269 new BrowserPluginHostMsg_Reload(render_view_->GetRoutingID(), |
272 instance_id_)); | 270 instance_id_)); |
273 } | 271 } |
274 | 272 |
275 void BrowserPlugin::UpdateRect( | 273 void BrowserPlugin::UpdateRect( |
276 int message_id, | 274 int message_id, |
277 const BrowserPluginMsg_UpdateRect_Params& params) { | 275 const BrowserPluginMsg_UpdateRect_Params& params) { |
278 if (width() != params.view_size.width() || | 276 if (width() != params.view_size.width() || |
279 height() != params.view_size.height()) { | 277 height() != params.view_size.height()) { |
280 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateRect_ACK( | 278 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateRect_ACK( |
281 render_view_->GetRoutingID(), | 279 render_view_->GetRoutingID(), |
282 instance_id_, | 280 instance_id_, |
283 message_id, | 281 message_id, |
284 gfx::Size(width(), height()))); | 282 gfx::Size(width(), height()))); |
285 return; | 283 return; |
286 } | 284 } |
287 | 285 |
286 // If we're getting new pixels then a guest is available again. | |
287 guest_crashed_ = false; | |
Charlie Reis
2012/10/12 04:10:25
Wouldn't DidNavigate/LoadCommit be a better place
Fady Samuel
2012/10/12 17:33:06
Done.
| |
288 float backing_store_scale_factor = | 288 float backing_store_scale_factor = |
289 backing_store_.get() ? backing_store_->GetScaleFactor() : 1.0f; | 289 backing_store_.get() ? backing_store_->GetScaleFactor() : 1.0f; |
290 | 290 |
291 if (params.is_resize_ack || | 291 if (params.is_resize_ack || |
292 backing_store_scale_factor != params.scale_factor) { | 292 backing_store_scale_factor != params.scale_factor) { |
293 resize_pending_ = !params.is_resize_ack; | 293 resize_pending_ = !params.is_resize_ack; |
294 backing_store_.reset( | 294 backing_store_.reset( |
295 new BrowserPluginBackingStore(gfx::Size(width(), height()), | 295 new BrowserPluginBackingStore(gfx::Size(width(), height()), |
296 params.scale_factor)); | 296 params.scale_factor)); |
297 } | 297 } |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 void* notify_data) { | 757 void* notify_data) { |
758 } | 758 } |
759 | 759 |
760 void BrowserPlugin::didFailLoadingFrameRequest( | 760 void BrowserPlugin::didFailLoadingFrameRequest( |
761 const WebKit::WebURL& url, | 761 const WebKit::WebURL& url, |
762 void* notify_data, | 762 void* notify_data, |
763 const WebKit::WebURLError& error) { | 763 const WebKit::WebURLError& error) { |
764 } | 764 } |
765 | 765 |
766 } // namespace content | 766 } // namespace content |
OLD | NEW |