| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 FreeDamageBuffer(); | 87 FreeDamageBuffer(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 std::string BrowserPlugin::GetSrcAttribute() const { | 90 std::string BrowserPlugin::GetSrcAttribute() const { |
| 91 return src_; | 91 return src_; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void BrowserPlugin::SetSrcAttribute(const std::string& src) { | 94 void BrowserPlugin::SetSrcAttribute(const std::string& src) { |
| 95 if (src == src_ && !guest_crashed_) | 95 if (src == src_ && !guest_crashed_) |
| 96 return; | 96 return; |
| 97 if (!src.empty() || navigate_src_sent_) { | 97 |
| 98 // If we haven't created the guest yet, do so now, if |src| is not empty and |
| 99 // we will navigate it right after creation. If |src| is empty, we can delay |
| 100 // the creation until we acutally need it. |
| 101 if (!navigate_src_sent_ && !src.empty()) { |
| 102 BrowserPluginManager::Get()->Send( |
| 103 new BrowserPluginHostMsg_CreateGuest( |
| 104 render_view_->GetRoutingID(), |
| 105 instance_id_, |
| 106 storage_partition_id_, |
| 107 persist_storage_)); |
| 108 } |
| 109 |
| 110 if (navigate_src_sent_ || !src.empty()) { |
| 98 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> params( | 111 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> params( |
| 99 GetPendingResizeParams()); | 112 GetPendingResizeParams()); |
| 100 DCHECK(!params->resize_pending); | 113 DCHECK(!params->resize_pending); |
| 114 |
| 101 BrowserPluginManager::Get()->Send( | 115 BrowserPluginManager::Get()->Send( |
| 102 new BrowserPluginHostMsg_NavigateGuest( | 116 new BrowserPluginHostMsg_NavigateGuest( |
| 103 render_view_->GetRoutingID(), | 117 render_view_->GetRoutingID(), |
| 104 instance_id_, | 118 instance_id_, |
| 105 src, | 119 src, |
| 106 *params)); | 120 *params)); |
| 107 // Record that we sent a NavigateGuest message to embedder. Once we send | 121 // Record that we sent a NavigateGuest message to embedder. Once we send |
| 108 // such a message, subsequent SetSrcAttribute() calls must always send | 122 // such a message, subsequent SetSrcAttribute() calls must always send |
| 109 // NavigateGuest messages to the embedder (even if |src| is empty), so | 123 // NavigateGuest messages to the embedder (even if |src| is empty), so |
| 110 // resize works correctly for all cases (e.g. The embedder can reset the | 124 // resize works correctly for all cases (e.g. The embedder can reset the |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 void* notify_data) { | 618 void* notify_data) { |
| 605 } | 619 } |
| 606 | 620 |
| 607 void BrowserPlugin::didFailLoadingFrameRequest( | 621 void BrowserPlugin::didFailLoadingFrameRequest( |
| 608 const WebKit::WebURL& url, | 622 const WebKit::WebURL& url, |
| 609 void* notify_data, | 623 void* notify_data, |
| 610 const WebKit::WebURLError& error) { | 624 const WebKit::WebURLError& error) { |
| 611 } | 625 } |
| 612 | 626 |
| 613 } // namespace content | 627 } // namespace content |
| OLD | NEW |