| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/plugins/renderer/webview_plugin.h" | 5 #include "components/plugins/renderer/webview_plugin.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (!delegate_) | 141 if (!delegate_) |
| 142 return v8::Local<v8::Object>(); | 142 return v8::Local<v8::Object>(); |
| 143 | 143 |
| 144 return delegate_->GetV8ScriptableObject(isolate); | 144 return delegate_->GetV8ScriptableObject(isolate); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void WebViewPlugin::UpdateAllLifecyclePhases() { | 147 void WebViewPlugin::UpdateAllLifecyclePhases() { |
| 148 web_view()->UpdateAllLifecyclePhases(); | 148 web_view()->UpdateAllLifecyclePhases(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool WebViewPlugin::IsErrorPlaceholder() { |
| 152 if (!delegate_) |
| 153 return false; |
| 154 return delegate_->IsErrorPlaceholder(); |
| 155 } |
| 156 |
| 151 void WebViewPlugin::Paint(WebCanvas* canvas, const WebRect& rect) { | 157 void WebViewPlugin::Paint(WebCanvas* canvas, const WebRect& rect) { |
| 152 gfx::Rect paint_rect = gfx::IntersectRects(rect_, rect); | 158 gfx::Rect paint_rect = gfx::IntersectRects(rect_, rect); |
| 153 if (paint_rect.IsEmpty()) | 159 if (paint_rect.IsEmpty()) |
| 154 return; | 160 return; |
| 155 | 161 |
| 156 base::AutoReset<bool> is_painting( | 162 base::AutoReset<bool> is_painting( |
| 157 &is_painting_, true); | 163 &is_painting_, true); |
| 158 | 164 |
| 159 paint_rect.Offset(-rect_.x(), -rect_.y()); | 165 paint_rect.Offset(-rect_.x(), -rect_.y()); |
| 160 | 166 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 if (!delegate_) | 365 if (!delegate_) |
| 360 return; | 366 return; |
| 361 | 367 |
| 362 // The delegate may instantiate a new plugin. | 368 // The delegate may instantiate a new plugin. |
| 363 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 369 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 364 // The delegate may have dirtied style and layout of the WebView. | 370 // The delegate may have dirtied style and layout of the WebView. |
| 365 // See for example the resizePoster function in plugin_poster.html. | 371 // See for example the resizePoster function in plugin_poster.html. |
| 366 // Run the lifecycle now so that it is clean. | 372 // Run the lifecycle now so that it is clean. |
| 367 web_view()->UpdateAllLifecyclePhases(); | 373 web_view()->UpdateAllLifecyclePhases(); |
| 368 } | 374 } |
| OLD | NEW |