| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 web_view_->MainFrame()->MainWorldScriptContext(); | 343 web_view_->MainFrame()->MainWorldScriptContext(); |
| 344 DCHECK(!context.IsEmpty()); | 344 DCHECK(!context.IsEmpty()); |
| 345 | 345 |
| 346 v8::Context::Scope context_scope(context); | 346 v8::Context::Scope context_scope(context); |
| 347 v8::Local<v8::Object> global = context->Global(); | 347 v8::Local<v8::Object> global = context->Global(); |
| 348 | 348 |
| 349 global->Set(gin::StringToV8(isolate, "plugin"), | 349 global->Set(gin::StringToV8(isolate, "plugin"), |
| 350 plugin_->delegate_->GetV8Handle(isolate)); | 350 plugin_->delegate_->GetV8Handle(isolate)); |
| 351 } | 351 } |
| 352 | 352 |
| 353 void WebViewPlugin::WebViewHelper::FrameDetached(blink::WebLocalFrame* frame, |
| 354 DetachType type) { |
| 355 if (frame->FrameWidget()) |
| 356 frame->FrameWidget()->Close(); |
| 357 |
| 358 frame->Close(); |
| 359 } |
| 360 |
| 353 void WebViewPlugin::OnZoomLevelChanged() { | 361 void WebViewPlugin::OnZoomLevelChanged() { |
| 354 if (container_) { | 362 if (container_) { |
| 355 web_view()->SetZoomLevel( | 363 web_view()->SetZoomLevel( |
| 356 blink::WebView::ZoomFactorToZoomLevel(container_->PageZoomFactor())); | 364 blink::WebView::ZoomFactorToZoomLevel(container_->PageZoomFactor())); |
| 357 } | 365 } |
| 358 } | 366 } |
| 359 | 367 |
| 360 void WebViewPlugin::UpdatePluginForNewGeometry( | 368 void WebViewPlugin::UpdatePluginForNewGeometry( |
| 361 const blink::WebRect& window_rect, | 369 const blink::WebRect& window_rect, |
| 362 const blink::WebRect& unobscured_rect) { | 370 const blink::WebRect& unobscured_rect) { |
| 363 DCHECK(container_); | 371 DCHECK(container_); |
| 364 if (!delegate_) | 372 if (!delegate_) |
| 365 return; | 373 return; |
| 366 | 374 |
| 367 // The delegate may instantiate a new plugin. | 375 // The delegate may instantiate a new plugin. |
| 368 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 376 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 369 // The delegate may have dirtied style and layout of the WebView. | 377 // The delegate may have dirtied style and layout of the WebView. |
| 370 // See for example the resizePoster function in plugin_poster.html. | 378 // See for example the resizePoster function in plugin_poster.html. |
| 371 // Run the lifecycle now so that it is clean. | 379 // Run the lifecycle now so that it is clean. |
| 372 web_view()->UpdateAllLifecyclePhases(); | 380 web_view()->UpdateAllLifecyclePhases(); |
| 373 } | 381 } |
| OLD | NEW |