Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Side by Side Diff: chrome/renderer/plugins/plugin_preroller.cc

Issue 2855123003: Remove rendundant WebLocalFrame parameter in various plugin code. (Closed)
Patch Set: Fix Android Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/renderer/plugins/plugin_preroller.h" 5 #include "chrome/renderer/plugins/plugin_preroller.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "chrome/grit/renderer_resources.h" 8 #include "chrome/grit/renderer_resources.h"
9 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" 9 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
10 #include "chrome/renderer/plugins/power_saver_info.h" 10 #include "chrome/renderer/plugins/power_saver_info.h"
11 #include "third_party/WebKit/public/platform/WebRect.h" 11 #include "third_party/WebKit/public/platform/WebRect.h"
12 #include "third_party/WebKit/public/web/WebElement.h" 12 #include "third_party/WebKit/public/web/WebElement.h"
13 #include "third_party/WebKit/public/web/WebPlugin.h" 13 #include "third_party/WebKit/public/web/WebPlugin.h"
14 #include "third_party/WebKit/public/web/WebPluginContainer.h" 14 #include "third_party/WebKit/public/web/WebPluginContainer.h"
15 #include "ui/gfx/codec/png_codec.h" 15 #include "ui/gfx/codec/png_codec.h"
16 16
17 PluginPreroller::PluginPreroller(content::RenderFrame* render_frame, 17 PluginPreroller::PluginPreroller(content::RenderFrame* render_frame,
18 blink::WebLocalFrame* frame,
19 const blink::WebPluginParams& params, 18 const blink::WebPluginParams& params,
20 const content::WebPluginInfo& info, 19 const content::WebPluginInfo& info,
21 const std::string& identifier, 20 const std::string& identifier,
22 const base::string16& name, 21 const base::string16& name,
23 const base::string16& message, 22 const base::string16& message,
24 content::PluginInstanceThrottler* throttler) 23 content::PluginInstanceThrottler* throttler)
25 : RenderFrameObserver(render_frame), 24 : RenderFrameObserver(render_frame),
26 frame_(frame),
27 params_(params), 25 params_(params),
28 info_(info), 26 info_(info),
29 identifier_(identifier), 27 identifier_(identifier),
30 name_(name), 28 name_(name),
31 message_(message), 29 message_(message),
32 throttler_(throttler) { 30 throttler_(throttler) {
33 DCHECK(throttler); 31 DCHECK(throttler);
34 throttler_->AddObserver(this); 32 throttler_->AddObserver(this);
35 } 33 }
36 34
(...skipping 22 matching lines...) Expand all
59 if (!throttler_->IsThrottled()) 57 if (!throttler_->IsThrottled())
60 return; 58 return;
61 59
62 PowerSaverInfo power_saver_info; 60 PowerSaverInfo power_saver_info;
63 power_saver_info.power_saver_enabled = true; 61 power_saver_info.power_saver_enabled = true;
64 power_saver_info.poster_attribute = keyframe_data_url_.spec(); 62 power_saver_info.poster_attribute = keyframe_data_url_.spec();
65 power_saver_info.custom_poster_size = throttler_->GetSize(); 63 power_saver_info.custom_poster_size = throttler_->GetSize();
66 64
67 ChromePluginPlaceholder* placeholder = 65 ChromePluginPlaceholder* placeholder =
68 ChromePluginPlaceholder::CreateBlockedPlugin( 66 ChromePluginPlaceholder::CreateBlockedPlugin(
69 render_frame(), frame_, params_, info_, identifier_, name_, 67 render_frame(), params_, info_, identifier_, name_,
70 IDR_PLUGIN_POSTER_HTML, message_, power_saver_info); 68 IDR_PLUGIN_POSTER_HTML, message_, power_saver_info);
71 placeholder->SetPremadePlugin(throttler_); 69 placeholder->SetPremadePlugin(throttler_);
72 placeholder->AllowLoading(); 70 placeholder->AllowLoading();
73 71
74 blink::WebPluginContainer* container = 72 blink::WebPluginContainer* container =
75 throttler_->GetWebPlugin()->Container(); 73 throttler_->GetWebPlugin()->Container();
76 container->SetPlugin(placeholder->plugin()); 74 container->SetPlugin(placeholder->plugin());
77 75
78 bool success = placeholder->plugin()->Initialize(container); 76 bool success = placeholder->plugin()->Initialize(container);
79 DCHECK(success); 77 DCHECK(success);
80 78
81 container->Invalidate(); 79 container->Invalidate();
82 container->ReportGeometry(); 80 container->ReportGeometry();
83 81
84 delete this; 82 delete this;
85 } 83 }
86 84
87 void PluginPreroller::OnThrottlerDestroyed() { 85 void PluginPreroller::OnThrottlerDestroyed() {
88 throttler_ = nullptr; 86 throttler_ = nullptr;
89 delete this; 87 delete this;
90 } 88 }
91 89
92 void PluginPreroller::OnDestruct() { 90 void PluginPreroller::OnDestruct() {
93 delete this; 91 delete this;
94 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698