OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/loadable_plugin_placeholder.h" | 5 #include "components/plugins/renderer/loadable_plugin_placeholder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 void LoadablePluginPlaceholder::HideCallback() { | 322 void LoadablePluginPlaceholder::HideCallback() { |
323 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Hide_Click")); | 323 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Hide_Click")); |
324 HidePlugin(); | 324 HidePlugin(); |
325 } | 325 } |
326 | 326 |
327 void LoadablePluginPlaceholder::DidFinishLoadingCallback() { | 327 void LoadablePluginPlaceholder::DidFinishLoadingCallback() { |
328 finished_loading_ = true; | 328 finished_loading_ = true; |
329 if (message_.length() > 0) | 329 if (message_.length() > 0) |
330 UpdateMessage(); | 330 UpdateMessage(); |
331 | 331 |
332 // Ensure that we force a layout and paint invalidation for the new | |
333 // content. This will cause the container invalidation to be acted upon. | |
334 blink::WebFrame* frame = GetFrame(); | |
Bernhard Bauer
2015/04/07 11:22:48
Nit: This variable saves only five characters, we
| |
335 blink::WebView* view = frame->view(); | |
336 view->setNeedsLayoutAndFullPaintInvalidation(); | |
337 | |
332 // Wait for the placeholder to finish loading to hide the premade plugin. | 338 // Wait for the placeholder to finish loading to hide the premade plugin. |
333 // This is necessary to prevent a flicker. | 339 // This is necessary to prevent a flicker. |
334 if (premade_throttler_ && !placeholder_was_replaced_) | 340 if (premade_throttler_ && !placeholder_was_replaced_) |
335 premade_throttler_->SetHiddenForPlaceholder(true /* hidden */); | 341 premade_throttler_->SetHiddenForPlaceholder(true /* hidden */); |
336 } | 342 } |
337 | 343 |
338 void LoadablePluginPlaceholder::SetPluginInfo( | 344 void LoadablePluginPlaceholder::SetPluginInfo( |
339 const content::WebPluginInfo& plugin_info) { | 345 const content::WebPluginInfo& plugin_info) { |
340 plugin_info_ = plugin_info; | 346 plugin_info_ = plugin_info; |
341 } | 347 } |
342 | 348 |
343 const content::WebPluginInfo& LoadablePluginPlaceholder::GetPluginInfo() const { | 349 const content::WebPluginInfo& LoadablePluginPlaceholder::GetPluginInfo() const { |
344 return plugin_info_; | 350 return plugin_info_; |
345 } | 351 } |
346 | 352 |
347 void LoadablePluginPlaceholder::SetIdentifier(const std::string& identifier) { | 353 void LoadablePluginPlaceholder::SetIdentifier(const std::string& identifier) { |
348 identifier_ = identifier; | 354 identifier_ = identifier; |
349 } | 355 } |
350 | 356 |
351 bool LoadablePluginPlaceholder::LoadingBlocked() const { | 357 bool LoadablePluginPlaceholder::LoadingBlocked() const { |
352 DCHECK(allow_loading_); | 358 DCHECK(allow_loading_); |
353 return is_blocked_for_background_tab_ || is_blocked_for_power_saver_poster_ || | 359 return is_blocked_for_background_tab_ || is_blocked_for_power_saver_poster_ || |
354 is_blocked_for_prerendering_; | 360 is_blocked_for_prerendering_; |
355 } | 361 } |
356 | 362 |
357 } // namespace plugins | 363 } // namespace plugins |
OLD | NEW |