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 "chrome/renderer/plugins/chrome_plugin_placeholder.h" | 5 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/common/prerender_messages.h" | 9 #include "chrome/common/prerender_messages.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 using content::RenderThread; | 28 using content::RenderThread; |
29 using content::RenderView; | 29 using content::RenderView; |
30 using blink::WebDocument; | 30 using blink::WebDocument; |
31 using blink::WebElement; | 31 using blink::WebElement; |
32 using blink::WebFrame; | 32 using blink::WebFrame; |
33 using blink::WebMouseEvent; | 33 using blink::WebMouseEvent; |
34 using blink::WebNode; | 34 using blink::WebNode; |
35 using blink::WebPlugin; | 35 using blink::WebPlugin; |
36 using blink::WebPluginContainer; | 36 using blink::WebPluginContainer; |
37 using blink::WebPluginParams; | 37 using blink::WebPluginParams; |
38 using webkit_glue::CppArgumentList; | |
39 using webkit_glue::CppVariant; | |
40 | 38 |
41 namespace { | 39 namespace { |
42 const plugins::PluginPlaceholder* g_last_active_menu = NULL; | 40 const plugins::PluginPlaceholder* g_last_active_menu = NULL; |
43 } // namespace | 41 } // namespace |
44 | 42 |
45 const char ChromePluginPlaceholder::kPluginPlaceholderDataURL[] = | 43 const char ChromePluginPlaceholder::kPluginPlaceholderDataURL[] = |
46 "chrome://pluginplaceholderdata/"; | 44 "chrome://pluginplaceholderdata/"; |
47 | 45 |
48 ChromePluginPlaceholder::ChromePluginPlaceholder( | 46 ChromePluginPlaceholder::ChromePluginPlaceholder( |
49 content::RenderView* render_view, | 47 content::RenderView* render_view, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 IPC_END_MESSAGE_MAP() | 208 IPC_END_MESSAGE_MAP() |
211 | 209 |
212 return false; | 210 return false; |
213 } | 211 } |
214 | 212 |
215 void ChromePluginPlaceholder::OnLoadBlockedPlugins( | 213 void ChromePluginPlaceholder::OnLoadBlockedPlugins( |
216 const std::string& identifier) { | 214 const std::string& identifier) { |
217 plugins::PluginPlaceholder::OnLoadBlockedPlugins(identifier); | 215 plugins::PluginPlaceholder::OnLoadBlockedPlugins(identifier); |
218 } | 216 } |
219 | 217 |
218 // static | |
220 void ChromePluginPlaceholder::OpenAboutPluginsCallback( | 219 void ChromePluginPlaceholder::OpenAboutPluginsCallback( |
Bernhard Bauer
2013/11/12 16:37:20
If this is a static method now, you can move it to
| |
221 const CppArgumentList& args, | 220 const v8::FunctionCallbackInfo<v8::Value>& args) { |
222 CppVariant* result) { | 221 ChromePluginPlaceholder* plugin = reinterpret_cast<ChromePluginPlaceholder*>( |
222 v8::External::Cast(*args.Data())->Value()); | |
223 RenderThread::Get()->Send( | 223 RenderThread::Get()->Send( |
224 new ChromeViewHostMsg_OpenAboutPlugins(routing_id())); | 224 new ChromeViewHostMsg_OpenAboutPlugins(plugin->routing_id())); |
225 } | 225 } |
226 | 226 |
227 void ChromePluginPlaceholder::OnSetIsPrerendering(bool is_prerendering) { | 227 void ChromePluginPlaceholder::OnSetIsPrerendering(bool is_prerendering) { |
228 plugins::PluginPlaceholder::OnSetIsPrerendering(is_prerendering); | 228 plugins::PluginPlaceholder::OnSetIsPrerendering(is_prerendering); |
229 } | 229 } |
230 | 230 |
231 #if defined(ENABLE_PLUGIN_INSTALLATION) | 231 #if defined(ENABLE_PLUGIN_INSTALLATION) |
232 void ChromePluginPlaceholder::OnDidNotFindMissingPlugin() { | 232 void ChromePluginPlaceholder::OnDidNotFindMissingPlugin() { |
233 SetMessage(l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_FOUND)); | 233 SetMessage(l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_FOUND)); |
234 } | 234 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE); | 345 hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE); |
346 params.custom_items.push_back(hide_item); | 346 params.custom_items.push_back(hide_item); |
347 | 347 |
348 params.x = event.windowX; | 348 params.x = event.windowX; |
349 params.y = event.windowY; | 349 params.y = event.windowY; |
350 | 350 |
351 context_menu_request_id_ = render_view()->ShowContextMenu(this, params); | 351 context_menu_request_id_ = render_view()->ShowContextMenu(this, params); |
352 g_last_active_menu = this; | 352 g_last_active_menu = this; |
353 } | 353 } |
354 | 354 |
355 void ChromePluginPlaceholder::BindWebFrame(blink::WebFrame* frame) { | 355 void ChromePluginPlaceholder::InstallAdditionalCallbacks( |
356 plugins::PluginPlaceholder::BindWebFrame(frame); | 356 v8::Handle<v8::Template> prototype) { |
357 BindCallback("openAboutPlugins", | 357 prototype->Set(v8::String::New("openAboutPlugins"), |
358 base::Bind(&ChromePluginPlaceholder::OpenAboutPluginsCallback, | 358 v8::FunctionTemplate::New( |
359 base::Unretained(this))); | 359 &ChromePluginPlaceholder::OpenAboutPluginsCallback, |
360 v8::External::New(this))->GetFunction()); | |
360 } | 361 } |
OLD | NEW |