| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); | 135 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
| 136 } | 136 } |
| 137 | 137 |
| 138 v8::Local<v8::Object> WebViewPlugin::v8ScriptableObject(v8::Isolate* isolate) { | 138 v8::Local<v8::Object> WebViewPlugin::v8ScriptableObject(v8::Isolate* isolate) { |
| 139 if (!delegate_) | 139 if (!delegate_) |
| 140 return v8::Local<v8::Object>(); | 140 return v8::Local<v8::Object>(); |
| 141 | 141 |
| 142 return delegate_->GetV8ScriptableObject(isolate); | 142 return delegate_->GetV8ScriptableObject(isolate); |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool WebViewPlugin::isErrorPlaceholder() { |
| 146 if (!delegate_) |
| 147 return false; |
| 148 |
| 149 return delegate_->IsErrorPlaceholder(); |
| 150 } |
| 151 |
| 145 void WebViewPlugin::updateAllLifecyclePhases() { | 152 void WebViewPlugin::updateAllLifecyclePhases() { |
| 146 web_view()->updateAllLifecyclePhases(); | 153 web_view()->updateAllLifecyclePhases(); |
| 147 } | 154 } |
| 148 | 155 |
| 149 void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) { | 156 void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) { |
| 150 gfx::Rect paint_rect = gfx::IntersectRects(rect_, rect); | 157 gfx::Rect paint_rect = gfx::IntersectRects(rect_, rect); |
| 151 if (paint_rect.IsEmpty()) | 158 if (paint_rect.IsEmpty()) |
| 152 return; | 159 return; |
| 153 | 160 |
| 154 base::AutoReset<bool> is_painting( | 161 base::AutoReset<bool> is_painting( |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 if (!delegate_) | 353 if (!delegate_) |
| 347 return; | 354 return; |
| 348 | 355 |
| 349 // The delegate may instantiate a new plugin. | 356 // The delegate may instantiate a new plugin. |
| 350 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 357 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 351 // The delegate may have dirtied style and layout of the WebView. | 358 // The delegate may have dirtied style and layout of the WebView. |
| 352 // See for example the resizePoster function in plugin_poster.html. | 359 // See for example the resizePoster function in plugin_poster.html. |
| 353 // Run the lifecycle now so that it is clean. | 360 // Run the lifecycle now so that it is clean. |
| 354 web_view()->updateAllLifecyclePhases(); | 361 web_view()->updateAllLifecyclePhases(); |
| 355 } | 362 } |
| OLD | NEW |