| 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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 using blink::WebVector; | 47 using blink::WebVector; |
| 48 using blink::WebView; | 48 using blink::WebView; |
| 49 using content::WebPreferences; | 49 using content::WebPreferences; |
| 50 | 50 |
| 51 WebViewPlugin::WebViewPlugin(content::RenderView* render_view, | 51 WebViewPlugin::WebViewPlugin(content::RenderView* render_view, |
| 52 WebViewPlugin::Delegate* delegate, | 52 WebViewPlugin::Delegate* delegate, |
| 53 const WebPreferences& preferences) | 53 const WebPreferences& preferences) |
| 54 : content::RenderViewObserver(render_view), | 54 : content::RenderViewObserver(render_view), |
| 55 delegate_(delegate), | 55 delegate_(delegate), |
| 56 container_(nullptr), | 56 container_(nullptr), |
| 57 web_view_(WebView::create(this)), | 57 web_view_(WebView::create(this, true)), |
| 58 finished_loading_(false), | 58 finished_loading_(false), |
| 59 focused_(false), | 59 focused_(false), |
| 60 is_painting_(false), | 60 is_painting_(false), |
| 61 is_resizing_(false) { | 61 is_resizing_(false) { |
| 62 // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a | 62 // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a |
| 63 // consistent view of our preferences. | 63 // consistent view of our preferences. |
| 64 content::RenderView::ApplyWebPreferences(preferences, web_view_); | 64 content::RenderView::ApplyWebPreferences(preferences, web_view_); |
| 65 WebLocalFrame* web_local_frame = | 65 WebLocalFrame* web_local_frame = |
| 66 WebLocalFrame::create(blink::WebTreeScopeType::Document, this); | 66 WebLocalFrame::create(blink::WebTreeScopeType::Document, this); |
| 67 web_frame_ = web_local_frame; | 67 web_frame_ = web_local_frame; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // By default RenderViewObservers are destroyed along with the RenderView. | 340 // By default RenderViewObservers are destroyed along with the RenderView. |
| 341 // WebViewPlugin has a custom destruction mechanism, so we disable this. | 341 // WebViewPlugin has a custom destruction mechanism, so we disable this. |
| 342 } | 342 } |
| 343 | 343 |
| 344 void WebViewPlugin::OnZoomLevelChanged() { | 344 void WebViewPlugin::OnZoomLevelChanged() { |
| 345 if (container_) { | 345 if (container_) { |
| 346 web_view_->setZoomLevel( | 346 web_view_->setZoomLevel( |
| 347 blink::WebView::zoomFactorToZoomLevel(container_->pageZoomFactor())); | 347 blink::WebView::zoomFactorToZoomLevel(container_->pageZoomFactor())); |
| 348 } | 348 } |
| 349 } | 349 } |
| OLD | NEW |