| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 void WebViewPlugin::didFinishLoading() { | 238 void WebViewPlugin::didFinishLoading() { |
| 239 DCHECK(!finished_loading_); | 239 DCHECK(!finished_loading_); |
| 240 finished_loading_ = true; | 240 finished_loading_ = true; |
| 241 } | 241 } |
| 242 | 242 |
| 243 void WebViewPlugin::didFailLoading(const WebURLError& error) { | 243 void WebViewPlugin::didFailLoading(const WebURLError& error) { |
| 244 DCHECK(!error_.get()); | 244 DCHECK(!error_.get()); |
| 245 error_.reset(new WebURLError(error)); | 245 error_.reset(new WebURLError(error)); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void WebViewPlugin::markAsErrorPlaceholder() { |
| 249 placeholder = true; |
| 250 } |
| 251 |
| 252 void WebViewPlugin::unmarkAsErrorPlaceholder() { |
| 253 placeholder = false; |
| 254 } |
| 255 |
| 256 bool WebViewPlugin::isPlaceholder() { |
| 257 return placeholder; |
| 258 } |
| 259 |
| 248 WebViewPlugin::WebViewHelper::WebViewHelper( | 260 WebViewPlugin::WebViewHelper::WebViewHelper( |
| 249 WebViewPlugin* plugin, | 261 WebViewPlugin* plugin, |
| 250 const WebPreferences& preferences) : plugin_(plugin) { | 262 const WebPreferences& preferences) : plugin_(plugin) { |
| 251 web_view_ = | 263 web_view_ = |
| 252 WebView::create(this, blink::WebPageVisibilityStateVisible); | 264 WebView::create(this, blink::WebPageVisibilityStateVisible); |
| 253 // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a | 265 // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a |
| 254 // consistent view of our preferences. | 266 // consistent view of our preferences. |
| 255 content::RenderView::ApplyWebPreferences(preferences, web_view_); | 267 content::RenderView::ApplyWebPreferences(preferences, web_view_); |
| 256 WebLocalFrame* web_frame = WebLocalFrame::create( | 268 WebLocalFrame* web_frame = WebLocalFrame::create( |
| 257 blink::WebTreeScopeType::Document, this, nullptr, nullptr); | 269 blink::WebTreeScopeType::Document, this, nullptr, nullptr); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 if (!delegate_) | 358 if (!delegate_) |
| 347 return; | 359 return; |
| 348 | 360 |
| 349 // The delegate may instantiate a new plugin. | 361 // The delegate may instantiate a new plugin. |
| 350 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 362 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
| 351 // The delegate may have dirtied style and layout of the WebView. | 363 // The delegate may have dirtied style and layout of the WebView. |
| 352 // See for example the resizePoster function in plugin_poster.html. | 364 // See for example the resizePoster function in plugin_poster.html. |
| 353 // Run the lifecycle now so that it is clean. | 365 // Run the lifecycle now so that it is clean. |
| 354 web_view()->updateAllLifecyclePhases(); | 366 web_view()->updateAllLifecyclePhases(); |
| 355 } | 367 } |
| OLD | NEW |