| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 OnPluginComponentUpdateFailure) | 205 OnPluginComponentUpdateFailure) |
| 206 IPC_MESSAGE_UNHANDLED(handled = false) | 206 IPC_MESSAGE_UNHANDLED(handled = false) |
| 207 IPC_END_MESSAGE_MAP() | 207 IPC_END_MESSAGE_MAP() |
| 208 | 208 |
| 209 if (handled) | 209 if (handled) |
| 210 return true; | 210 return true; |
| 211 | 211 |
| 212 // We don't swallow these messages because multiple blocked plugins and other | 212 // We don't swallow these messages because multiple blocked plugins and other |
| 213 // objects have an interest in them. | 213 // objects have an interest in them. |
| 214 IPC_BEGIN_MESSAGE_MAP(ChromePluginPlaceholder, message) | 214 IPC_BEGIN_MESSAGE_MAP(ChromePluginPlaceholder, message) |
| 215 IPC_MESSAGE_HANDLER(PrerenderMsg_SetIsPrerendering, OnSetIsPrerendering) | 215 IPC_MESSAGE_HANDLER(PrerenderMsg_SetIsPrerendering, OnSetPrerenderMode) |
| 216 IPC_MESSAGE_HANDLER(ChromeViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins) | 216 IPC_MESSAGE_HANDLER(ChromeViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins) |
| 217 IPC_END_MESSAGE_MAP() | 217 IPC_END_MESSAGE_MAP() |
| 218 | 218 |
| 219 return false; | 219 return false; |
| 220 } | 220 } |
| 221 | 221 |
| 222 void ChromePluginPlaceholder::OpenAboutPluginsCallback() { | 222 void ChromePluginPlaceholder::OpenAboutPluginsCallback() { |
| 223 RenderThread::Get()->Send( | 223 RenderThread::Get()->Send( |
| 224 new ChromeViewHostMsg_OpenAboutPlugins(routing_id())); | 224 new ChromeViewHostMsg_OpenAboutPlugins(routing_id())); |
| 225 } | 225 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 void ChromePluginPlaceholder::OnPluginComponentUpdateSuccess() { | 268 void ChromePluginPlaceholder::OnPluginComponentUpdateSuccess() { |
| 269 PluginListChanged(); | 269 PluginListChanged(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void ChromePluginPlaceholder::OnPluginComponentUpdateFailure() { | 272 void ChromePluginPlaceholder::OnPluginComponentUpdateFailure() { |
| 273 SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_ERROR_SHORT, | 273 SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_ERROR_SHORT, |
| 274 plugin_name_)); | 274 plugin_name_)); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void ChromePluginPlaceholder::OnSetPrerenderMode( |
| 278 prerender::PrerenderMode mode) { |
| 279 OnSetIsPrerendering(mode != prerender::NO_PRERENDER); |
| 280 } |
| 281 |
| 277 void ChromePluginPlaceholder::PluginListChanged() { | 282 void ChromePluginPlaceholder::PluginListChanged() { |
| 278 if (!GetFrame() || !plugin()) | 283 if (!GetFrame() || !plugin()) |
| 279 return; | 284 return; |
| 280 | 285 |
| 281 ChromeViewHostMsg_GetPluginInfo_Output output; | 286 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 282 std::string mime_type(GetPluginParams().mimeType.utf8()); | 287 std::string mime_type(GetPluginParams().mimeType.utf8()); |
| 283 blink::WebString top_origin = | 288 blink::WebString top_origin = |
| 284 GetFrame()->top()->getSecurityOrigin().toString(); | 289 GetFrame()->top()->getSecurityOrigin().toString(); |
| 285 render_frame()->Send( | 290 render_frame()->Send( |
| 286 new ChromeViewHostMsg_GetPluginInfo(routing_id(), | 291 new ChromeViewHostMsg_GetPluginInfo(routing_id(), |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 419 |
| 415 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 420 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 416 switches::kEnablePluginPlaceholderTesting)) { | 421 switches::kEnablePluginPlaceholderTesting)) { |
| 417 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( | 422 builder.SetMethod<void (ChromePluginPlaceholder::*)()>( |
| 418 "didFinishIconRepositionForTesting", | 423 "didFinishIconRepositionForTesting", |
| 419 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); | 424 &ChromePluginPlaceholder::DidFinishIconRepositionForTestingCallback); |
| 420 } | 425 } |
| 421 | 426 |
| 422 return builder; | 427 return builder; |
| 423 } | 428 } |
| OLD | NEW |