| 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // lifecycle stages during later ones. | 321 // lifecycle stages during later ones. |
| 322 if (plugin_->is_resizing_) | 322 if (plugin_->is_resizing_) |
| 323 return; | 323 return; |
| 324 if (plugin_->container_) { | 324 if (plugin_->container_) { |
| 325 // This should never happen; see also crbug.com/545039 for context. | 325 // This should never happen; see also crbug.com/545039 for context. |
| 326 DCHECK(!plugin_->is_painting_); | 326 DCHECK(!plugin_->is_painting_); |
| 327 plugin_->container_->ScheduleAnimation(); | 327 plugin_->container_->ScheduleAnimation(); |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 | 330 |
| 331 void WebViewPlugin::WebViewHelper::DidClearWindowObject(WebLocalFrame* frame) { | 331 void WebViewPlugin::WebViewHelper::DidClearWindowObject() { |
| 332 DCHECK_EQ(frame, web_view_->MainFrame()); | |
| 333 if (!plugin_->delegate_) | 332 if (!plugin_->delegate_) |
| 334 return; | 333 return; |
| 335 | 334 |
| 336 v8::Isolate* isolate = blink::MainThreadIsolate(); | 335 v8::Isolate* isolate = blink::MainThreadIsolate(); |
| 337 v8::HandleScope handle_scope(isolate); | 336 v8::HandleScope handle_scope(isolate); |
| 338 v8::Local<v8::Context> context = frame->MainWorldScriptContext(); | 337 v8::Local<v8::Context> context = |
| 338 web_view_->MainFrame()->MainWorldScriptContext(); |
| 339 DCHECK(!context.IsEmpty()); | 339 DCHECK(!context.IsEmpty()); |
| 340 | 340 |
| 341 v8::Context::Scope context_scope(context); | 341 v8::Context::Scope context_scope(context); |
| 342 v8::Local<v8::Object> global = context->Global(); | 342 v8::Local<v8::Object> global = context->Global(); |
| 343 | 343 |
| 344 global->Set(gin::StringToV8(isolate, "plugin"), | 344 global->Set(gin::StringToV8(isolate, "plugin"), |
| 345 plugin_->delegate_->GetV8Handle(isolate)); | 345 plugin_->delegate_->GetV8Handle(isolate)); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void WebViewPlugin::OnZoomLevelChanged() { | 348 void WebViewPlugin::OnZoomLevelChanged() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 359 if (!delegate_) | 359 if (!delegate_) |
| 360 return; | 360 return; |
| 361 | 361 |
| 362 // The delegate may instantiate a new plugin. | 362 // The delegate may instantiate a new plugin. |
| 363 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 363 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 364 // The delegate may have dirtied style and layout of the WebView. | 364 // The delegate may have dirtied style and layout of the WebView. |
| 365 // See for example the resizePoster function in plugin_poster.html. | 365 // See for example the resizePoster function in plugin_poster.html. |
| 366 // Run the lifecycle now so that it is clean. | 366 // Run the lifecycle now so that it is clean. |
| 367 web_view()->UpdateAllLifecyclePhases(); | 367 web_view()->UpdateAllLifecyclePhases(); |
| 368 } | 368 } |
| OLD | NEW |