| 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 #include "content/common/browser_plugin_messages.h" | 9 #include "content/common/browser_plugin_messages.h" |
| 10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 std::string BrowserPlugin::GetSrcAttribute() const { | 86 std::string BrowserPlugin::GetSrcAttribute() const { |
| 87 return src_; | 87 return src_; |
| 88 } | 88 } |
| 89 | 89 |
| 90 void BrowserPlugin::SetSrcAttribute(const std::string& src) { | 90 void BrowserPlugin::SetSrcAttribute(const std::string& src) { |
| 91 if (src == src_ && !guest_crashed_) | 91 if (src == src_ && !guest_crashed_) |
| 92 return; | 92 return; |
| 93 if (!src.empty()) { | 93 if (!src.empty()) { |
| 94 BrowserPluginManager::Get()->Send( | 94 BrowserPluginManager::Get()->Send( |
| 95 new BrowserPluginHostMsg_NavigateOrCreateGuest( | 95 new BrowserPluginHostMsg_NavigateGuest( |
| 96 render_view_->GetRoutingID(), | 96 render_view_->GetRoutingID(), |
| 97 instance_id_, | 97 instance_id_, |
| 98 parent_frame_, | 98 parent_frame_, |
| 99 src)); | 99 src, |
| 100 gfx::Size(width(), height()))); |
| 100 } | 101 } |
| 101 src_ = src; | 102 src_ = src; |
| 102 guest_crashed_ = false; | 103 guest_crashed_ = false; |
| 103 } | 104 } |
| 104 | 105 |
| 105 bool BrowserPlugin::ParseSrcAttribute( | 106 bool BrowserPlugin::ParseSrcAttribute( |
| 106 const WebKit::WebPluginParams& params, | 107 const WebKit::WebPluginParams& params, |
| 107 std::string* src) { | 108 std::string* src) { |
| 108 // Get the src attribute from the attributes vector | 109 // Get the src attribute from the attributes vector |
| 109 for (unsigned i = 0; i < params.attributeNames.size(); ++i) { | 110 for (unsigned i = 0; i < params.attributeNames.size(); ++i) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 const WebRect& window_rect, | 323 const WebRect& window_rect, |
| 323 const WebRect& clip_rect, | 324 const WebRect& clip_rect, |
| 324 const WebVector<WebRect>& cut_outs_rects, | 325 const WebVector<WebRect>& cut_outs_rects, |
| 325 bool is_visible) { | 326 bool is_visible) { |
| 326 int old_width = width(); | 327 int old_width = width(); |
| 327 int old_height = height(); | 328 int old_height = height(); |
| 328 plugin_rect_ = window_rect; | 329 plugin_rect_ = window_rect; |
| 329 if (old_width == window_rect.width && | 330 if (old_width == window_rect.width && |
| 330 old_height == window_rect.height) | 331 old_height == window_rect.height) |
| 331 return; | 332 return; |
| 333 // TODO(fsamuel): Check if this is correct: When src is not set, we shouldn't |
| 334 // send UpdateRect messages to the host. |
| 335 if (src_.empty()) |
| 336 return; |
| 332 | 337 |
| 333 const size_t stride = skia::PlatformCanvas::StrideForWidth(window_rect.width); | 338 const size_t stride = skia::PlatformCanvas::StrideForWidth(window_rect.width); |
| 334 const size_t size = window_rect.height * | 339 const size_t size = window_rect.height * |
| 335 stride * | 340 stride * |
| 336 GetDeviceScaleFactor() * | 341 GetDeviceScaleFactor() * |
| 337 GetDeviceScaleFactor(); | 342 GetDeviceScaleFactor(); |
| 338 | 343 |
| 339 // Don't drop the old damage buffer until after we've made sure that the | 344 // Don't drop the old damage buffer until after we've made sure that the |
| 340 // browser process has dropped it. | 345 // browser process has dropped it. |
| 341 TransportDIB* new_damage_buffer = | 346 TransportDIB* new_damage_buffer = |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 void* notify_data) { | 417 void* notify_data) { |
| 413 } | 418 } |
| 414 | 419 |
| 415 void BrowserPlugin::didFailLoadingFrameRequest( | 420 void BrowserPlugin::didFailLoadingFrameRequest( |
| 416 const WebKit::WebURL& url, | 421 const WebKit::WebURL& url, |
| 417 void* notify_data, | 422 void* notify_data, |
| 418 const WebKit::WebURLError& error) { | 423 const WebKit::WebURLError& error) { |
| 419 } | 424 } |
| 420 | 425 |
| 421 } // namespace content | 426 } // namespace content |
| OLD | NEW |