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