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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 std::string BrowserPlugin::GetSrcAttribute() const { | 94 std::string BrowserPlugin::GetSrcAttribute() const { |
95 return src_; | 95 return src_; |
96 } | 96 } |
97 | 97 |
98 void BrowserPlugin::SetSrcAttribute(const std::string& src) { | 98 void BrowserPlugin::SetSrcAttribute(const std::string& src) { |
99 if (src == src_ && !guest_crashed_) | 99 if (src == src_ && !guest_crashed_) |
100 return; | 100 return; |
101 if (!src.empty() || navigate_src_sent_) { | 101 |
102 // If we haven't created the guest yet, do so now, if |src| is not empty and | |
103 // we will navigate it right after creation. If |src| is empty, we can delay | |
104 // the creation until we acutally need it. | |
105 if (!navigate_src_sent_ && !src.empty()) { | |
Fady Samuel
2012/09/25 19:22:40
You might need to update:
content/renderer/browse
nasko
2012/09/25 22:57:22
Done.
| |
106 BrowserPluginManager::Get()->Send( | |
107 new BrowserPluginHostMsg_CreateGuest( | |
108 render_view_->GetRoutingID(), | |
109 instance_id_, | |
110 parent_frame_, | |
111 storage_partition_id_, | |
112 persist_storage_)); | |
113 } | |
114 | |
115 if (navigate_src_sent_ || !src.empty()) { | |
102 BrowserPluginManager::Get()->Send( | 116 BrowserPluginManager::Get()->Send( |
103 new BrowserPluginHostMsg_NavigateGuest( | 117 new BrowserPluginHostMsg_NavigateGuest( |
104 render_view_->GetRoutingID(), | 118 render_view_->GetRoutingID(), |
105 instance_id_, | 119 instance_id_, |
106 parent_frame_, | 120 parent_frame_, |
107 src, | 121 src, |
108 gfx::Size(width(), height()))); | 122 gfx::Size(width(), height()))); |
109 // Record that we sent a NavigateGuest message to embedder. Once we send | 123 // Record that we sent a NavigateGuest message to embedder. Once we send |
110 // such a message, subsequent SetSrcAttribute() calls must always send | 124 // such a message, subsequent SetSrcAttribute() calls must always send |
111 // NavigateGuest messages to the embedder (even if |src| is empty), so | 125 // NavigateGuest messages to the embedder (even if |src| is empty), so |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
524 void* notify_data) { | 538 void* notify_data) { |
525 } | 539 } |
526 | 540 |
527 void BrowserPlugin::didFailLoadingFrameRequest( | 541 void BrowserPlugin::didFailLoadingFrameRequest( |
528 const WebKit::WebURL& url, | 542 const WebKit::WebURL& url, |
529 void* notify_data, | 543 void* notify_data, |
530 const WebKit::WebURLError& error) { | 544 const WebKit::WebURLError& error) { |
531 } | 545 } |
532 | 546 |
533 } // namespace content | 547 } // namespace content |
OLD | NEW |