OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #if defined(ENABLE_PEPPER) | |
6 #define PEPPER_APIS_ENABLED | |
7 #endif | |
8 | |
9 #include "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
10 | 6 |
11 #include <algorithm> | 7 #include <algorithm> |
12 #include <string> | 8 #include <string> |
13 #include <vector> | 9 #include <vector> |
14 | 10 |
15 #include "app/gfx/color_utils.h" | 11 #include "app/gfx/color_utils.h" |
16 #include "app/gfx/favicon_size.h" | 12 #include "app/gfx/favicon_size.h" |
17 #include "app/gfx/native_widget_types.h" | 13 #include "app/gfx/native_widget_types.h" |
18 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
(...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2632 url, policy_url, mime_type, &path, actual_mime_type)); | 2628 url, policy_url, mime_type, &path, actual_mime_type)); |
2633 if (path.value().empty()) | 2629 if (path.value().empty()) |
2634 return NULL; | 2630 return NULL; |
2635 | 2631 |
2636 const std::string* mime_type_to_use; | 2632 const std::string* mime_type_to_use; |
2637 if (!actual_mime_type->empty()) | 2633 if (!actual_mime_type->empty()) |
2638 mime_type_to_use = actual_mime_type; | 2634 mime_type_to_use = actual_mime_type; |
2639 else | 2635 else |
2640 mime_type_to_use = &mime_type; | 2636 mime_type_to_use = &mime_type; |
2641 | 2637 |
2642 #if defined(PEPPER_APIS_ENABLED) | 2638 bool use_pepper_host = false; |
| 2639 bool in_process_plugin = RenderProcess::current()->in_process_plugins(); |
| 2640 // Check for trusted Pepper plugins. |
2643 const char kPepperPrefix[] = "pepper-"; | 2641 const char kPepperPrefix[] = "pepper-"; |
2644 if (StartsWithASCII(*mime_type_to_use, kPepperPrefix, true)) { | 2642 if (StartsWithASCII(*mime_type_to_use, kPepperPrefix, true)) { |
2645 return WebPluginDelegatePepper::Create( | 2643 if (CommandLine::ForCurrentProcess()-> |
2646 path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); | 2644 HasSwitch(switches::kInternalPepper)) { |
| 2645 in_process_plugin = true; |
| 2646 use_pepper_host = true; |
| 2647 } else { |
| 2648 // In process Pepper plugins must be explicitly enabled. |
| 2649 return NULL; |
| 2650 } |
2647 } | 2651 } |
2648 #endif | 2652 // Check for Native Client modules. |
2649 | |
2650 bool in_process_plugin = RenderProcess::current()->in_process_plugins(); | |
2651 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl)) { | 2653 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl)) { |
2652 if (mime_type == "application/x-nacl-srpc") { | 2654 if (mime_type == "application/x-nacl-srpc") { |
2653 in_process_plugin = true; | 2655 in_process_plugin = true; |
| 2656 use_pepper_host = true; |
2654 } | 2657 } |
2655 } | 2658 } |
2656 if (in_process_plugin) { | 2659 if (in_process_plugin) { |
2657 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac. | 2660 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac. |
2658 return WebPluginDelegateImpl::Create( | 2661 if (use_pepper_host) { |
2659 path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); | 2662 return WebPluginDelegatePepper::Create( |
| 2663 path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); |
| 2664 } else { |
| 2665 return WebPluginDelegateImpl::Create( |
| 2666 path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); |
| 2667 } |
2660 #else | 2668 #else |
2661 NOTIMPLEMENTED(); | 2669 NOTIMPLEMENTED(); |
2662 return NULL; | 2670 return NULL; |
2663 #endif | 2671 #endif |
2664 } | 2672 } |
2665 | 2673 |
2666 return new WebPluginDelegateProxy(*mime_type_to_use, AsWeakPtr()); | 2674 return new WebPluginDelegateProxy(*mime_type_to_use, AsWeakPtr()); |
2667 } | 2675 } |
2668 | 2676 |
2669 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) { | 2677 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) { |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3878 new PluginMsg_SignalModalDialogEvent(host_window_)); | 3886 new PluginMsg_SignalModalDialogEvent(host_window_)); |
3879 | 3887 |
3880 message->EnableMessagePumping(); // Runs a nested message loop. | 3888 message->EnableMessagePumping(); // Runs a nested message loop. |
3881 bool rv = Send(message); | 3889 bool rv = Send(message); |
3882 | 3890 |
3883 PluginChannelHost::Broadcast( | 3891 PluginChannelHost::Broadcast( |
3884 new PluginMsg_ResetModalDialogEvent(host_window_)); | 3892 new PluginMsg_ResetModalDialogEvent(host_window_)); |
3885 | 3893 |
3886 return rv; | 3894 return rv; |
3887 } | 3895 } |
OLD | NEW |