diff options
108 files changed, 650 insertions, 782 deletions
diff --git a/chrome/browser/hang_monitor/hung_plugin_action.cc b/chrome/browser/hang_monitor/hung_plugin_action.cc index e2133b0..ed66e8c 100644 --- a/chrome/browser/hang_monitor/hung_plugin_action.cc +++ b/chrome/browser/hang_monitor/hung_plugin_action.cc @@ -14,7 +14,6 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/win/hwnd_util.h" #include "webkit/plugins/npapi/plugin_utils.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" namespace { @@ -175,9 +174,8 @@ bool HungPluginAction::GetPluginNameAndVersion(HWND plugin_window, // we have gone too far. return false; } - if (webkit::npapi::WebPluginDelegateImpl::GetPluginNameFromWindow( - window_to_check, plugin_name)) { - webkit::npapi::WebPluginDelegateImpl::GetPluginVersionFromWindow( + if (webkit::npapi::GetPluginNameFromWindow(window_to_check, plugin_name)) { + webkit::npapi::GetPluginVersionFromWindow( window_to_check, plugin_version); return true; } diff --git a/content/browser/plugin_loader_posix.cc b/content/browser/plugin_loader_posix.cc index dc58114..15dd86a 100644 --- a/content/browser/plugin_loader_posix.cc +++ b/content/browser/plugin_loader_posix.cc @@ -10,9 +10,9 @@ #include "base/metrics/histogram.h" #include "content/browser/utility_process_host_impl.h" #include "content/common/child_process_host_impl.h" +#include "content/common/plugin_list.h" #include "content/common/utility_messages.h" #include "content/public/browser/browser_thread.h" -#include "webkit/plugins/npapi/plugin_list.h" namespace content { @@ -75,12 +75,10 @@ void PluginLoaderPosix::GetPluginsToLoad() { next_load_index_ = 0; canonical_list_.clear(); - webkit::npapi::PluginList::Singleton()->GetPluginPathsToLoad( - &canonical_list_); + PluginList::Singleton()->GetPluginPathsToLoad(&canonical_list_); internal_plugins_.clear(); - webkit::npapi::PluginList::Singleton()->GetInternalPlugins( - &internal_plugins_); + PluginList::Singleton()->GetInternalPlugins(&internal_plugins_); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(&PluginLoaderPosix::LoadPluginsInternal, @@ -163,7 +161,7 @@ bool PluginLoaderPosix::MaybeRunPendingCallbacks() { if (next_load_index_ < canonical_list_.size()) return false; - webkit::npapi::PluginList::Singleton()->SetPlugins(loaded_plugins_); + PluginList::Singleton()->SetPlugins(loaded_plugins_); // Only call the first callback with loaded plugins because there may be // some extra plugin paths added since the first callback is added. diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index 8c4756a..fcde1ff 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -50,9 +50,8 @@ #if defined(OS_WIN) #include "base/win/windows_version.h" +#include "content/common/plugin_constants_win.h" #include "content/public/common/sandboxed_process_launcher_delegate.h" -#include "webkit/plugins/npapi/plugin_constants_win.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" #endif namespace content { diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index 92d43c5..f1e9efa 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -20,6 +20,7 @@ #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/common/pepper_plugin_registry.h" +#include "content/common/plugin_list.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" @@ -27,13 +28,12 @@ #include "content/public/browser/resource_context.h" #include "content/public/common/content_switches.h" #include "content/public/common/process_type.h" -#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/plugin_utils.h" #include "webkit/plugins/plugin_constants.h" #include "webkit/plugins/webplugininfo.h" #if defined(OS_WIN) -#include "webkit/plugins/npapi/plugin_constants_win.h" +#include "content/common/plugin_constants_win.h" #endif #if defined(OS_POSIX) @@ -107,7 +107,7 @@ void NotifyPluginDirChanged(const base::FilePath& path, bool error) { } VLOG(1) << "Watched path changed: " << path.value(); // Make the plugin list update itself - webkit::npapi::PluginList::Singleton()->RefreshPlugins(); + PluginList::Singleton()->RefreshPlugins(); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&PluginService::PurgePluginListCache, @@ -166,7 +166,7 @@ PluginServiceImpl::~PluginServiceImpl() { void PluginServiceImpl::Init() { plugin_list_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken(); - webkit::npapi::PluginList::Singleton()->set_will_load_plugins_callback( + PluginList::Singleton()->set_will_load_plugins_callback( base::Bind(&WillLoadPluginsCallback, plugin_list_token_)); RegisterPepperPlugins(); @@ -196,10 +196,10 @@ void PluginServiceImpl::Init() { AddExtraPluginPath(path); path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); if (!path.empty()) - webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(path); + PluginList::Singleton()->AddExtraPluginDir(path); if (command_line->HasSwitch(switches::kDisablePluginsDiscovery)) - webkit::npapi::PluginList::Singleton()->DisablePluginsDiscovery(); + PluginList::Singleton()->DisablePluginsDiscovery(); } void PluginServiceImpl::StartWatchingPlugins() { @@ -208,7 +208,7 @@ void PluginServiceImpl::StartWatchingPlugins() { // watch for changes in the paths that are expected to contain plugins. #if defined(OS_WIN) if (hkcu_key_.Create(HKEY_CURRENT_USER, - webkit::npapi::kRegistryMozillaPlugins, + kRegistryMozillaPlugins, KEY_NOTIFY) == ERROR_SUCCESS) { if (hkcu_key_.StartWatching() == ERROR_SUCCESS) { hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event())); @@ -219,7 +219,7 @@ void PluginServiceImpl::StartWatchingPlugins() { } } if (hklm_key_.Create(HKEY_LOCAL_MACHINE, - webkit::npapi::kRegistryMozillaPlugins, + kRegistryMozillaPlugins, KEY_NOTIFY) == ERROR_SUCCESS) { if (hklm_key_.StartWatching() == ERROR_SUCCESS) { hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); @@ -237,7 +237,7 @@ void PluginServiceImpl::StartWatchingPlugins() { // Get the list of all paths for registering the FilePathWatchers // that will track and if needed reload the list of plugins on runtime. std::vector<base::FilePath> plugin_dirs; - webkit::npapi::PluginList::Singleton()->GetPluginDirectories(&plugin_dirs); + PluginList::Singleton()->GetPluginDirectories(&plugin_dirs); for (size_t i = 0; i < plugin_dirs.size(); ++i) { // FilePathWatcher can not handle non-absolute paths under windows. @@ -510,7 +510,7 @@ bool PluginServiceImpl::GetPluginInfoArray( std::vector<webkit::WebPluginInfo>* plugins, std::vector<std::string>* actual_mime_types) { bool use_stale = false; - webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( + PluginList::Singleton()->GetPluginInfoArray( url, mime_type, allow_wildcard, &use_stale, plugins, actual_mime_types); return use_stale; } @@ -551,7 +551,7 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, bool PluginServiceImpl::GetPluginInfoByPath(const base::FilePath& plugin_path, webkit::WebPluginInfo* info) { std::vector<webkit::WebPluginInfo> plugins; - webkit::npapi::PluginList::Singleton()->GetPluginsNoRefresh(&plugins); + PluginList::Singleton()->GetPluginsNoRefresh(&plugins); for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); it != plugins.end(); @@ -600,8 +600,7 @@ void PluginServiceImpl::GetPlugins(const GetPluginsCallback& callback) { } #if defined(OS_POSIX) std::vector<webkit::WebPluginInfo> cached_plugins; - if (webkit::npapi::PluginList::Singleton()->GetPluginsNoRefresh( - &cached_plugins)) { + if (PluginList::Singleton()->GetPluginsNoRefresh(&cached_plugins)) { // Can't assume the caller is reentrant. target_loop->PostTask(FROM_HERE, base::Bind(callback, cached_plugins)); @@ -626,7 +625,7 @@ void PluginServiceImpl::GetPluginsInternal( plugin_list_token_)); std::vector<webkit::WebPluginInfo> plugins; - webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins); + PluginList::Singleton()->GetPlugins(&plugins); target_loop->PostTask(FROM_HERE, base::Bind(callback, plugins)); @@ -641,7 +640,7 @@ void PluginServiceImpl::OnWaitableEventSignaled( hklm_key_.StartWatching(); } - webkit::npapi::PluginList::Singleton()->RefreshPlugins(); + PluginList::Singleton()->RefreshPlugins(); PurgePluginListCache(NULL, false); #else // This event should only get signaled on a Windows machine. @@ -749,39 +748,38 @@ bool PluginServiceImpl::IsPluginUnstable(const base::FilePath& path) { } void PluginServiceImpl::RefreshPlugins() { - webkit::npapi::PluginList::Singleton()->RefreshPlugins(); + PluginList::Singleton()->RefreshPlugins(); } void PluginServiceImpl::AddExtraPluginPath(const base::FilePath& path) { - webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path); + PluginList::Singleton()->AddExtraPluginPath(path); } void PluginServiceImpl::RemoveExtraPluginPath(const base::FilePath& path) { - webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath(path); + PluginList::Singleton()->RemoveExtraPluginPath(path); } void PluginServiceImpl::AddExtraPluginDir(const base::FilePath& path) { - webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(path); + PluginList::Singleton()->AddExtraPluginDir(path); } void PluginServiceImpl::RegisterInternalPlugin( const webkit::WebPluginInfo& info, bool add_at_beginning) { - webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( - info, add_at_beginning); + PluginList::Singleton()->RegisterInternalPlugin(info, add_at_beginning); } void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { - webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(path); + PluginList::Singleton()->UnregisterInternalPlugin(path); } void PluginServiceImpl::GetInternalPlugins( std::vector<webkit::WebPluginInfo>* plugins) { - webkit::npapi::PluginList::Singleton()->GetInternalPlugins(plugins); + PluginList::Singleton()->GetInternalPlugins(plugins); } void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { - webkit::npapi::PluginList::Singleton()->DisablePluginsDiscovery(); + PluginList::Singleton()->DisablePluginsDiscovery(); } #if defined(OS_MACOSX) diff --git a/content/browser/plugin_service_impl_browsertest.cc b/content/browser/plugin_service_impl_browsertest.cc index 102c492..26e4c43 100644 --- a/content/browser/plugin_service_impl_browsertest.cc +++ b/content/browser/plugin_service_impl_browsertest.cc @@ -18,7 +18,6 @@ #include "content/shell/shell.h" #include "content/test/content_browser_test.h" #include "testing/gmock/include/gmock/gmock.h" -#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/plugin_utils.h" namespace content { diff --git a/webkit/plugins/npapi/gtk_plugin_container.cc b/content/browser/renderer_host/gtk_plugin_container.cc index 056d31e..0b83f2e 100644 --- a/webkit/plugins/npapi/gtk_plugin_container.cc +++ b/content/browser/renderer_host/gtk_plugin_container.cc @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/gtk_plugin_container.h" +#include "content/browser/renderer_host/gtk_plugin_container.h" #include <gtk/gtk.h> #include "base/basictypes.h" -namespace webkit { -namespace npapi { +namespace content { namespace { @@ -87,5 +86,4 @@ void gtk_plugin_container_set_size(GtkWidget *widget, int width, int height) { gtk_widget_queue_resize_no_redraw(widget); } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/gtk_plugin_container.h b/content/browser/renderer_host/gtk_plugin_container.h index aee11c2..1713cd4 100644 --- a/webkit/plugins/npapi/gtk_plugin_container.h +++ b/content/browser/renderer_host/gtk_plugin_container.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_GTK_PLUGIN_CONTAINER_H_ -#define WEBKIT_PLUGINS_NPAPI_GTK_PLUGIN_CONTAINER_H_ +#ifndef CONTENT_BROWSER_RENDERER_HOST_GTK_PLUGIN_CONTAINER_H_ +#define CONTENT_BROWSER_RENDERER_HOST_GTK_PLUGIN_CONTAINER_H_ // Windowed plugins are embedded via XEmbed, which is implemented by // GtkPlug/GtkSocket. But we want to control sizing and positioning @@ -15,8 +15,7 @@ typedef struct _GtkWidget GtkWidget; -namespace webkit { -namespace npapi { +namespace content { // Return a new GtkPluginContainer. // Intentionally GTK-style here since we're creating a custom GTK widget. @@ -26,7 +25,6 @@ GtkWidget* gtk_plugin_container_new(); // Sets the size of the GtkPluginContainer. void gtk_plugin_container_set_size(GtkWidget *widget, int width, int height); -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_GTK_PLUGIN_CONTAINER_H_ +#endif // CONTENT_BROWSER_RENDERER_HOST_GTK_PLUGIN_CONTAINER_H_ diff --git a/webkit/plugins/npapi/gtk_plugin_container_manager.cc b/content/browser/renderer_host/gtk_plugin_container_manager.cc index d018714..93e2077 100644 --- a/webkit/plugins/npapi/gtk_plugin_container_manager.cc +++ b/content/browser/renderer_host/gtk_plugin_container_manager.cc @@ -2,18 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/gtk_plugin_container_manager.h" +#include "content/browser/renderer_host/gtk_plugin_container_manager.h" #include <gtk/gtk.h> #include "base/logging.h" +#include "content/browser/renderer_host/gtk_plugin_container.h" +#include "content/common/webplugin_geometry.h" #include "ui/base/gtk/gtk_compat.h" #include "ui/gfx/gtk_util.h" -#include "webkit/plugins/npapi/gtk_plugin_container.h" -#include "webkit/plugins/npapi/webplugin.h" -namespace webkit { -namespace npapi { +namespace content { GtkPluginContainerManager::GtkPluginContainerManager() : host_widget_(NULL) {} @@ -159,5 +158,4 @@ void GtkPluginContainerManager::RealizeCallback(GtkWidget* widget, gtk_socket_add_id(GTK_SOCKET(widget), id); } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/gtk_plugin_container_manager.h b/content/browser/renderer_host/gtk_plugin_container_manager.h index 480aebd..bd0e7c1 100644 --- a/webkit/plugins/npapi/gtk_plugin_container_manager.h +++ b/content/browser/renderer_host/gtk_plugin_container_manager.h @@ -2,24 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_GTK_PLUGIN_CONTAINER_MANAGER_H_ -#define WEBKIT_PLUGINS_NPAPI_GTK_PLUGIN_CONTAINER_MANAGER_H_ +#ifndef CONTENT_BROWSER_RENDERER_HOST_GTK_PLUGIN_CONTAINER_MANAGER_H_ +#define CONTENT_BROWSER_RENDERER_HOST_GTK_PLUGIN_CONTAINER_MANAGER_H_ #include <gtk/gtk.h> #include <map> #include "ui/gfx/native_widget_types.h" -#include "webkit/plugins/webkit_plugins_export.h" typedef struct _GtkWidget GtkWidget; -namespace webkit { -namespace npapi { - +namespace content { struct WebPluginGeometry; // Helper class that creates and manages plugin containers (GtkSocket). -class WEBKIT_PLUGINS_EXPORT GtkPluginContainerManager { +class GtkPluginContainerManager { public: GtkPluginContainerManager(); ~GtkPluginContainerManager(); @@ -56,7 +53,6 @@ class WEBKIT_PLUGINS_EXPORT GtkPluginContainerManager { PluginWindowToWidgetMap plugin_window_to_widget_map_; }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_GTK_PLUGIN_CONTAINER_MANAGER_H_ +#endif // CONTENT_BROWSER_RENDERER_HOST_GTK_PLUGIN_CONTAINER_MANAGER_H_ diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index d25fb86..c8882c9 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -63,7 +63,6 @@ #include "net/url_request/url_request_context_getter.h" #include "third_party/WebKit/public/web/WebNotificationPresenter.h" #include "ui/gfx/color_profile.h" -#include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/plugin_constants.h" #include "webkit/plugins/webplugininfo.h" diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 84a82ae..8b3fa65 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -60,8 +60,7 @@ #include "ui/gfx/vector2d_conversions.h" #include "webkit/common/cursors/webcursor.h" #include "webkit/common/webpreferences.h" -#include "webkit/plugins/npapi/webplugin.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" +#include "webkit/plugins/npapi/plugin_utils.h" #if defined(TOOLKIT_GTK) #include "content/browser/renderer_host/backing_store_gtk.h" @@ -72,7 +71,6 @@ using base::Time; using base::TimeDelta; using base::TimeTicks; -using webkit::npapi::WebPluginDelegateImpl; using WebKit::WebGestureEvent; using WebKit::WebInputEvent; using WebKit::WebKeyboardEvent; @@ -2233,8 +2231,7 @@ void RenderWidgetHostImpl::OnShowDisambiguationPopup( void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowCreated( gfx::NativeViewId dummy_activation_window) { HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); - if (!IsWindow(hwnd) || - !WebPluginDelegateImpl::IsDummyActivationWindow(hwnd)) { + if (!IsWindow(hwnd) || !webkit::npapi::IsDummyActivationWindow(hwnd)) { // This may happen as a result of a race condition when the plugin is going // away. return; @@ -2600,7 +2597,7 @@ void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { #if defined(OS_WIN) HWND hwnd = reinterpret_cast<HWND>(new_parent); if (!hwnd) - hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); + hwnd = webkit::npapi::GetDefaultWindowParent(); for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); i != dummy_windows_for_activation_.end(); ++i) { SetParent(*i, hwnd); diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 8e6eea2..fb94c2c 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc @@ -291,7 +291,7 @@ RenderWidgetHostViewAndroid::GetNativeViewAccessible() { void RenderWidgetHostViewAndroid::MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) { + const std::vector<WebPluginGeometry>& moves) { // We don't have plugin windows on Android. Do nothing. Note: this is called // from RenderWidgetHost::OnUpdateRect which is itself invoked while // processing the corresponding message from Renderer. diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h index 5a530dd..6783e7c 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.h +++ b/content/browser/renderer_host/render_widget_host_view_android.h @@ -83,7 +83,7 @@ class RenderWidgetHostViewAndroid virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; virtual void MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; + const std::vector<WebPluginGeometry>& moves) OVERRIDE; virtual void Focus() OVERRIDE; virtual void Blur() OVERRIDE; virtual bool HasFocus() const OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 924ea56..8fbaad8 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -142,7 +142,7 @@ BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { struct CutoutRectsParams { RenderWidgetHostViewAura* widget; std::vector<gfx::Rect> cutout_rects; - std::map<HWND, webkit::npapi::WebPluginGeometry>* geometry; + std::map<HWND, WebPluginGeometry>* geometry; }; // Used to update the region for the windowed plugin to draw in. We start with @@ -163,8 +163,7 @@ BOOL CALLBACK SetCutoutRectsCallback(HWND window, LPARAM param) { // Now get the cached clip rect and cutouts for this plugin window that came // from the renderer. - std::map<HWND, webkit::npapi::WebPluginGeometry>::iterator i = - params->geometry->begin(); + std::map<HWND, WebPluginGeometry>::iterator i = params->geometry->begin(); while (i != params->geometry->end() && i->second.window != window && GetParent(i->second.window) != window) { @@ -878,7 +877,7 @@ RenderWidgetHostViewAura::GetOrCreateBrowserAccessibilityManager() { void RenderWidgetHostViewAura::MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { + const std::vector<WebPluginGeometry>& plugin_window_moves) { #if defined(OS_WIN) // We need to clip the rectangle to the tab's viewport, otherwise we will draw // over the browser UI. @@ -888,7 +887,7 @@ void RenderWidgetHostViewAura::MovePluginWindows( } HWND parent = window_->GetRootWindow()->GetAcceleratedWidget(); gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); - std::vector<webkit::npapi::WebPluginGeometry> moves = plugin_window_moves; + std::vector<WebPluginGeometry> moves = plugin_window_moves; gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), view_bounds.height()); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 9c4528d..c3cffdf 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -168,7 +168,7 @@ class RenderWidgetHostViewAura virtual void WasHidden() OVERRIDE; virtual void MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; + const std::vector<WebPluginGeometry>& moves) OVERRIDE; virtual void Focus() OVERRIDE; virtual void Blur() OVERRIDE; virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; @@ -672,7 +672,7 @@ class RenderWidgetHostViewAura std::vector<gfx::Rect> transient_rects_; std::vector<gfx::Rect> constrained_rects_; - typedef std::map<HWND, webkit::npapi::WebPluginGeometry> PluginWindowMoves; + typedef std::map<HWND, WebPluginGeometry> PluginWindowMoves; // Contains information about each windowed plugin's clip and cutout rects ( // from the renderer). This is needed because when the transient windoiws // over this view changes, we need this information in order to create a new diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc index 87c3cc0..3a1121b 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc @@ -22,17 +22,15 @@ #include "base/message_loop/message_loop.h" #include "base/win/wrapped_window_proc.h" #include "content/browser/plugin_process_host.h" +#include "content/common/plugin_constants_win.h" +#include "content/common/webplugin_geometry.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_data.h" #include "content/public/common/content_switches.h" #include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" #include "ui/gfx/gdi_util.h" -#include "webkit/plugins/npapi/plugin_constants_win.h" -#include "webkit/plugins/npapi/webplugin.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" - -using webkit::npapi::WebPluginDelegateImpl; +#include "webkit/plugins/npapi/plugin_utils.h" #endif #if defined(TOOLKIT_GTK) @@ -120,7 +118,7 @@ LRESULT CALLBACK PluginWrapperWindowProc(HWND window, unsigned int message, bool IsPluginWrapperWindow(HWND window) { return ui::GetClassNameW(window) == - string16(webkit::npapi::kWrapperNativeWindowClassName); + string16(kWrapperNativeWindowClassName); } // Create an intermediate window between the given HWND and its parent. @@ -130,7 +128,7 @@ HWND ReparentWindow(HWND window, HWND parent) { if (!atom) { WNDCLASSEX window_class; base::win::InitializeWindowClass( - webkit::npapi::kWrapperNativeWindowClassName, + kWrapperNativeWindowClassName, &base::win::WrappedWindowProc<PluginWrapperWindowProc>, CS_DBLCLKS, 0, @@ -166,12 +164,12 @@ HWND ReparentWindow(HWND window, HWND parent) { } BOOL CALLBACK PaintEnumChildProc(HWND hwnd, LPARAM lparam) { - if (!WebPluginDelegateImpl::IsPluginDelegateWindow(hwnd)) + if (!webkit::npapi::IsPluginDelegateWindow(hwnd)) return TRUE; gfx::Rect* rect = reinterpret_cast<gfx::Rect*>(lparam); gfx::Rect rect_in_pixels = ui::win::DIPToScreenRect(*rect); - static UINT msg = RegisterWindowMessage(webkit::npapi::kPaintMessageName); + static UINT msg = RegisterWindowMessage(kPaintMessageName); WPARAM wparam = rect_in_pixels.x() << 16 | rect_in_pixels.y(); lparam = rect_in_pixels.width() << 16 | rect_in_pixels.height(); @@ -193,7 +191,7 @@ BOOL CALLBACK DetachPluginWindowsCallbackInternal(HWND window, LPARAM param) { // static void RenderWidgetHostViewBase::DetachPluginWindowsCallback(HWND window) { - if (WebPluginDelegateImpl::IsPluginDelegateWindow(window) && + if (webkit::npapi::IsPluginDelegateWindow(window) && !IsHungAppWindow(window)) { ::ShowWindow(window, SW_HIDE); SetParent(window, NULL); @@ -203,7 +201,7 @@ void RenderWidgetHostViewBase::DetachPluginWindowsCallback(HWND window) { // static void RenderWidgetHostViewBase::MovePluginWindowsHelper( HWND parent, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) { + const std::vector<WebPluginGeometry>& moves) { if (moves.empty()) return; @@ -221,7 +219,7 @@ void RenderWidgetHostViewBase::MovePluginWindowsHelper( for (size_t i = 0; i < moves.size(); ++i) { unsigned long flags = 0; - const webkit::npapi::WebPluginGeometry& move = moves[i]; + const WebPluginGeometry& move = moves[i]; HWND window = move.window; // As the plugin parent window which lives on the browser UI thread is @@ -234,7 +232,7 @@ void RenderWidgetHostViewBase::MovePluginWindowsHelper( if (!::IsWindow(window)) continue; - if (!WebPluginDelegateImpl::IsPluginDelegateWindow(window)) { + if (!webkit::npapi::IsPluginDelegateWindow(window)) { // The renderer should only be trying to move plugin windows. However, // this may happen as a result of a race condition (i.e. even after the // check right above), so we ignore it. @@ -242,7 +240,7 @@ void RenderWidgetHostViewBase::MovePluginWindowsHelper( } if (oop_plugins) { - if (cur_parent == WebPluginDelegateImpl::GetDefaultWindowParent()) { + if (cur_parent == webkit::npapi::GetDefaultWindowParent()) { // The plugin window hasn't been parented yet, add an intermediate // window that lives on this thread to speed up scrolling. Note this // only works with out of process plugins since we depend on @@ -257,7 +255,7 @@ void RenderWidgetHostViewBase::MovePluginWindowsHelper( // process synchronous Windows messages. window = cur_parent; } else { - if (cur_parent == WebPluginDelegateImpl::GetDefaultWindowParent()) + if (cur_parent == webkit::npapi::GetDefaultWindowParent()) SetParent(window, parent); } @@ -314,7 +312,7 @@ void RenderWidgetHostViewBase::MovePluginWindowsHelper( #if defined(USE_AURA) for (size_t i = 0; i < moves.size(); ++i) { - const webkit::npapi::WebPluginGeometry& move = moves[i]; + const WebPluginGeometry& move = moves[i]; RECT r; GetWindowRect(move.window, &r); gfx::Rect gr(r); diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h index 9ec7df9..895bf41 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h @@ -102,7 +102,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase // Shared implementation of MovePluginWindows for use by win and aura/wina. static void MovePluginWindowsHelper( HWND parent, - const std::vector<webkit::npapi::WebPluginGeometry>& moves); + const std::vector<WebPluginGeometry>& moves); static void PaintPluginWindowsHelper( HWND parent, diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc index f882e33..4fad173 100644 --- a/content/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc @@ -34,6 +34,7 @@ #include "content/common/gpu/gpu_messages.h" #include "content/common/input_messages.h" #include "content/common/view_messages.h" +#include "content/common/webplugin_geometry.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/common/content_switches.h" #include "skia/ext/platform_canvas.h" @@ -48,7 +49,6 @@ #include "ui/gfx/gtk_native_view_id_manager.h" #include "ui/gfx/gtk_preserve_window.h" #include "webkit/common/cursors/webcursor_gtk_data.h" -#include "webkit/plugins/npapi/webplugin.h" using WebKit::WebInputEventFactory; using WebKit::WebMouseWheelEvent; @@ -753,7 +753,7 @@ gfx::NativeViewAccessible RenderWidgetHostViewGtk::GetNativeViewAccessible() { void RenderWidgetHostViewGtk::MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) { + const std::vector<WebPluginGeometry>& moves) { for (size_t i = 0; i < moves.size(); ++i) { plugin_container_manager_.MovePluginContainer(moves[i]); } diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.h b/content/browser/renderer_host/render_widget_host_view_gtk.h index 8d17318..9ff410a 100644 --- a/content/browser/renderer_host/render_widget_host_view_gtk.h +++ b/content/browser/renderer_host/render_widget_host_view_gtk.h @@ -13,6 +13,7 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "content/browser/accessibility/browser_accessibility_manager.h" +#include "content/browser/renderer_host/gtk_plugin_container_manager.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/common/content_export.h" #include "ipc/ipc_sender.h" @@ -26,7 +27,6 @@ #include "ui/gfx/point.h" #include "ui/gfx/rect.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/npapi/gtk_plugin_container_manager.h" typedef struct _GtkClipboard GtkClipboard; typedef struct _GtkSelectionData GtkSelectionData; @@ -77,7 +77,7 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk virtual void WasHidden() OVERRIDE; virtual void MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; + const std::vector<WebPluginGeometry>& moves) OVERRIDE; virtual void Focus() OVERRIDE; virtual void Blur() OVERRIDE; virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; @@ -301,7 +301,7 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk scoped_ptr<GtkKeyBindingsHandler> key_bindings_handler_; // Helper class that lets us allocate plugin containers and move them. - webkit::npapi::GtkPluginContainerManager plugin_container_manager_; + GtkPluginContainerManager plugin_container_manager_; // The size that we want the renderer to be. We keep this in a separate // variable because resizing in GTK+ is async. diff --git a/content/browser/renderer_host/render_widget_host_view_guest.cc b/content/browser/renderer_host/render_widget_host_view_guest.cc index 37e56f1..4709a03 100644 --- a/content/browser/renderer_host/render_widget_host_view_guest.cc +++ b/content/browser/renderer_host/render_widget_host_view_guest.cc @@ -12,10 +12,10 @@ #include "content/common/browser_plugin/browser_plugin_messages.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/view_messages.h" +#include "content/common/webplugin_geometry.h" #include "content/public/common/content_switches.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/public/web/WebScreenInfo.h" -#include "webkit/plugins/npapi/webplugin.h" #if defined(OS_MACOSX) #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_helper.h" @@ -251,7 +251,7 @@ gfx::NativeViewAccessible RenderWidgetHostViewGuest::GetNativeViewAccessible() { void RenderWidgetHostViewGuest::MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) { + const std::vector<WebPluginGeometry>& moves) { platform_view_->MovePluginWindows(scroll_offset, moves); } diff --git a/content/browser/renderer_host/render_widget_host_view_guest.h b/content/browser/renderer_host/render_widget_host_view_guest.h index 84b721a..15b0acc 100644 --- a/content/browser/renderer_host/render_widget_host_view_guest.h +++ b/content/browser/renderer_host/render_widget_host_view_guest.h @@ -19,7 +19,7 @@ #include "webkit/common/cursors/webcursor.h" #if defined(TOOLKIT_GTK) -#include "webkit/plugins/npapi/gtk_plugin_container_manager.h" +#include "content/browser/renderer_host/gtk_plugin_container_manager.h" #endif // defined(TOOLKIT_GTK) namespace content { @@ -79,7 +79,7 @@ class CONTENT_EXPORT RenderWidgetHostViewGuest virtual void WasHidden() OVERRIDE; virtual void MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; + const std::vector<WebPluginGeometry>& moves) OVERRIDE; virtual void Focus() OVERRIDE; virtual void Blur() OVERRIDE; virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index 6aa1b75..9dd7539 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -242,7 +242,7 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase, virtual void WasHidden() OVERRIDE; virtual void MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; + const std::vector<WebPluginGeometry>& moves) OVERRIDE; virtual void Focus() OVERRIDE; virtual void Blur() OVERRIDE; virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 461e595..238ffe9 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -39,6 +39,7 @@ #include "content/common/gpu/gpu_messages.h" #include "content/common/input_messages.h" #include "content/common/view_messages.h" +#include "content/common/webplugin_geometry.h" #include "content/port/browser/render_widget_host_view_frame_subscriber.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/native_web_keyboard_event.h" @@ -61,7 +62,6 @@ #include "ui/gfx/screen.h" #include "ui/gfx/size_conversions.h" #include "ui/gl/io_surface_support_mac.h" -#include "webkit/plugins/npapi/webplugin.h" using content::BackingStoreMac; using content::BrowserAccessibility; @@ -797,7 +797,7 @@ gfx::NativeViewAccessible RenderWidgetHostViewMac::GetNativeViewAccessible() { void RenderWidgetHostViewMac::MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) { + const std::vector<WebPluginGeometry>& moves) { // Must be overridden, but unused on this platform. Core Animation // plugins are drawn by the GPU process (through the compositor), // and Core Graphics plugins are drawn by the renderer process. diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm index 72cf00f..64fbd43 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm @@ -22,7 +22,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/test/cocoa_test_event_utils.h" #import "ui/base/test/ui_cocoa_test_helper.h" -#include "webkit/plugins/npapi/webplugin.h" // Declare things that are part of the 10.7 SDK. #if !defined(MAC_OS_X_VERSION_10_7) || \ diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index 757d399..8916d05 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -39,7 +39,9 @@ #include "content/browser/renderer_host/ui_events_helper.h" #include "content/common/accessibility_messages.h" #include "content/common/gpu/gpu_messages.h" +#include "content/common/plugin_constants_win.h" #include "content/common/view_messages.h" +#include "content/common/webplugin_geometry.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_data.h" #include "content/public/browser/content_browser_client.h" @@ -72,9 +74,6 @@ #include "ui/gfx/rect_conversions.h" #include "ui/gfx/screen.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/npapi/plugin_constants_win.h" -#include "webkit/plugins/npapi/webplugin.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" #include "win8/util/win8_util.h" using base::TimeDelta; @@ -558,7 +557,7 @@ void RenderWidgetHostViewWin::CreateBrowserAccessibilityManagerIfNeeded() { void RenderWidgetHostViewWin::MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { + const std::vector<WebPluginGeometry>& plugin_window_moves) { MovePluginWindowsHelper(m_hWnd, plugin_window_moves); } @@ -2320,8 +2319,7 @@ LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT message, ::ScreenToClient(m_hWnd, &cursor_pos); HWND child_window = ::RealChildWindowFromPoint(m_hWnd, cursor_pos); if (::IsWindow(child_window) && child_window != m_hWnd) { - if (ui::GetClassName(child_window) == - webkit::npapi::kWrapperNativeWindowClassName) + if (ui::GetClassName(child_window) == kWrapperNativeWindowClassName) child_window = ::GetWindow(child_window, GW_CHILD); ::SetFocus(child_window); diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h index 325a4f4..5c13a0a 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.h +++ b/content/browser/renderer_host/render_widget_host_view_win.h @@ -175,7 +175,7 @@ class RenderWidgetHostViewWin virtual void WasHidden() OVERRIDE; virtual void MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; + const std::vector<WebPluginGeometry>& moves) OVERRIDE; virtual void Focus() OVERRIDE; virtual void Blur() OVERRIDE; virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h index 63a680c..0c3455a 100644 --- a/content/browser/renderer_host/test_render_view_host.h +++ b/content/browser/renderer_host/test_render_view_host.h @@ -93,7 +93,7 @@ class TestRenderWidgetHostView : public RenderWidgetHostViewBase { virtual void WasHidden() OVERRIDE {} virtual void MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE {} + const std::vector<WebPluginGeometry>& moves) OVERRIDE {} virtual void Focus() OVERRIDE {} virtual void Blur() OVERRIDE {} virtual void SetIsLoading(bool is_loading) OVERRIDE {} diff --git a/webkit/plugins/npapi/DEPS b/content/child/npapi/DEPS index d07f4af..d07f4af 100644 --- a/webkit/plugins/npapi/DEPS +++ b/content/child/npapi/DEPS diff --git a/webkit/plugins/npapi/OWNERS b/content/child/npapi/OWNERS index bd012ea..bd012ea 100644 --- a/webkit/plugins/npapi/OWNERS +++ b/content/child/npapi/OWNERS diff --git a/webkit/plugins/npapi/plugin_host.cc b/content/child/npapi/plugin_host.cc index 5428d15..c543301 100644 --- a/webkit/plugins/npapi/plugin_host.cc +++ b/content/child/npapi/plugin_host.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_host.h" +#include "content/child/npapi/plugin_host.h" #include "base/command_line.h" #include "base/file_util.h" @@ -13,6 +13,10 @@ #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_lib.h" +#include "content/child/npapi/plugin_stream_url.h" +#include "content/child/npapi/webplugin_delegate.h" #include "net/base/net_util.h" #include "third_party/WebKit/public/web/WebBindings.h" #include "third_party/WebKit/public/web/WebKit.h" @@ -21,10 +25,6 @@ #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface.h" #include "webkit/common/user_agent/user_agent.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/plugin_lib.h" -#include "webkit/plugins/npapi/plugin_stream_url.h" -#include "webkit/plugins/npapi/webplugin_delegate.h" #include "webkit/plugins/webplugininfo.h" #if defined(OS_MACOSX) @@ -40,8 +40,7 @@ void* NPN_GetJavaEnv(); void* NPN_GetJavaPeer(NPP); } -namespace webkit { -namespace npapi { +namespace content { // Finds a PluginInstance from an NPP. // The caller must take a reference if needed. @@ -299,15 +298,14 @@ bool PluginHost::SetPostData(const char* buf, return !err; } -} // namespace npapi -} // namespace webkit +} // namespace content extern "C" { -using webkit::npapi::FindInstance; -using webkit::npapi::PluginHost; -using webkit::npapi::PluginInstance; -using webkit::npapi::WebPlugin; +using content::FindInstance; +using content::PluginHost; +using content::PluginInstance; +using content::WebPlugin; // Allocates memory from the host's memory space. void* NPN_MemAlloc(uint32_t size) { @@ -791,7 +789,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { case NPNVsupportsInvalidatingCoreAnimationBool: case NPNVsupportsCoreAnimationBool: { NPBool* supports_model = reinterpret_cast<NPBool*>(value); - *supports_model = webkit::npapi::SupportsCoreAnimationPlugins(); + *supports_model = content::SupportsCoreAnimationPlugins(); rv = NPERR_NO_ERROR; break; } @@ -811,8 +809,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { } case NPNVsupportsCompositingCoreAnimationPluginsBool: { NPBool* supports_compositing = reinterpret_cast<NPBool*>(value); - *supports_compositing = - webkit::npapi::SupportsCoreAnimationPlugins(); + *supports_compositing = content::SupportsCoreAnimationPlugins(); rv = NPERR_NO_ERROR; break; } @@ -879,7 +876,7 @@ NPError NPN_SetValue(NPP id, NPPVariable variable, void* value) { if (model == NPDrawingModelCoreGraphics || ((model == NPDrawingModelInvalidatingCoreAnimation || model == NPDrawingModelCoreAnimation) && - webkit::npapi::SupportsCoreAnimationPlugins())) { + content::SupportsCoreAnimationPlugins())) { plugin->set_drawing_model(static_cast<NPDrawingModel>(model)); return NPERR_NO_ERROR; } diff --git a/webkit/plugins/npapi/plugin_host.h b/content/child/npapi/plugin_host.h index 4eb38dc..90632fe 100644 --- a/webkit/plugins/npapi/plugin_host.h +++ b/content/child/npapi/plugin_host.h @@ -4,8 +4,8 @@ // TODO: Need mechanism to cleanup the static instance -#ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_HOST_H_ -#define WEBKIT_PLUGINS_NPAPI_PLUGIN_HOST_H_ +#ifndef CONTENT_CHILD_NPAPI_PLUGIN_HOST_H_ +#define CONTENT_CHILD_NPAPI_PLUGIN_HOST_H_ #include <string> #include <vector> @@ -13,10 +13,8 @@ #include "base/memory/ref_counted.h" #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/nphostapi.h" -#include "webkit/plugins/webkit_plugins_export.h" -namespace webkit { -namespace npapi { +namespace content { // The Plugin Host implements the NPN_xxx functions for NPAPI plugins. // These are the functions exposed from the Plugin Host for use @@ -29,7 +27,7 @@ class PluginHost : public base::RefCounted<PluginHost> { public: // Access the single PluginHost instance. Callers // must call deref() when finished with the object. - WEBKIT_PLUGINS_EXPORT static PluginHost* Singleton(); + static PluginHost* Singleton(); // The table of functions provided to the plugin. NPNetscapeFuncs* host_functions() { return &host_funcs_; } @@ -44,7 +42,7 @@ class PluginHost : public base::RefCounted<PluginHost> { std::vector<std::string>* values, std::vector<char>* body); - WEBKIT_PLUGINS_EXPORT void PatchNPNetscapeFuncs(NPNetscapeFuncs* overrides); + void PatchNPNetscapeFuncs(NPNetscapeFuncs* overrides); private: friend class base::RefCounted<PluginHost>; @@ -57,7 +55,6 @@ class PluginHost : public base::RefCounted<PluginHost> { DISALLOW_COPY_AND_ASSIGN(PluginHost); }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_HOST_H_ +#endif // CONTENT_CHILD_NPAPI_PLUGIN_HOST_H_ diff --git a/webkit/plugins/npapi/plugin_instance.cc b/content/child/npapi/plugin_instance.cc index e6eceb1..ac4c8b4 100644 --- a/webkit/plugins/npapi/plugin_instance.cc +++ b/content/child/npapi/plugin_instance.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_instance.h" #include "base/bind.h" #include "base/file_util.h" @@ -10,21 +10,20 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" +#include "content/child/npapi/plugin_host.h" +#include "content/child/npapi/plugin_lib.h" +#include "content/child/npapi/plugin_stream_url.h" +#include "content/child/npapi/plugin_string_stream.h" +#include "content/child/npapi/webplugin.h" +#include "content/child/npapi/webplugin_delegate.h" #include "net/base/escape.h" -#include "webkit/plugins/npapi/plugin_host.h" -#include "webkit/plugins/npapi/plugin_lib.h" -#include "webkit/plugins/npapi/plugin_stream_url.h" -#include "webkit/plugins/npapi/plugin_string_stream.h" -#include "webkit/plugins/npapi/webplugin.h" -#include "webkit/plugins/npapi/webplugin_delegate.h" #include "webkit/plugins/plugin_constants.h" #if defined(OS_MACOSX) #include <ApplicationServices/ApplicationServices.h> #endif -namespace webkit { -namespace npapi { +namespace content { PluginInstance::PluginInstance(PluginLib* plugin, const std::string& mime_type) : plugin_(plugin), @@ -685,5 +684,4 @@ void PluginInstance::URLRedirectResponse(bool allow, void* notify_data) { } } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_instance.h b/content/child/npapi/plugin_instance.h index 6854500..a776a15 100644 --- a/webkit/plugins/npapi/plugin_instance.h +++ b/content/child/npapi/plugin_instance.h @@ -5,8 +5,8 @@ // TODO: Need to deal with NPAPI's NPSavedData. // I haven't seen plugins use it yet. -#ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_ -#define WEBKIT_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_ +#ifndef CONTENT_CHILD_NPAPI_PLUGIN_INSTANCE_H_ +#define CONTENT_CHILD_NPAPI_PLUGIN_INSTANCE_H_ #include <map> #include <stack> @@ -27,8 +27,7 @@ namespace base { class MessageLoop; } -namespace webkit { -namespace npapi { +namespace content { class PluginLib; class PluginHost; @@ -368,7 +367,6 @@ class ScopedCurrentPluginEvent { }; #endif -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_ +#endif // CONTENT_CHILD_NPAPI_PLUGIN_INSTANCE_H_ diff --git a/webkit/plugins/npapi/plugin_instance_mac.mm b/content/child/npapi/plugin_instance_mac.mm index 2a51986..5453f8f 100644 --- a/webkit/plugins/npapi/plugin_instance_mac.mm +++ b/content/child/npapi/plugin_instance_mac.mm @@ -6,7 +6,7 @@ #include "base/logging.h" #include "build/build_config.h" -#include "webkit/plugins/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_instance.h" // When C++ exceptions are disabled, the C++ library defines |try| and // |catch| so as to allow exception-expecting C++ code to build properly when @@ -17,8 +17,7 @@ #undef try #undef catch -namespace webkit { -namespace npapi { +namespace content { namespace { @@ -104,5 +103,4 @@ ScopedCurrentPluginEvent::~ScopedCurrentPluginEvent() { instance_->set_currently_handled_event(NULL); } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_lib.cc b/content/child/npapi/plugin_lib.cc index f62775e..13d743b 100644 --- a/webkit/plugins/npapi/plugin_lib.cc +++ b/content/child/npapi/plugin_lib.cc @@ -2,19 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_lib.h" +#include "content/child/npapi/plugin_lib.h" #include "base/bind.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "base/metrics/stats_counters.h" #include "base/strings/string_util.h" -#include "webkit/plugins/npapi/plugin_host.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/plugin_list.h" +#include "content/child/npapi/plugin_host.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/common/plugin_list.h" -namespace webkit { -namespace npapi { +namespace content { const char kPluginLibrariesLoadedCounter[] = "PluginLibrariesLoaded"; const char kPluginInstancesActiveCounter[] = "PluginInstancesActive"; @@ -333,5 +332,4 @@ void PluginLib::Shutdown() { } } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_lib.h b/content/child/npapi/plugin_lib.h index 21ac124..9d71353 100644 --- a/webkit/plugins/npapi/plugin_lib.h +++ b/content/child/npapi/plugin_lib.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_LIB_H_ -#define WEBKIT_PLUGINS_NPAPI_PLUGIN_LIB_H_ +#ifndef CONTENT_CHILD_NPAPI_PLUGIN_LIB_H_ +#define CONTENT_CHILD_NPAPI_PLUGIN_LIB_H_ #include <string> #include <vector> @@ -12,17 +12,16 @@ #include "base/memory/ref_counted.h" #include "base/native_library.h" #include "build/build_config.h" +#include "content/child/npapi/webplugin.h" +#include "content/common/content_export.h" #include "third_party/npapi/bindings/nphostapi.h" -#include "webkit/plugins/npapi/webplugin.h" -#include "webkit/plugins/webkit_plugins_export.h" #include "webkit/plugins/webplugininfo.h" namespace base { class FilePath; } -namespace webkit { -namespace npapi { +namespace content { class PluginInstance; @@ -40,7 +39,7 @@ struct PluginEntryPoints { // A PluginLib is a single NPAPI Plugin Library, and is the lifecycle // manager for new PluginInstances. -class WEBKIT_PLUGINS_EXPORT PluginLib : public base::RefCounted<PluginLib> { +class CONTENT_EXPORT PluginLib : public base::RefCounted<PluginLib> { public: static PluginLib* CreatePluginLib(const base::FilePath& filename); @@ -129,7 +128,6 @@ class WEBKIT_PLUGINS_EXPORT PluginLib : public base::RefCounted<PluginLib> { DISALLOW_COPY_AND_ASSIGN(PluginLib); }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIB_H_ +#endif // CONTENT_CHILD_NPAPI_PLUGIN_LIB_H_ diff --git a/webkit/plugins/npapi/plugin_lib_unittest.cc b/content/child/npapi/plugin_lib_unittest.cc index 3dc2a9c..2193b8d 100644 --- a/webkit/plugins/npapi/plugin_lib_unittest.cc +++ b/content/child/npapi/plugin_lib_unittest.cc @@ -2,22 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_lib.h" +#include "content/child/npapi/plugin_lib.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" -namespace webkit { -namespace npapi { +namespace content { // Test the unloading of plugin libs. Bug http://crbug.com/46526 showed that // if UnloadAllPlugins() simply iterates through the g_loaded_libs global // variable, we can get a crash if no plugin libs were marked as always loaded. class PluginLibTest : public PluginLib { public: - PluginLibTest() : PluginLib(WebPluginInfo()) {} + PluginLibTest() : PluginLib(webkit::WebPluginInfo()) {} using PluginLib::Unload; protected: @@ -62,5 +61,4 @@ TEST(PluginLibLoading, UnloadAllPlugins) { PluginLib::UnloadAllPlugins(); } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_stream.cc b/content/child/npapi/plugin_stream.cc index 368c3a7..6656678 100644 --- a/webkit/plugins/npapi/plugin_stream.cc +++ b/content/child/npapi/plugin_stream.cc @@ -6,7 +6,7 @@ // TODO : Support NP_SEEK mode // TODO : Support SEEKABLE=true in NewStream -#include "webkit/plugins/npapi/plugin_stream.h" +#include "content/child/npapi/plugin_stream.h" #include <algorithm> @@ -14,12 +14,11 @@ #include "base/message_loop/message_loop.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "content/child/npapi/plugin_instance.h" #include "net/base/mime_util.h" #include "url/gurl.h" -#include "webkit/plugins/npapi/plugin_instance.h" -namespace webkit { -namespace npapi { +namespace content { PluginStream::PluginStream( PluginInstance* instance, @@ -285,5 +284,4 @@ bool PluginStream::RequestedPluginModeIsAsFile() const { requested_plugin_mode_ == NP_ASFILEONLY); } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_stream.h b/content/child/npapi/plugin_stream.h index ec987be..af7ad28 100644 --- a/webkit/plugins/npapi/plugin_stream.h +++ b/content/child/npapi/plugin_stream.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_H_ -#define WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_H_ +#ifndef CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_ +#define CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_ #include <string> #include <vector> @@ -13,8 +13,7 @@ #include "build/build_config.h" #include "third_party/npapi/bindings/npapi.h" -namespace webkit { -namespace npapi { +namespace content { class PluginInstance; class WebPluginResourceClient; @@ -155,7 +154,6 @@ class PluginStream : public base::RefCounted<PluginStream> { DISALLOW_COPY_AND_ASSIGN(PluginStream); }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_H_ +#endif // CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_ diff --git a/webkit/plugins/npapi/plugin_stream_posix.cc b/content/child/npapi/plugin_stream_posix.cc index 70b745c..47812688 100644 --- a/webkit/plugins/npapi/plugin_stream_posix.cc +++ b/content/child/npapi/plugin_stream_posix.cc @@ -2,17 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_stream.h" +#include "content/child/npapi/plugin_stream.h" #include <string.h> #include "base/file_util.h" #include "base/files/file_path.h" #include "base/logging.h" -#include "webkit/plugins/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_instance.h" -namespace webkit { -namespace npapi { +namespace content { void PluginStream::ResetTempFileHandle() { temp_file_ = NULL; @@ -57,5 +56,4 @@ bool PluginStream::TempFileIsValid() const { return temp_file_ != NULL; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_stream_url.cc b/content/child/npapi/plugin_stream_url.cc index d94f25f..b68d8df 100644 --- a/webkit/plugins/npapi/plugin_stream_url.cc +++ b/content/child/npapi/plugin_stream_url.cc @@ -2,18 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_stream_url.h" +#include "content/child/npapi/plugin_stream_url.h" #include <algorithm> +#include "content/child/npapi/plugin_host.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_lib.h" +#include "content/child/npapi/webplugin.h" #include "net/http/http_response_headers.h" -#include "webkit/plugins/npapi/plugin_host.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/plugin_lib.h" -#include "webkit/plugins/npapi/webplugin.h" -namespace webkit { -namespace npapi { +namespace content { PluginStreamUrl::PluginStreamUrl( unsigned long resource_id, @@ -160,5 +159,4 @@ void PluginStreamUrl::SetDeferLoading(bool value) { value); } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_stream_url.h b/content/child/npapi/plugin_stream_url.h index d6c0548..7787642 100644 --- a/webkit/plugins/npapi/plugin_stream_url.h +++ b/content/child/npapi/plugin_stream_url.h @@ -7,12 +7,11 @@ #include <vector> +#include "content/child/npapi/plugin_stream.h" +#include "content/child/npapi/webplugin.h" #include "url/gurl.h" -#include "webkit/plugins/npapi/plugin_stream.h" -#include "webkit/plugins/npapi/webplugin.h" -namespace webkit { -namespace npapi { +namespace content { class PluginInstance; @@ -68,7 +67,6 @@ class PluginStreamUrl : public PluginStream, DISALLOW_COPY_AND_ASSIGN(PluginStreamUrl); }; -} // namespace npapi -} // namespace webkit +} // namespace content #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ diff --git a/webkit/plugins/npapi/plugin_stream_win.cc b/content/child/npapi/plugin_stream_win.cc index 1db0663..af55f2f 100644 --- a/webkit/plugins/npapi/plugin_stream_win.cc +++ b/content/child/npapi/plugin_stream_win.cc @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_stream.h" +#include "content/child/npapi/plugin_stream.h" #include "base/logging.h" -#include "webkit/plugins/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_instance.h" -namespace webkit { -namespace npapi { +namespace content { void PluginStream::ResetTempFileHandle() { temp_file_handle_ = INVALID_HANDLE_VALUE; @@ -77,5 +76,4 @@ bool PluginStream::TempFileIsValid() const { return temp_file_handle_ != INVALID_HANDLE_VALUE; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_string_stream.cc b/content/child/npapi/plugin_string_stream.cc index c2d5bf3..15f38ad 100644 --- a/webkit/plugins/npapi/plugin_string_stream.cc +++ b/content/child/npapi/plugin_string_stream.cc @@ -2,12 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_string_stream.h" +#include "content/child/npapi/plugin_string_stream.h" #include "url/gurl.h" -namespace webkit { -namespace npapi { +namespace content { PluginStringStream::PluginStringStream( PluginInstance* instance, @@ -35,5 +34,4 @@ void PluginStringStream::SendToPlugin(const std::string &data, } } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_string_stream.h b/content/child/npapi/plugin_string_stream.h index 1fdeea2..8445003 100644 --- a/webkit/plugins/npapi/plugin_string_stream.h +++ b/content/child/npapi/plugin_string_stream.h @@ -2,15 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_STRING_STREAM_H_ -#define WEBKIT_PLUGINS_NPAPI_PLUGIN_STRING_STREAM_H_ +#ifndef CONTENT_CHILD_PLUGIN_STRING_STREAM_H_ +#define CONTENT_CHILD_PLUGIN_STRING_STREAM_H_ -#include "webkit/plugins/npapi/plugin_stream.h" +#include "content/child/npapi/plugin_stream.h" class GURL; -namespace webkit { -namespace npapi { +namespace content { class PluginInstance; @@ -36,7 +35,6 @@ class PluginStringStream : public PluginStream { }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_STRING_STREAM_H_ +#endif // CONTENT_CHILD_PLUGIN_STRING_STREAM_H_ diff --git a/webkit/plugins/npapi/plugin_web_event_converter_mac.h b/content/child/npapi/plugin_web_event_converter_mac.h index 47a8e49..3c943f6 100644 --- a/webkit/plugins/npapi/plugin_web_event_converter_mac.h +++ b/content/child/npapi/plugin_web_event_converter_mac.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_ -#define WEBKIT_PLUGINS_NPAPI_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_ +#ifndef CONTENT_CHILD_NPAPI_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_ +#define CONTENT_CHILD_NPAPI_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_ #include "third_party/npapi/bindings/npapi.h" @@ -14,8 +14,7 @@ class WebMouseEvent; class WebMouseWheelEvent; } -namespace webkit { -namespace npapi { +namespace content { // Utility class to translating WebInputEvent structs to equivalent structures // suitable for sending to Mac plugins (via NPP_HandleEvent). @@ -50,7 +49,6 @@ class PluginWebEventConverter { DISALLOW_COPY_AND_ASSIGN(PluginWebEventConverter); }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_ +#endif // CONTENT_CHILD_NPAPI_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_ diff --git a/webkit/plugins/npapi/plugin_web_event_converter_mac.mm b/content/child/npapi/plugin_web_event_converter_mac.mm index c469c06..091fd71 100644 --- a/webkit/plugins/npapi/plugin_web_event_converter_mac.mm +++ b/content/child/npapi/plugin_web_event_converter_mac.mm @@ -5,7 +5,7 @@ #import <Cocoa/Cocoa.h> #include "base/logging.h" -#include "webkit/plugins/npapi/plugin_web_event_converter_mac.h" +#include "content/child/npapi/plugin_web_event_converter_mac.h" #include "third_party/WebKit/public/web/WebInputEvent.h" using WebKit::WebInputEvent; @@ -13,8 +13,7 @@ using WebKit::WebKeyboardEvent; using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; -namespace webkit { -namespace npapi { +namespace content { namespace { @@ -186,5 +185,4 @@ NSUInteger PluginWebEventConverter::CocoaModifiers( return modifiers; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/webplugin.h b/content/child/npapi/webplugin.h index 20929d2..eb13cbd 100644 --- a/webkit/plugins/npapi/webplugin.h +++ b/content/child/npapi/webplugin.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_H_ +#ifndef CONTENT_CHILD_NPAPI_WEBPLUGIN_H_ +#define CONTENT_CHILD_NPAPI_WEBPLUGIN_H_ #include <string> #include <vector> @@ -12,7 +12,6 @@ #include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" #include "ui/gl/gpu_preference.h" -#include "webkit/plugins/webkit_plugins_export.h" // TODO(port): this typedef is obviously incorrect on non-Windows // platforms, but now a lot of code now accidentally depends on them @@ -22,43 +21,13 @@ typedef void* HANDLE; class GURL; struct NPObject; -namespace webkit { -namespace npapi { +namespace content { class WebPluginResourceClient; #if defined(OS_MACOSX) class WebPluginAcceleratedSurface; #endif -// Describes the new location for a plugin window. -struct WEBKIT_PLUGINS_EXPORT WebPluginGeometry { - WebPluginGeometry(); - ~WebPluginGeometry(); - - bool Equals(const WebPluginGeometry& rhs) const; - - // On Windows, this is the plugin window in the plugin process. - // On X11, this is the XID of the plugin-side GtkPlug containing the - // GtkSocket hosting the actual plugin window. - // - // On Mac OS X, all of the plugin types are currently "windowless" - // (window == 0) except for the special case of the GPU plugin, - // which currently performs rendering on behalf of the Pepper 3D API - // and WebGL. The GPU plugin uses a simple integer for the - // PluginWindowHandle which is used to map to a side data structure - // containing information about the plugin. Soon this plugin will be - // generalized, at which point this mechanism will be rethought or - // removed. - gfx::PluginWindowHandle window; - gfx::Rect window_rect; - // Clip rect (include) and cutouts (excludes), relative to - // window_rect origin. - gfx::Rect clip_rect; - std::vector<gfx::Rect> cutout_rects; - bool rects_valid; - bool visible; -}; - // The WebKit side of a plugin implementation. It provides wrappers around // operations that need to interact with the frame and other WebCore objects. class WebPlugin { @@ -192,7 +161,6 @@ class WebPluginResourceClient { virtual void AddRangeRequestResourceId(unsigned long resource_id) { } }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_H_ +#endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_H_ diff --git a/webkit/plugins/npapi/webplugin_accelerated_surface_mac.h b/content/child/npapi/webplugin_accelerated_surface_mac.h index 8242918..f0e6d6f 100644 --- a/webkit/plugins/npapi/webplugin_accelerated_surface_mac.h +++ b/content/child/npapi/webplugin_accelerated_surface_mac.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_ACCELERATED_SURFACE_MAC_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_ACCELERATED_SURFACE_MAC_H_ +#ifndef CONTENT_CHILD_NPAPI_WEBPLUGIN_ACCELERATED_SURFACE_MAC_H_ +#define CONTENT_CHILD_NPAPI_WEBPLUGIN_ACCELERATED_SURFACE_MAC_H_ #include "ui/gfx/native_widget_types.h" #include "ui/gfx/size.h" @@ -11,8 +11,7 @@ // Avoid having to include OpenGL headers here. typedef struct _CGLContextObject* CGLContextObj; -namespace webkit { -namespace npapi { +namespace content { // Interface class for interacting with an accelerated plugin surface, used // for the Core Animation flavors of plugin drawing on the Mac. @@ -35,7 +34,6 @@ class WebPluginAcceleratedSurface { virtual void EndDrawing() = 0; }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_ACCELERATED_SURFACE_MAC_H_ +#endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_ACCELERATED_SURFACE_MAC_H_ diff --git a/webkit/plugins/npapi/webplugin_delegate.h b/content/child/npapi/webplugin_delegate.h index 959dd73..a05d1ff 100644 --- a/webkit/plugins/npapi/webplugin_delegate.h +++ b/content/child/npapi/webplugin_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_H_ +#ifndef CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_H_ +#define CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_H_ #include <string> #include <vector> @@ -14,7 +14,6 @@ #include "third_party/npapi/bindings/npapi.h" #include "ui/gfx/native_widget_types.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/webkit_plugins_export.h" class GURL; struct NPObject; @@ -27,14 +26,13 @@ namespace gfx { class Rect; } -namespace webkit { -namespace npapi { +namespace content { class WebPlugin; class WebPluginResourceClient; // This is the interface that a plugin implementation needs to provide. -class WEBKIT_PLUGINS_EXPORT WebPluginDelegate { +class WebPluginDelegate { public: virtual ~WebPluginDelegate() {} @@ -133,7 +131,6 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegate { unsigned long resource_id, int range_request_id) = 0; }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_H_ +#endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_H_ diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.cc b/content/child/npapi/webplugin_delegate_impl.cc index a6fe564..a43d55a 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl.cc +++ b/content/child/npapi/webplugin_delegate_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" +#include "content/child/npapi/webplugin_delegate_impl.h" #include <string> #include <vector> @@ -11,18 +11,17 @@ #include "base/message_loop/message_loop.h" #include "base/process_util.h" #include "base/strings/string_util.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_lib.h" +#include "content/child/npapi/plugin_stream_url.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/plugin_lib.h" -#include "webkit/plugins/npapi/plugin_stream_url.h" #include "webkit/plugins/npapi/plugin_utils.h" using WebKit::WebCursorInfo; using WebKit::WebInputEvent; -namespace webkit { -namespace npapi { +namespace content { WebPluginDelegateImpl* WebPluginDelegateImpl::Create( const base::FilePath& filename, @@ -306,5 +305,4 @@ WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient( return resource_client; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.h b/content/child/npapi/webplugin_delegate_impl.h index c1e8056..c9dc00b 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl.h +++ b/content/child/npapi/webplugin_delegate_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ +#ifndef CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ +#define CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ #include <string> #include <vector> @@ -14,12 +14,11 @@ #include "base/sequenced_task_runner_helpers.h" #include "base/timer/timer.h" #include "build/build_config.h" +#include "content/child/npapi/webplugin_delegate.h" #include "third_party/npapi/bindings/npapi.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/npapi/webplugin_delegate.h" -#include "webkit/plugins/webkit_plugins_export.h" #if defined(USE_X11) #include "ui/base/x/x11_util.h" @@ -41,8 +40,7 @@ class CARenderer; #endif #endif -namespace webkit { -namespace npapi { +namespace content { class PluginInstance; @@ -57,7 +55,7 @@ class WebPluginIMEWin; // An implementation of WebPluginDelegate that runs in the plugin process, // proxied from the renderer by WebPluginDelegateProxy. -class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { +class WebPluginDelegateImpl : public WebPluginDelegate { public: enum PluginQuirks { PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 @@ -82,22 +80,6 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { static WebPluginDelegateImpl* Create(const base::FilePath& filename, const std::string& mime_type); -#if defined(OS_WIN) - static bool IsPluginDelegateWindow(HWND window); - static bool GetPluginNameFromWindow(HWND window, - base::string16* plugin_name); - static bool GetPluginVersionFromWindow(HWND window, - base::string16* plugin_version); - - // Returns true if the window handle passed in is that of the dummy - // activation window for windowless plugins. - static bool IsDummyActivationWindow(HWND window); - - // Returns the default HWND to parent the windowed plugins and dummy windows - // for activation to when none isavailable. - static HWND GetDefaultWindowParent(); -#endif - // WebPluginDelegate implementation virtual bool Initialize(const GURL& url, const std::vector<std::string>& arg_names, @@ -501,7 +483,6 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ +#endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_android.cc b/content/child/npapi/webplugin_delegate_impl_android.cc index 610201d..2bc19ed 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_android.cc +++ b/content/child/npapi/webplugin_delegate_impl_android.cc @@ -2,18 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" +#include "content/child/npapi/webplugin_delegate_impl.h" #include "base/basictypes.h" #include "base/logging.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/webplugin.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/webplugin.h" using WebKit::WebInputEvent; -namespace webkit { -namespace npapi { +namespace content { WebPluginDelegateImpl::WebPluginDelegateImpl( PluginInstance* instance) @@ -77,5 +76,4 @@ bool WebPluginDelegateImpl::PlatformHandleInputEvent( return false; } -} // namespace npapi -} // namespace webkit +} // content diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc b/content/child/npapi/webplugin_delegate_impl_aura.cc index 24c4cb6..2389798 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc +++ b/content/child/npapi/webplugin_delegate_impl_aura.cc @@ -2,15 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" +#include "content/child/npapi/webplugin_delegate_impl.h" +#include "content/child/npapi/plugin_instance.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/npapi/plugin_instance.h" using WebKit::WebInputEvent; -namespace webkit { -namespace npapi { +namespace content { WebPluginDelegateImpl::WebPluginDelegateImpl(PluginInstance* instance) { } @@ -64,5 +63,4 @@ bool WebPluginDelegateImpl::PlatformHandleInputEvent( return false; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc b/content/child/npapi/webplugin_delegate_impl_gtk.cc index ec4d1a8..9b608b9 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc +++ b/content/child/npapi/webplugin_delegate_impl_gtk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" +#include "content/child/npapi/webplugin_delegate_impl.h" #include <gtk/gtk.h> #include <gdk/gdkx.h> @@ -11,13 +11,13 @@ #include <vector> #include "base/metrics/stats_counters.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/webplugin.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "ui/base/gtk/gtk_compat.h" #include "ui/gfx/blit.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/plugin_constants.h" #include "third_party/npapi/bindings/npapi_x11.h" @@ -26,8 +26,7 @@ using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; using WebKit::WebMouseEvent; -namespace webkit { -namespace npapi { +namespace content { WebPluginDelegateImpl::WebPluginDelegateImpl( PluginInstance* instance) @@ -749,5 +748,4 @@ bool WebPluginDelegateImpl::PlatformHandleInputEvent( return ret; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm b/content/child/npapi/webplugin_delegate_impl_mac.mm index edb15dd..31b5966 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm +++ b/content/child/npapi/webplugin_delegate_impl_mac.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" +#include "content/child/npapi/webplugin_delegate_impl.h" #import <Cocoa/Cocoa.h> #import <QuartzCore/QuartzCore.h> @@ -17,28 +17,28 @@ #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_lib.h" +#include "content/child/npapi/plugin_web_event_converter_mac.h" +#include "content/child/npapi/webplugin.h" +#include "content/child/npapi/webplugin_accelerated_surface_mac.h" #include "skia/ext/skia_utils_mac.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/plugin_lib.h" -#include "webkit/plugins/npapi/plugin_web_event_converter_mac.h" -#include "webkit/plugins/npapi/webplugin.h" -#include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h" using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; using WebKit::WebMouseEvent; using WebKit::WebMouseWheelEvent; +using webkit::WebPluginInfo; // Important implementation notes: The Mac definition of NPAPI, particularly // the distinction between windowed and windowless modes, differs from the // Windows and Linux definitions. Most of those differences are // accomodated by the WebPluginDelegate class. -namespace webkit { -namespace npapi { +namespace content { namespace { @@ -726,5 +726,4 @@ void WebPluginDelegateImpl::UpdateAcceleratedSurface() { PluginVisibilityChanged(); } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc b/content/child/npapi/webplugin_delegate_impl_win.cc index 90d8586..4467c37 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc +++ b/content/child/npapi/webplugin_delegate_impl_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" +#include "content/child/npapi/webplugin_delegate_impl.h" #include <map> #include <set> @@ -22,33 +22,30 @@ #include "base/win/iat_patch_function.h" #include "base/win/registry.h" #include "base/win/windows_version.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_lib.h" +#include "content/child/npapi/plugin_stream_url.h" +#include "content/child/npapi/webplugin.h" +#include "content/child/npapi/webplugin_ime_win.h" +#include "content/common/plugin_constants_win.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "ui/base/win/dpi.h" #include "ui/base/win/hwnd_util.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/npapi/plugin_constants_win.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/plugin_lib.h" -#include "webkit/plugins/npapi/plugin_stream_url.h" #include "webkit/plugins/npapi/plugin_utils.h" -#include "webkit/plugins/npapi/webplugin.h" -#include "webkit/plugins/npapi/webplugin_ime_win.h" #include "webkit/plugins/plugin_constants.h" using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; using WebKit::WebMouseEvent; +using webkit::WebPluginInfo; -namespace webkit { -namespace npapi { +namespace content { namespace { const wchar_t kWebPluginDelegateProperty[] = L"WebPluginDelegateProperty"; -const wchar_t kPluginNameAtomProperty[] = L"PluginNameAtom"; -const wchar_t kPluginVersionAtomProperty[] = L"PluginVersionAtom"; -const wchar_t kDummyActivationWindowName[] = L"DummyWindowForActivation"; const wchar_t kPluginFlashThrottle[] = L"FlashThrottle"; // The fastest we are willing to process WM_USER+1 events for Flash. @@ -201,59 +198,8 @@ int GetPluginMajorVersion(const WebPluginInfo& plugin_info) { return major_version; } -bool GetPluginPropertyFromWindow( - HWND window, const wchar_t* plugin_atom_property, - base::string16* plugin_property) { - ATOM plugin_atom = reinterpret_cast<ATOM>( - GetPropW(window, plugin_atom_property)); - if (plugin_atom != 0) { - WCHAR plugin_property_local[MAX_PATH] = {0}; - GlobalGetAtomNameW(plugin_atom, - plugin_property_local, - ARRAYSIZE(plugin_property_local)); - *plugin_property = plugin_property_local; - return true; - } - return false; -} - } // namespace -bool WebPluginDelegateImpl::IsPluginDelegateWindow(HWND window) { - return ui::GetClassName(window) == base::string16(kNativeWindowClassName); -} - -// static -bool WebPluginDelegateImpl::GetPluginNameFromWindow( - HWND window, base::string16* plugin_name) { - return IsPluginDelegateWindow(window) && - GetPluginPropertyFromWindow( - window, kPluginNameAtomProperty, plugin_name); -} - -// static -bool WebPluginDelegateImpl::GetPluginVersionFromWindow( - HWND window, base::string16* plugin_version) { - return IsPluginDelegateWindow(window) && - GetPluginPropertyFromWindow( - window, kPluginVersionAtomProperty, plugin_version); -} - -bool WebPluginDelegateImpl::IsDummyActivationWindow(HWND window) { - if (!IsWindow(window)) - return false; - - wchar_t window_title[MAX_PATH + 1] = {0}; - if (GetWindowText(window, window_title, arraysize(window_title))) { - return (0 == lstrcmpiW(window_title, kDummyActivationWindowName)); - } - return false; -} - -HWND WebPluginDelegateImpl::GetDefaultWindowParent() { - return GetDesktopWindow(); -} - LRESULT CALLBACK WebPluginDelegateImpl::HandleEventMessageFilterHook( int code, WPARAM wParam, LPARAM lParam) { if (g_current_plugin_instance) { @@ -512,14 +458,14 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() { // The window will be sized and shown later. windowed_handle_ = CreateWindowEx( WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, - kNativeWindowClassName, + webkit::npapi::kNativeWindowClassName, 0, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, 0, 0, - GetDefaultWindowParent(), + webkit::npapi::GetDefaultWindowParent(), 0, GetModuleHandle(NULL), 0); @@ -552,7 +498,7 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() { ATOM plugin_name_atom = GlobalAddAtomW(plugin_name.c_str()); DCHECK_NE(0, plugin_name_atom); result = SetProp(windowed_handle_, - kPluginNameAtomProperty, + webkit::npapi::kPluginNameAtomProperty, reinterpret_cast<HANDLE>(plugin_name_atom)); DCHECK(result == TRUE) << "SetProp failed, last error = " << GetLastError(); @@ -562,7 +508,7 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() { ATOM plugin_version_atom = GlobalAddAtomW(plugin_version.c_str()); DCHECK_NE(0, plugin_version_atom); result = SetProp(windowed_handle_, - kPluginVersionAtomProperty, + webkit::npapi::kPluginVersionAtomProperty, reinterpret_cast<HANDLE>(plugin_version_atom)); DCHECK(result == TRUE) << "SetProp failed, last error = " << GetLastError(); @@ -786,7 +732,7 @@ bool WebPluginDelegateImpl::CreateDummyWindowForActivation() { dummy_window_for_activation_ = CreateWindowEx( 0, L"Static", - kDummyActivationWindowName, + webkit::npapi::kDummyActivationWindowName, WS_CHILD, 0, 0, @@ -794,7 +740,7 @@ bool WebPluginDelegateImpl::CreateDummyWindowForActivation() { 0, // We don't know the parent of the dummy window yet, so just set it to the // desktop and it'll get parented by the browser. - GetDefaultWindowParent(), + webkit::npapi::GetDefaultWindowParent(), 0, GetModuleHandle(NULL), 0); @@ -927,7 +873,7 @@ ATOM WebPluginDelegateImpl::RegisterNativeWindowClass() { // implement WM_ERASEBKGND correctly if we have a valid background brush. wcex.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1); wcex.lpszMenuName = 0; - wcex.lpszClassName = kNativeWindowClassName; + wcex.lpszClassName = webkit::npapi::kNativeWindowClassName; wcex.hIconSm = 0; return RegisterClassEx(&wcex); @@ -1060,11 +1006,11 @@ LRESULT CALLBACK WebPluginDelegateImpl::NativeWndProc( if (message == WM_NCDESTROY) { RemoveProp(hwnd, kWebPluginDelegateProperty); ATOM plugin_name_atom = reinterpret_cast<ATOM>( - RemoveProp(hwnd, kPluginNameAtomProperty)); + RemoveProp(hwnd, webkit::npapi::kPluginNameAtomProperty)); if (plugin_name_atom != 0) GlobalDeleteAtom(plugin_name_atom); ATOM plugin_version_atom = reinterpret_cast<ATOM>( - RemoveProp(hwnd, kPluginVersionAtomProperty)); + RemoveProp(hwnd, webkit::npapi::kPluginVersionAtomProperty)); if (plugin_version_atom != 0) GlobalDeleteAtom(plugin_version_atom); ClearThrottleQueueForWindow(hwnd); @@ -1308,7 +1254,8 @@ bool WebPluginDelegateImpl::PlatformHandleInputEvent( // also require some changes in RenderWidgetHost to detect this in the // WM_MOUSEACTIVATE handler and inform the renderer accordingly. bool valid = - GetParent(dummy_window_for_activation_) != GetDefaultWindowParent(); + GetParent(dummy_window_for_activation_) != + webkit::npapi::GetDefaultWindowParent(); if (valid) { last_focus_window = ::SetFocus(dummy_window_for_activation_); } else { @@ -1432,7 +1379,7 @@ BOOL WINAPI WebPluginDelegateImpl::TrackPopupMenuPatch( if (::GetCurrentThreadId() != window_thread_id) { bool valid = GetParent(g_current_plugin_instance->dummy_window_for_activation_) != - GetDefaultWindowParent(); + webkit::npapi::GetDefaultWindowParent(); if (valid) { window = g_current_plugin_instance->dummy_window_for_activation_; } else { @@ -1516,7 +1463,7 @@ FARPROC WINAPI WebPluginDelegateImpl::GetProcAddressPatch(HMODULE module, void WebPluginDelegateImpl::HandleCaptureForMessage(HWND window, UINT message) { - if (!WebPluginDelegateImpl::IsPluginDelegateWindow(window)) + if (!webkit::npapi::IsPluginDelegateWindow(window)) return; switch (message) { @@ -1543,5 +1490,4 @@ void WebPluginDelegateImpl::HandleCaptureForMessage(HWND window, } } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/webplugin_ime_win.cc b/content/child/npapi/webplugin_ime_win.cc index e779b2d..982ecf36 100644 --- a/webkit/plugins/npapi/webplugin_ime_win.cc +++ b/content/child/npapi/webplugin_ime_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/webplugin_ime_win.h" +#include "content/child/npapi/webplugin_ime_win.h" #include <cstring> #include <string> @@ -12,13 +12,13 @@ #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "base/synchronization/lock.h" -#include "webkit/plugins/npapi/plugin_constants_win.h" -#include "webkit/plugins/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/common/plugin_constants_win.h" +#include "webkit/plugins/npapi/plugin_utils.h" #pragma comment(lib, "imm32.lib") -namespace webkit { -namespace npapi { +namespace content { // A critical section that prevents two or more plug-ins from accessing a // WebPluginIMEWin instance through our patch function. @@ -273,7 +273,7 @@ HIMC WINAPI WebPluginIMEWin::ImmGetContext(HWND window) { if (IsWindow(window)) { wchar_t name[128]; GetClassName(window, &name[0], arraysize(name)); - if (!wcscmp(&name[0], kNativeWindowClassName)) + if (!wcscmp(&name[0], webkit::npapi::kNativeWindowClassName)) return ::ImmGetContext(window); } @@ -321,5 +321,4 @@ BOOL WINAPI WebPluginIMEWin::ImmSetOpenStatus(HIMC context, BOOL open) { return TRUE; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/webplugin_ime_win.h b/content/child/npapi/webplugin_ime_win.h index ea5abb6..3a4083c4 100644 --- a/webkit/plugins/npapi/webplugin_ime_win.h +++ b/content/child/npapi/webplugin_ime_win.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_IME_WIN_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_IME_WIN_H_ +#ifndef CONTENT_CHILD_NPAPI_WEBPLUGIN_IME_WIN_H_ +#define CONTENT_CHILD_NPAPI_WEBPLUGIN_IME_WIN_H_ #include <string> #include <vector> @@ -13,8 +13,7 @@ #include "third_party/npapi/bindings/npapi.h" #include "ui/gfx/rect.h" -namespace webkit { -namespace npapi { +namespace content { class PluginInstance; @@ -179,7 +178,6 @@ class WebPluginIMEWin { static WebPluginIMEWin* instance_; }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_IME_WIN_H_ +#endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_IME_WIN_H_ diff --git a/content/child/npobject_proxy.cc b/content/child/npobject_proxy.cc index 1f732a5..2bb3dca 100644 --- a/content/child/npobject_proxy.cc +++ b/content/child/npobject_proxy.cc @@ -5,12 +5,11 @@ #include "content/child/npobject_proxy.h" #include "content/child/np_channel_base.h" +#include "content/child/npapi/plugin_host.h" +#include "content/child/npapi/plugin_instance.h" #include "content/child/npobject_util.h" #include "content/child/plugin_messages.h" #include "third_party/WebKit/public/web/WebBindings.h" -#include "webkit/glue/webkit_glue.h" -#include "webkit/plugins/npapi/plugin_host.h" -#include "webkit/plugins/npapi/plugin_instance.h" using WebKit::WebBindings; @@ -390,7 +389,7 @@ bool NPObjectProxy::NPNEnumerate(NPObject *obj, *count = static_cast<unsigned int>(value_param.size()); *value = static_cast<NPIdentifier *>( - webkit::npapi::PluginHost::Singleton()->host_functions()->memalloc( + PluginHost::Singleton()->host_functions()->memalloc( sizeof(NPIdentifier) * *count)); for (unsigned int i = 0; i < *count; ++i) (*value)[i] = CreateNPIdentifier(value_param[i]); @@ -470,8 +469,8 @@ bool NPObjectProxy::NPNEvaluate(NPP npp, bool popups_allowed = false; if (npp) { - webkit::npapi::PluginInstance* plugin_instance = - reinterpret_cast<webkit::npapi::PluginInstance*>(npp->ndata); + PluginInstance* plugin_instance = + reinterpret_cast<PluginInstance*>(npp->ndata); if (plugin_instance) popups_allowed = plugin_instance->popups_allowed(); } diff --git a/content/child/npobject_stub.cc b/content/child/npobject_stub.cc index 4fc60ce..87bd8cc 100644 --- a/content/child/npobject_stub.cc +++ b/content/child/npobject_stub.cc @@ -5,6 +5,7 @@ #include "content/child/npobject_stub.h" #include "content/child/np_channel_base.h" +#include "content/child/npapi/plugin_host.h" #include "content/child/npobject_util.h" #include "content/child/plugin_messages.h" #include "content/public/common/content_client.h" @@ -12,11 +13,10 @@ #include "third_party/WebKit/public/web/WebBindings.h" #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/npruntime.h" -#include "webkit/plugins/npapi/plugin_host.h" #if defined(OS_WIN) #include "base/command_line.h" -#include "webkit/plugins/npapi/plugin_constants_win.h" +#include "content/common/plugin_constants_win.h" #endif using WebKit::WebBindings; @@ -264,7 +264,7 @@ void NPObjectStub::OnSetProperty(const NPIdentifier_Param& name, plugin_path.BaseName().value()); static NPIdentifier fullscreen = WebBindings::getStringIdentifier("fullScreen"); - if (filename == webkit::npapi::kNewWMPPlugin && id == fullscreen) { + if (filename == kNewWMPPlugin && id == fullscreen) { // Workaround for bug 15985, which is if Flash causes WMP to go // full screen a deadlock can occur when WMP calls SetFocus. NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, true); @@ -339,7 +339,7 @@ void NPObjectStub::OnEnumeration(std::vector<NPIdentifier_Param>* value, value->push_back(param); } - webkit::npapi::PluginHost::Singleton()->host_functions()->memfree(value_np); + PluginHost::Singleton()->host_functions()->memfree(value_np); } void NPObjectStub::OnConstruct(const std::vector<NPVariant_Param>& args, diff --git a/content/child/npobject_util.cc b/content/child/npobject_util.cc index 7b4953c..e05e736 100644 --- a/content/child/npobject_util.cc +++ b/content/child/npobject_util.cc @@ -6,12 +6,12 @@ #include "base/strings/string_util.h" #include "content/child/np_channel_base.h" +#include "content/child/npapi/plugin_host.h" #include "content/child/npobject_proxy.h" #include "content/child/plugin_messages.h" #include "third_party/WebKit/public/web/WebBindings.h" #include "third_party/npapi/bindings/nphostapi.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/plugins/npapi/plugin_host.h" using WebKit::WebBindings; @@ -129,7 +129,7 @@ NPNetscapeFuncs *GetHostFunctions() { void PatchNPNFunctions() { g_plugin_process = true; NPNetscapeFuncs* funcs = GetHostFunctions(); - webkit::npapi::PluginHost::Singleton()->PatchNPNetscapeFuncs(funcs); + PluginHost::Singleton()->PatchNPNetscapeFuncs(funcs); } bool IsPluginProcess() { diff --git a/content/child/plugin_param_traits.cc b/content/child/plugin_param_traits.cc index dd77979..65e84f3 100644 --- a/content/child/plugin_param_traits.cc +++ b/content/child/plugin_param_traits.cc @@ -5,10 +5,10 @@ #include "content/child/plugin_param_traits.h" #include "base/strings/string_number_conversions.h" +#include "content/child/npapi/plugin_host.h" #include "content/child/npruntime_util.h" #include "ipc/ipc_message_utils.h" #include "third_party/WebKit/public/web/WebBindings.h" -#include "webkit/plugins/npapi/plugin_host.h" namespace content { @@ -128,7 +128,7 @@ void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) { if (WebKit::WebBindings::identifierIsString(p.identifier)) { NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier); l->append(str); - webkit::npapi::PluginHost::Singleton()->host_functions()->memfree(str); + content::PluginHost::Singleton()->host_functions()->memfree(str); } else { l->append(base::IntToString( WebKit::WebBindings::intFromIdentifier(p.identifier))); diff --git a/webkit/plugins/npapi/plugin_constants_win.cc b/content/common/plugin_constants_win.cc index 08aa33a..d8964c1 100644 --- a/webkit/plugins/npapi/plugin_constants_win.cc +++ b/content/common/plugin_constants_win.cc @@ -2,12 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_constants_win.h" +#include "content/common/plugin_constants_win.h" -namespace webkit { -namespace npapi { +namespace content { -const char16 kNativeWindowClassName[] = L"NativeWindowClass"; const char16 kWrapperNativeWindowClassName[] = L"WrapperNativeWindowClass"; const char16 kPaintMessageName[] = L"Chrome_CustomPaintil"; const char16 kRegistryMozillaPlugins[] = L"SOFTWARE\\MozillaPlugins"; @@ -24,5 +22,4 @@ const char16 kJavaPlugin1[] = L"npjp2.dll"; const char16 kJavaPlugin2[] = L"npdeploytk.dll"; const char kGPUPluginMimeType[] = "application/vnd.google.chrome.gpu-plugin"; -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_constants_win.h b/content/common/plugin_constants_win.h index 35dafa1..8903fe3 100644 --- a/webkit/plugins/npapi/plugin_constants_win.h +++ b/content/common/plugin_constants_win.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_CONSTANTS_WIN_H_ -#define WEBKIT_PLUGINS_NPAPI_PLUGIN_CONSTANTS_WIN_H_ +#ifndef CONTENT_COMMON_PLUGIN_CONSTANTS_WIN_H_ +#define CONTENT_COMMON_PLUGIN_CONSTANTS_WIN_H_ #include "base/strings/string16.h" @@ -11,11 +11,7 @@ #error "Windows-only header" #endif -namespace webkit { -namespace npapi { - -// The window class name for a plugin window. -extern const char16 kNativeWindowClassName[]; +namespace content { // The name of the window class name for the wrapper HWND around the actual // plugin window that's used when running in multi-process mode. This window @@ -43,7 +39,6 @@ extern const char16 kJavaPlugin2[]; extern const char kGPUPluginMimeType[]; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_PLUGIN_LIST_H_ +#endif // CONTENT_COMMON_PLUGIN_CONSTANTS_WIN_H_ diff --git a/webkit/plugins/npapi/plugin_list.cc b/content/common/plugin_list.cc index 3ade2ab..dbf53dc 100644 --- a/webkit/plugins/npapi/plugin_list.cc +++ b/content/common/plugin_list.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_list.h" +#include "content/common/plugin_list.h" #include <algorithm> @@ -19,12 +19,15 @@ #include "webkit/plugins/plugin_switches.h" #if defined(OS_WIN) -#include "webkit/plugins/npapi/plugin_constants_win.h" +#include "content/common/plugin_constants_win.h" #endif -namespace { +using webkit::WebPluginInfo; +using webkit::WebPluginMimeType; + +namespace content { -using webkit::npapi::PluginList; +namespace { const char kApplicationOctetStream[] = "application/octet-stream"; @@ -53,9 +56,6 @@ bool AllowMimeTypeMismatch(const std::string& orig_mime_type, } // namespace -namespace webkit { -namespace npapi { - // static PluginList* PluginList::Singleton() { return g_singleton.Pointer(); @@ -77,7 +77,7 @@ void PluginList::RefreshPlugins() { } void PluginList::AddExtraPluginPath(const base::FilePath& plugin_path) { - if (!NPAPIPluginsSupported()) { + if (!webkit::npapi::NPAPIPluginsSupported()) { // TODO(jam): remove and just have CHECK once we're sure this doesn't get // triggered. DLOG(INFO) << "NPAPI plugins not supported"; @@ -110,7 +110,7 @@ void PluginList::AddExtraPluginDir(const base::FilePath& plugin_dir) { void PluginList::RegisterInternalPlugin(const webkit::WebPluginInfo& info, bool add_at_beginning) { - if (!NPAPIPluginsSupported() && + if (!webkit::npapi::NPAPIPluginsSupported() && info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) { DLOG(INFO) << "Don't register NPAPI plugins when they're not supported"; return; @@ -307,7 +307,7 @@ void PluginList::GetPluginPathsToLoad(std::vector<base::FilePath>* plugin_paths) plugin_paths->push_back(path); } - if (NPAPIPluginsSupported()) { + if (webkit::npapi::NPAPIPluginsSupported()) { // A bit confusingly, this function is used to load Pepper plugins as well. // Those are all internal plugins so we have to use extra_plugin_paths. for (size_t i = 0; i < extra_plugin_dirs.size(); ++i) @@ -444,5 +444,4 @@ PluginList::~PluginList() { } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_list.h b/content/common/plugin_list.h index eac8b0f..2b33da4a3 100644 --- a/webkit/plugins/npapi/plugin_list.h +++ b/content/common/plugin_list.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ -#define WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ +#ifndef CONTENT_COMMON_PLUGIN_LIST_H_ +#define CONTENT_COMMON_PLUGIN_LIST_H_ #include <set> #include <string> @@ -17,13 +17,12 @@ #include "base/memory/linked_ptr.h" #include "base/memory/scoped_vector.h" #include "base/synchronization/lock.h" -#include "webkit/plugins/webkit_plugins_export.h" +#include "content/common/content_export.h" #include "webkit/plugins/webplugininfo.h" class GURL; -namespace webkit { -namespace npapi { +namespace content { // The PluginList is responsible for loading our NPAPI based plugins. It does // so in whatever manner is appropriate for the platform. On Windows, it loads @@ -33,7 +32,7 @@ namespace npapi { // the correct types. On Linux, it walks the plugin directories as well // (e.g. /usr/lib/browser-plugins/). // This object is thread safe. -class PluginList { +class CONTENT_EXPORT PluginList { public: // Gets the one instance of the PluginList. @@ -247,7 +246,6 @@ class PluginList { DISALLOW_COPY_AND_ASSIGN(PluginList); }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ +#endif // CONTENT_COMMON_PLUGIN_LIST_H_ diff --git a/webkit/plugins/npapi/plugin_list_mac.mm b/content/common/plugin_list_mac.mm index 239be95..2048b6f 100644 --- a/webkit/plugins/npapi/plugin_list_mac.mm +++ b/content/common/plugin_list_mac.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_list.h" +#include "content/common/plugin_list.h" #import <Carbon/Carbon.h> #import <Foundation/Foundation.h> @@ -20,9 +20,10 @@ #include "base/strings/utf_string_conversions.h" using base::ScopedCFTypeRef; +using webkit::WebPluginInfo; +using webkit::WebPluginMimeType; -namespace webkit { -namespace npapi { +namespace content { namespace { @@ -301,5 +302,4 @@ bool PluginList::ShouldLoadPluginUsingPluginList( return !IsBlacklistedPlugin(info); } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_list_posix.cc b/content/common/plugin_list_posix.cc index 86dc227..a8dd510 100644 --- a/webkit/plugins/npapi/plugin_list_posix.cc +++ b/content/common/plugin_list_posix.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_list.h" +#include "content/common/plugin_list.h" #include <algorithm> #include <dlfcn.h> @@ -35,8 +35,10 @@ // happy. #include "base/third_party/nspr/prcpucfg_linux.h" -namespace webkit { -namespace npapi { +using webkit::WebPluginInfo; +using webkit::WebPluginMimeType; + +namespace content { namespace { @@ -591,5 +593,4 @@ bool PluginList::ShouldLoadPluginUsingPluginList( return true; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_list_unittest.cc b/content/common/plugin_list_unittest.cc index 135be62..e38a687 100644 --- a/webkit/plugins/npapi/plugin_list_unittest.cc +++ b/content/common/plugin_list_unittest.cc @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_list.h" +#include "content/common/plugin_list.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -namespace webkit { -namespace npapi { +using webkit::WebPluginInfo; +using webkit::WebPluginMimeType; + +namespace content { namespace { @@ -199,5 +201,4 @@ TEST(PluginDescriptionParse, ExtractVersion) { #endif // defined(OS_POSIX) && !defined(OS_MACOSX) -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/plugin_list_win.cc b/content/common/plugin_list_win.cc index af8e002..fe5e325 100644 --- a/webkit/plugins/npapi/plugin_list_win.cc +++ b/content/common/plugin_list_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/plugin_list.h" +#include "content/common/plugin_list.h" #include <set> @@ -20,7 +20,9 @@ #include "base/win/registry.h" #include "base/win/scoped_handle.h" #include "base/win/windows_version.h" -#include "webkit/plugins/npapi/plugin_constants_win.h" +#include "content/common/plugin_constants_win.h" + +using webkit::WebPluginInfo; namespace { @@ -257,8 +259,7 @@ bool IsNewerVersion(const base::string16& a, const base::string16& b) { } // namespace -namespace webkit { -namespace npapi { +namespace content { bool PluginList::ReadWebPluginInfo(const base::FilePath& filename, webkit::WebPluginInfo* info) { @@ -461,5 +462,4 @@ bool PluginList::ShouldLoadPluginUsingPluginList( return true; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/content/common/view_messages.h b/content/common/view_messages.h index b3a29e3..11f06cc 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -18,6 +18,7 @@ #include "content/common/navigation_gesture.h" #include "content/common/pepper_renderer_instance_data.h" #include "content/common/view_message_enums.h" +#include "content/common/webplugin_geometry.h" #include "content/port/common/input_event_ack_state.h" #include "content/public/common/common_param_traits.h" #include "content/public/common/context_menu_params.h" @@ -59,7 +60,6 @@ #include "ui/gfx/vector2d.h" #include "ui/gfx/vector2d_f.h" #include "ui/shell_dialogs/selected_file_info.h" -#include "webkit/plugins/npapi/webplugin.h" #if defined(OS_MACOSX) #include "content/common/mac/font_descriptor.h" @@ -280,7 +280,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::CookieData) IPC_STRUCT_TRAITS_MEMBER(session) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit::npapi::WebPluginGeometry) +IPC_STRUCT_TRAITS_BEGIN(content::WebPluginGeometry) IPC_STRUCT_TRAITS_MEMBER(window) IPC_STRUCT_TRAITS_MEMBER(window_rect) IPC_STRUCT_TRAITS_MEMBER(clip_rect) @@ -555,7 +555,7 @@ IPC_STRUCT_BEGIN(ViewHostMsg_UpdateRect_Params) IPC_STRUCT_MEMBER(gfx::Size, view_size) // New window locations for plugin child windows. - IPC_STRUCT_MEMBER(std::vector<webkit::npapi::WebPluginGeometry>, + IPC_STRUCT_MEMBER(std::vector<content::WebPluginGeometry>, plugin_window_moves) // The following describes the various bits that may be set in flags: diff --git a/webkit/plugins/npapi/webplugin.cc b/content/common/webplugin_geometry.cc index 6d06884..ff290d2 100644 --- a/webkit/plugins/npapi/webplugin.cc +++ b/content/common/webplugin_geometry.cc @@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/webplugin.h" +#include "content/common/webplugin_geometry.h" -namespace webkit { -namespace npapi { +namespace content { WebPluginGeometry::WebPluginGeometry() : window(gfx::kNullPluginWindow), @@ -25,5 +24,4 @@ bool WebPluginGeometry::Equals(const WebPluginGeometry& rhs) const { visible == rhs.visible; } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/content/common/webplugin_geometry.h b/content/common/webplugin_geometry.h new file mode 100644 index 0000000..7f0a21b --- /dev/null +++ b/content/common/webplugin_geometry.h @@ -0,0 +1,47 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_WEBPLUGIN_GEOMETRY_H_ +#define CONTENT_COMMON_WEBPLUGIN_GEOMETRY_H_ + +#include <vector> + +#include "base/basictypes.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/rect.h" + +namespace content { + +// Describes the new location for a plugin window. +struct WebPluginGeometry { + WebPluginGeometry(); + ~WebPluginGeometry(); + + bool Equals(const WebPluginGeometry& rhs) const; + + // On Windows, this is the plugin window in the plugin process. + // On X11, this is the XID of the plugin-side GtkPlug containing the + // GtkSocket hosting the actual plugin window. + // + // On Mac OS X, all of the plugin types are currently "windowless" + // (window == 0) except for the special case of the GPU plugin, + // which currently performs rendering on behalf of the Pepper 3D API + // and WebGL. The GPU plugin uses a simple integer for the + // PluginWindowHandle which is used to map to a side data structure + // containing information about the plugin. Soon this plugin will be + // generalized, at which point this mechanism will be rethought or + // removed. + gfx::PluginWindowHandle window; + gfx::Rect window_rect; + // Clip rect (include) and cutouts (excludes), relative to + // window_rect origin. + gfx::Rect clip_rect; + std::vector<gfx::Rect> cutout_rects; + bool rects_valid; + bool visible; +}; + +} // namespace content + +#endif // CONTENT_COMMON_WEBPLUGIN_GEOMETRY_H_ diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 0b7dbf1..50e1a69 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -758,6 +758,10 @@ 'browser/renderer_host/gtk_im_context_wrapper.h', 'browser/renderer_host/gtk_key_bindings_handler.cc', 'browser/renderer_host/gtk_key_bindings_handler.h', + 'browser/renderer_host/gtk_plugin_container.cc', + 'browser/renderer_host/gtk_plugin_container.h', + 'browser/renderer_host/gtk_plugin_container_manager.cc', + 'browser/renderer_host/gtk_plugin_container_manager.h', 'browser/renderer_host/gtk_window_utils.cc', 'browser/renderer_host/gtk_window_utils.h', 'browser/renderer_host/image_transport_factory.cc', diff --git a/content/content_child.gypi b/content/content_child.gypi index c433215..062bbb5 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi @@ -55,6 +55,35 @@ 'child/indexed_db/proxy_webidbdatabase_impl.h', 'child/indexed_db/proxy_webidbfactory_impl.cc', 'child/indexed_db/proxy_webidbfactory_impl.h', + 'child/npapi/plugin_host.cc', + 'child/npapi/plugin_host.h', + 'child/npapi/plugin_instance.cc', + 'child/npapi/plugin_instance.h', + 'child/npapi/plugin_instance_mac.mm', + 'child/npapi/plugin_lib.cc', + 'child/npapi/plugin_lib.h', + 'child/npapi/plugin_stream.cc', + 'child/npapi/plugin_stream.h', + 'child/npapi/plugin_stream_posix.cc', + 'child/npapi/plugin_stream_url.cc', + 'child/npapi/plugin_stream_url.h', + 'child/npapi/plugin_stream_win.cc', + 'child/npapi/plugin_string_stream.cc', + 'child/npapi/plugin_string_stream.h', + 'child/npapi/plugin_web_event_converter_mac.h', + 'child/npapi/plugin_web_event_converter_mac.mm', + 'child/npapi/webplugin.h', + 'child/npapi/webplugin_accelerated_surface_mac.h', + 'child/npapi/webplugin_delegate.h', + 'child/npapi/webplugin_delegate_impl.cc', + 'child/npapi/webplugin_delegate_impl.h', + 'child/npapi/webplugin_delegate_impl_android.cc', + 'child/npapi/webplugin_delegate_impl_aura.cc', + 'child/npapi/webplugin_delegate_impl_gtk.cc', + 'child/npapi/webplugin_delegate_impl_mac.mm', + 'child/npapi/webplugin_delegate_impl_win.cc', + 'child/npapi/webplugin_ime_win.cc', + 'child/npapi/webplugin_ime_win.h', 'child/np_channel_base.cc', 'child/np_channel_base.h', 'child/npobject_base.h', @@ -112,5 +141,15 @@ '../webkit/support/webkit_support.gyp:glue_child', ], }], + ['use_aura==1', { + 'sources!': [ + 'child/npapi/webplugin_delegate_impl_mac.mm', + ], + }], + ['use_aura==1 and OS=="win"', { + 'sources!': [ + 'child/npapi/webplugin_delegate_impl_aura.cc', + ], + }], ], } diff --git a/content/content_common.gypi b/content/content_common.gypi index aaa7659..7ffdc1c 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -290,6 +290,13 @@ 'common/pepper_renderer_instance_data.h', 'common/plugin_carbon_interpose_constants_mac.cc', 'common/plugin_carbon_interpose_constants_mac.h', + 'common/plugin_constants_win.cc', + 'common/plugin_constants_win.h', + 'common/plugin_list.cc', + 'common/plugin_list.h', + 'common/plugin_list_mac.mm', + 'common/plugin_list_posix.cc', + 'common/plugin_list_win.cc', 'common/plugin_process_messages.h', 'common/process_type.cc', 'common/quota_messages.h', @@ -330,6 +337,8 @@ 'common/utility_messages.h', 'common/view_messages.h', 'common/view_message_enums.h', + 'common/webplugin_geometry.cc', + 'common/webplugin_geometry.h', 'common/websocket.h', 'common/websocket_messages.h', 'common/worker_messages.h', @@ -385,6 +394,16 @@ '../webkit/support/webkit_support.gyp:glue', ], }], + ['OS=="mac"', { + 'sources!': [ + 'common/plugin_list_posix.cc', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', + ], + }, + }], ['OS=="android"',{ 'link_settings': { 'libraries': [ diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 77bec06..b1a822f 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -417,6 +417,9 @@ 'renderer/web_ui_extension_data.h', 'renderer/webplugin_delegate_proxy.cc', 'renderer/webplugin_delegate_proxy.h', + 'renderer/webplugin_impl.cc', + 'renderer/webplugin_impl.h', + 'renderer/webplugin_page_delegate.h', 'renderer/websharedworker_proxy.cc', 'renderer/websharedworker_proxy.h', 'renderer/websharedworkerrepository_impl.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 374b2aa..28fa3f5 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -388,6 +388,7 @@ 'browser/webui/web_ui_message_handler_unittest.cc', 'child/indexed_db/indexed_db_dispatcher_unittest.cc', 'child/indexed_db/proxy_webidbcursor_impl_unittest.cc', + 'child/npapi/plugin_lib_unittest.cc', 'child/resource_dispatcher_unittest.cc', 'common/android/address_parser_unittest.cc', 'common/cc_messages_unittest.cc', @@ -399,6 +400,7 @@ 'common/mac/font_descriptor_unittest.mm', 'common/page_state_serialization_unittest.cc', 'common/page_zoom_unittest.cc', + 'common/plugin_list_unittest.cc', 'common/sandbox_mac_diraccess_unittest.mm', 'common/sandbox_mac_fontloading_unittest.mm', 'common/sandbox_mac_system_access_unittest.mm', @@ -433,6 +435,7 @@ 'renderer/render_thread_impl_unittest.cc', 'renderer/render_view_impl_unittest.cc', 'renderer/v8_value_converter_impl_unittest.cc', + 'renderer/webplugin_impl_unittest.cc', 'test/image_decoder_test.cc', 'test/image_decoder_test.h', '../webkit/browser/appcache/appcache_database_unittest.cc', @@ -528,10 +531,7 @@ '../webkit/mocks/mock_weburlloader.cc', '../webkit/mocks/mock_weburlloader.h', '../webkit/common/user_agent/user_agent_unittest.cc', - '../webkit/plugins/npapi/plugin_lib_unittest.cc', - '../webkit/plugins/npapi/plugin_list_unittest.cc', '../webkit/plugins/npapi/plugin_utils_unittest.cc', - '../webkit/plugins/npapi/webplugin_impl_unittest.cc', '../webkit/plugins/ppapi/host_var_tracker_unittest.cc', '../webkit/plugins/ppapi/mock_platform_image_2d.cc', '../webkit/plugins/ppapi/mock_platform_image_2d.h', @@ -598,6 +598,7 @@ '../webkit/support/webkit_support.gyp:glue', '../webkit/support/webkit_support.gyp:glue_child', '../webkit/support/webkit_support.gyp:plugins', + '../webkit/plugins/webkit_plugins.gyp:plugins_common', '../webkit/support/webkit_support.gyp:webkit_media', ], }], @@ -771,6 +772,7 @@ '../webkit/renderer/webkit_renderer.gyp:webkit_renderer', '../webkit/support/webkit_support.gyp:glue', '../webkit/support/webkit_support.gyp:glue_child', + '../webkit/plugins/webkit_plugins.gyp:plugins_common', ], 'include_dirs': [ '..', diff --git a/content/plugin/plugin_channel.cc b/content/plugin/plugin_channel.cc index 0c4f463..0556f82 100644 --- a/content/plugin/plugin_channel.cc +++ b/content/plugin/plugin_channel.cc @@ -12,6 +12,7 @@ #include "base/synchronization/waitable_event.h" #include "build/build_config.h" #include "content/child/child_process.h" +#include "content/child/npapi/plugin_instance.h" #include "content/child/plugin_messages.h" #include "content/common/plugin_process_messages.h" #include "content/plugin/plugin_thread.h" @@ -19,7 +20,6 @@ #include "content/plugin/webplugin_proxy.h" #include "content/public/common/content_switches.h" #include "third_party/WebKit/public/web/WebBindings.h" -#include "webkit/plugins/npapi/plugin_instance.h" #if defined(OS_POSIX) #include "base/posix/eintr_wrapper.h" @@ -312,8 +312,7 @@ void PluginChannel::OnClearSiteData(const std::string& site, bool success = false; CommandLine* command_line = CommandLine::ForCurrentProcess(); base::FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); - scoped_refptr<webkit::npapi::PluginLib> plugin_lib( - webkit::npapi::PluginLib::CreatePluginLib(path)); + scoped_refptr<PluginLib> plugin_lib(PluginLib::CreatePluginLib(path)); if (plugin_lib.get()) { NPError err = plugin_lib->NP_Initialize(); if (err == NPERR_NO_ERROR) { diff --git a/content/plugin/plugin_interpose_util_mac.mm b/content/plugin/plugin_interpose_util_mac.mm index 1166e6c..62cef3a 100644 --- a/content/plugin/plugin_interpose_util_mac.mm +++ b/content/plugin/plugin_interpose_util_mac.mm @@ -7,9 +7,9 @@ #import <AppKit/AppKit.h> #import <objc/runtime.h> +#include "content/child/npapi/webplugin_delegate_impl.h" #include "content/common/plugin_process_messages.h" #include "content/plugin/plugin_thread.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" using content::PluginThread; @@ -34,7 +34,7 @@ void SwitchToPluginProcess() { __attribute__((visibility("default"))) OpaquePluginRef GetActiveDelegate() { - return webkit::npapi::WebPluginDelegateImpl::GetActiveDelegate(); + return content::WebPluginDelegateImpl::GetActiveDelegate(); } __attribute__((visibility("default"))) @@ -211,8 +211,7 @@ static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) { - (void)chromePlugin_set { OpaquePluginRef delegate = mac_plugin_interposing::GetActiveDelegate(); if (delegate) { - static_cast<webkit::npapi::WebPluginDelegateImpl*>(delegate)->SetNSCursor( - self); + static_cast<content::WebPluginDelegateImpl*>(delegate)->SetNSCursor(self); return; } [self chromePlugin_set]; diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc index 865ea60..19f170a 100644 --- a/content/plugin/plugin_thread.cc +++ b/content/plugin/plugin_thread.cc @@ -21,16 +21,15 @@ #include "base/process_util.h" #include "base/threading/thread_local.h" #include "content/child/child_process.h" +#include "content/child/npapi/plugin_lib.h" +#include "content/child/npapi/webplugin_delegate_impl.h" #include "content/child/npobject_util.h" #include "content/common/plugin_process_messages.h" #include "content/public/common/content_switches.h" #include "content/public/plugin/content_plugin_client.h" #include "ipc/ipc_channel_handle.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/plugins/npapi/plugin_lib.h" -#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/plugin_utils.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" #if defined(TOOLKIT_GTK) #include "ui/gfx/gtk_util.h" @@ -116,8 +115,7 @@ PluginThread::PluginThread() // Preload the library to avoid loading, unloading then reloading preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path, NULL); - scoped_refptr<webkit::npapi::PluginLib> plugin( - webkit::npapi::PluginLib::CreatePluginLib(plugin_path)); + scoped_refptr<PluginLib> plugin(PluginLib::CreatePluginLib(plugin_path)); if (plugin.get()) { plugin->NP_Initialize(); // For OOP plugins the plugin dll will be unloaded during process shutdown @@ -143,7 +141,7 @@ void PluginThread::Shutdown() { preloaded_plugin_module_ = NULL; } NPChannelBase::CleanupChannels(); - webkit::npapi::PluginLib::UnloadAllPlugins(); + PluginLib::UnloadAllPlugins(); if (webkit::npapi::ShouldForcefullyTerminatePluginProcess()) base::KillProcess(base::GetCurrentProcessHandle(), 0, /* wait= */ false); diff --git a/content/plugin/plugin_thread.h b/content/plugin/plugin_thread.h index bf4a570..97ca9ed 100644 --- a/content/plugin/plugin_thread.h +++ b/content/plugin/plugin_thread.h @@ -9,8 +9,8 @@ #include "base/native_library.h" #include "build/build_config.h" #include "content/child/child_thread.h" +#include "content/child/npapi/plugin_lib.h" #include "content/plugin/plugin_channel.h" -#include "webkit/plugins/npapi/plugin_lib.h" #if defined(OS_POSIX) #include "base/file_descriptor_posix.h" diff --git a/content/plugin/webplugin_accelerated_surface_proxy_mac.h b/content/plugin/webplugin_accelerated_surface_proxy_mac.h index 67aeea5..d3b115a 100644 --- a/content/plugin/webplugin_accelerated_surface_proxy_mac.h +++ b/content/plugin/webplugin_accelerated_surface_proxy_mac.h @@ -6,8 +6,8 @@ #define CONTENT_PLUGIN_WEBPLUGIN_ACCELERATED_SURFACE_PROXY_H_ #include "base/compiler_specific.h" +#include "content/child/npapi/webplugin_accelerated_surface_mac.h" #include "ui/gl/gpu_preference.h" -#include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h" class AcceleratedSurface; @@ -16,8 +16,7 @@ class WebPluginProxy; // Out-of-process implementation of WebPluginAcceleratedSurface that proxies // calls through a WebPluginProxy. -class WebPluginAcceleratedSurfaceProxy - : public webkit::npapi::WebPluginAcceleratedSurface { +class WebPluginAcceleratedSurfaceProxy : public WebPluginAcceleratedSurface { public: // Creates a new WebPluginAcceleratedSurfaceProxy that uses plugin_proxy // to proxy calls. plugin_proxy must outlive this object. Returns NULL if diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc index 95f197ae..e675dcf 100644 --- a/content/plugin/webplugin_delegate_stub.cc +++ b/content/plugin/webplugin_delegate_stub.cc @@ -9,6 +9,8 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/strings/string_number_conversions.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/webplugin_delegate_impl.h" #include "content/child/plugin_messages.h" #include "content/plugin/plugin_channel.h" #include "content/plugin/plugin_thread.h" @@ -22,19 +24,15 @@ #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/npruntime.h" #include "webkit/common/cursors/webcursor.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" using WebKit::WebBindings; using WebKit::WebCursorInfo; -using webkit::npapi::WebPlugin; -using webkit::npapi::WebPluginResourceClient; namespace content { static void DestroyWebPluginAndDelegate( base::WeakPtr<NPObjectStub> scriptable_object, - webkit::npapi::WebPluginDelegateImpl* delegate, + WebPluginDelegateImpl* delegate, WebPlugin* webplugin) { // The plugin may not expect us to try to release the scriptable object // after calling NPP_Destroy on the instance, so delete the stub now. @@ -182,7 +180,7 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, instance_id_, page_url_, params.host_render_view_routing_id); - delegate_ = webkit::npapi::WebPluginDelegateImpl::Create(path, mime_type_); + delegate_ = WebPluginDelegateImpl::Create(path, mime_type_); if (delegate_) { webplugin_->set_delegate(delegate_); std::vector<std::string> arg_names = params.arg_names; diff --git a/content/plugin/webplugin_delegate_stub.h b/content/plugin/webplugin_delegate_stub.h index 370ff97..2eb346005 100644 --- a/content/plugin/webplugin_delegate_stub.h +++ b/content/plugin/webplugin_delegate_stub.h @@ -26,14 +26,9 @@ namespace WebKit { class WebInputEvent; } -namespace webkit { -namespace npapi { -class WebPluginDelegateImpl; -} -} - namespace content { class PluginChannel; +class WebPluginDelegateImpl; class WebPluginProxy; // Converts the IPC messages from WebPluginDelegateProxy into calls to the @@ -119,7 +114,7 @@ class WebPluginDelegateStub : public IPC::Listener, scoped_refptr<PluginChannel> channel_; base::WeakPtr<NPObjectStub> plugin_scriptable_object_; - webkit::npapi::WebPluginDelegateImpl* delegate_; + WebPluginDelegateImpl* delegate_; WebPluginProxy* webplugin_; bool in_destructor_; diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc index 49e2895..ba2524c 100644 --- a/content/plugin/webplugin_proxy.cc +++ b/content/plugin/webplugin_proxy.cc @@ -11,6 +11,7 @@ #include "base/memory/scoped_handle.h" #include "base/memory/shared_memory.h" #include "build/build_config.h" +#include "content/child/npapi/webplugin_delegate_impl.h" #include "content/child/npobject_proxy.h" #include "content/child/npobject_util.h" #include "content/child/plugin_messages.h" @@ -23,7 +24,6 @@ #include "third_party/WebKit/public/web/WebBindings.h" #include "ui/gfx/blit.h" #include "ui/gfx/canvas.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" #if defined(OS_MACOSX) #include "base/mac/mac_util.h" @@ -42,11 +42,6 @@ using WebKit::WebBindings; -using webkit::npapi::WebPluginResourceClient; -#if defined(OS_MACOSX) -using webkit::npapi::WebPluginAcceleratedSurface; -#endif - namespace content { WebPluginProxy::SharedTransportDIB::SharedTransportDIB(TransportDIB* dib) @@ -323,8 +318,7 @@ void WebPluginProxy::HandleURLRequest(const char* url, // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082 // for more details on this. if (delegate_->GetQuirks() & - webkit::npapi::WebPluginDelegateImpl:: - PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { + WebPluginDelegateImpl::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { GURL request_url(url); if (!request_url.SchemeIs(chrome::kHttpScheme) && !request_url.SchemeIs(chrome::kHttpsScheme) && diff --git a/content/plugin/webplugin_proxy.h b/content/plugin/webplugin_proxy.h index 8cddfed..eeec5dd 100644 --- a/content/plugin/webplugin_proxy.h +++ b/content/plugin/webplugin_proxy.h @@ -17,6 +17,7 @@ #include "base/memory/shared_memory.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" +#include "content/child/npapi/webplugin.h" #include "ipc/ipc_message.h" #include "skia/ext/refptr.h" #include "third_party/skia/include/core/SkCanvas.h" @@ -26,16 +27,10 @@ #endif #include "ui/gl/gpu_preference.h" #include "ui/surface/transport_dib.h" -#include "webkit/plugins/npapi/webplugin.h" - -namespace webkit { -namespace npapi { -class WebPluginDelegateImpl; -} -} namespace content { class PluginChannel; +class WebPluginDelegateImpl; #if defined(OS_MACOSX) class WebPluginAcceleratedSurfaceProxy; @@ -43,7 +38,7 @@ class WebPluginAcceleratedSurfaceProxy; // This is an implementation of WebPlugin that proxies all calls to the // renderer. -class WebPluginProxy : public webkit::npapi::WebPlugin { +class WebPluginProxy : public WebPlugin { public: // Creates a new proxy for WebPlugin, using the given sender to send the // marshalled WebPlugin calls. @@ -53,7 +48,7 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { int host_render_view_routing_id); virtual ~WebPluginProxy(); - void set_delegate(webkit::npapi::WebPluginDelegateImpl* d) { delegate_ = d; } + void set_delegate(WebPluginDelegateImpl* d) { delegate_ = d; } // WebPlugin overrides virtual void SetWindow(gfx::PluginWindowHandle window) OVERRIDE; @@ -84,7 +79,7 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { // Returns a WebPluginResourceClient object given its id, or NULL if no // object with that id exists. - webkit::npapi::WebPluginResourceClient* GetResourceClient(int id); + WebPluginResourceClient* GetResourceClient(int id); // Returns the id of the renderer that contains this plugin. int GetRendererId(); @@ -101,8 +96,7 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { void DidPaint(); // Notification received on a plugin issued resource request creation. - void OnResourceCreated(int resource_id, - webkit::npapi::WebPluginResourceClient* client); + void OnResourceCreated(int resource_id, WebPluginResourceClient* client); virtual void HandleURLRequest(const char* url, const char* method, @@ -124,14 +118,12 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { bool defer) OVERRIDE; virtual bool IsOffTheRecord() OVERRIDE; virtual void ResourceClientDeleted( - webkit::npapi::WebPluginResourceClient* resource_client) OVERRIDE; + WebPluginResourceClient* resource_client) OVERRIDE; #if defined(OS_MACOSX) virtual void FocusChanged(bool focused) OVERRIDE; - virtual void StartIme() OVERRIDE; - - virtual webkit::npapi::WebPluginAcceleratedSurface* + virtual WebPluginAcceleratedSurface* GetAcceleratedSurface(gfx::GpuPreference gpu_preference) OVERRIDE; //---------------------------------------------------------------------- @@ -221,15 +213,14 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { #endif - typedef base::hash_map<int, webkit::npapi::WebPluginResourceClient*> - ResourceClientMap; + typedef base::hash_map<int, WebPluginResourceClient*> ResourceClientMap; ResourceClientMap resource_clients_; scoped_refptr<PluginChannel> channel_; int route_id_; NPObject* window_npobject_; NPObject* plugin_element_; - webkit::npapi::WebPluginDelegateImpl* delegate_; + WebPluginDelegateImpl* delegate_; gfx::Rect damaged_rect_; bool waiting_for_paint_; // The url of the main frame hosting the plugin. diff --git a/content/port/browser/render_widget_host_view_port.h b/content/port/browser/render_widget_host_view_port.h index 4af4087..7cccbb1 100644 --- a/content/port/browser/render_widget_host_view_port.h +++ b/content/port/browser/render_widget_host_view_port.h @@ -34,12 +34,6 @@ namespace media { class VideoFrame; } -namespace webkit { -namespace npapi { -struct WebPluginGeometry; -} -} - namespace WebKit { struct WebScreenInfo; } @@ -48,6 +42,7 @@ namespace content { class BackingStore; class RenderWidgetHostViewFrameSubscriber; class SmoothScrollGesture; +struct WebPluginGeometry; struct NativeWebKeyboardEvent; // This is the larger RenderWidgetHostView interface exposed only @@ -89,7 +84,7 @@ class CONTENT_EXPORT RenderWidgetHostViewPort : public RenderWidgetHostView, // |scroll_offset| is the scroll offset of the render view. virtual void MovePluginWindows( const gfx::Vector2d& scroll_offset, - const std::vector<webkit::npapi::WebPluginGeometry>& moves) = 0; + const std::vector<WebPluginGeometry>& moves) = 0; // Take focus from the associated View component. virtual void Blur() = 0; diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc index dc0984e..dd48c72 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc @@ -21,6 +21,7 @@ #include "content/child/child_process.h" #include "content/child/child_thread.h" #include "content/child/fileapi/file_system_dispatcher.h" +#include "content/child/npapi/webplugin.h" #include "content/child/quota_dispatcher.h" #include "content/common/child_process_messages.h" #include "content/common/fileapi/file_system_messages.h" @@ -94,7 +95,6 @@ #include "third_party/WebKit/public/web/WebView.h" #include "ui/gfx/size.h" #include "url/gurl.h" -#include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/ppapi/plugin_module.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" diff --git a/content/renderer/render_process_impl.cc b/content/renderer/render_process_impl.cc index d0a322f..29bdba3 100644 --- a/content/renderer/render_process_impl.cc +++ b/content/renderer/render_process_impl.cc @@ -19,6 +19,8 @@ #include "base/strings/utf_string_conversions.h" #include "base/sys_info.h" #include "content/child/child_thread.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/plugin_lib.h" #include "content/common/view_messages.h" #include "content/public/common/content_switches.h" #include "content/public/renderer/content_renderer_client.h" @@ -27,8 +29,6 @@ #include "skia/ext/platform_canvas.h" #include "ui/surface/transport_dib.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/plugin_lib.h" #if defined(OS_MACOSX) #include "base/mac/mac_util.h" diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index cd84e0f..b716cc7 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -33,6 +33,7 @@ #include "content/child/child_thread.h" #include "content/child/fileapi/file_system_dispatcher.h" #include "content/child/fileapi/webfilesystem_callback_adapters.h" +#include "content/child/npapi/webplugin_delegate_impl.h" #include "content/child/quota_dispatcher.h" #include "content/child/request_extra_data.h" #include "content/child/webmessageportchannel_impl.h" @@ -126,6 +127,7 @@ #include "content/renderer/web_ui_extension.h" #include "content/renderer/web_ui_extension_data.h" #include "content/renderer/webplugin_delegate_proxy.h" +#include "content/renderer/webplugin_impl.h" #include "content/renderer/websharedworker_proxy.h" #include "media/audio/audio_output_device.h" #include "media/base/audio_renderer_mixer_input.h" @@ -207,11 +209,7 @@ #include "webkit/common/dom_storage/dom_storage_types.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/weburlresponse_extradata_impl.h" -#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/plugin_utils.h" -#include "webkit/plugins/npapi/webplugin_delegate.h" -#include "webkit/plugins/npapi/webplugin_delegate_impl.h" -#include "webkit/plugins/npapi/webplugin_impl.h" #include "webkit/renderer/appcache/web_application_cache_host_impl.h" #include "webkit/renderer/webpreferences_renderer.h" @@ -298,7 +296,6 @@ using WebKit::WebPeerConnection00Handler; using WebKit::WebPeerConnection00HandlerClient; using WebKit::WebPeerConnectionHandler; using WebKit::WebPeerConnectionHandlerClient; -using WebKit::WebPlugin; using WebKit::WebPluginAction; using WebKit::WebPluginContainer; using WebKit::WebPluginDocument; @@ -2822,9 +2819,9 @@ void RenderViewImpl::didHandleGestureEvent( // WebKit::WebFrameClient ----------------------------------------------------- -WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, - const WebPluginParams& params) { - WebPlugin* plugin = NULL; +WebKit::WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, + const WebPluginParams& params) { + WebKit::WebPlugin* plugin = NULL; if (GetContentClient()->renderer()->OverrideCreatePlugin( this, frame, params, &plugin)) { return plugin; @@ -4697,8 +4694,7 @@ WebKit::WebPlugin* RenderViewImpl::CreatePlugin( if (!webkit::npapi::NPAPIPluginsSupported()) return NULL; - return new webkit::npapi::WebPluginImpl( - frame, params, info.path, AsWeakPtr()); + return new WebPluginImpl(frame, params, info.path, AsWeakPtr()); } void RenderViewImpl::EvaluateScript(const string16& frame_xpath, @@ -4777,7 +4773,7 @@ void RenderViewImpl::LoadURLExternally( // webkit_glue::WebPluginPageDelegate ------------------------------------------ -webkit::npapi::WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( +WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( const base::FilePath& file_path, const std::string& mime_type) { if (!PluginChannelHost::IsListening()) { @@ -4788,7 +4784,7 @@ webkit::npapi::WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); if (in_process_plugin) { #if defined(OS_WIN) && !defined(USE_AURA) - return webkit::npapi::WebPluginDelegateImpl::Create(file_path, mime_type); + return WebPluginDelegateImpl::Create(file_path, mime_type); #else // In-proc plugins aren't supported on non-Windows. NOTIMPLEMENTED(); @@ -4818,8 +4814,7 @@ void RenderViewImpl::WillDestroyPluginWindow(gfx::PluginWindowHandle window) { CleanupWindowInPluginMoves(window); } -void RenderViewImpl::DidMovePlugin( - const webkit::npapi::WebPluginGeometry& move) { +void RenderViewImpl::DidMovePlugin(const WebPluginGeometry& move) { SchedulePluginMove(move); } diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index ad504bd..911ecbe 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -41,6 +41,7 @@ #include "content/renderer/render_widget.h" #include "content/renderer/renderer_webcookiejar_impl.h" #include "content/renderer/stats_collection_observer.h" +#include "content/renderer/webplugin_page_delegate.h" #include "ipc/ipc_platform_file.h" #include "third_party/WebKit/public/platform/WebFileSystem.h" #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" @@ -59,7 +60,6 @@ #include "ui/base/ui_base_types.h" #include "ui/surface/transport_dib.h" #include "webkit/common/webpreferences.h" -#include "webkit/plugins/npapi/webplugin_page_delegate.h" #if defined(OS_ANDROID) #include "content/renderer/android/content_detector.h" @@ -196,7 +196,7 @@ class CONTENT_EXPORT RenderViewImpl NON_EXPORTED_BASE(public WebKit::WebFrameClient), NON_EXPORTED_BASE(public WebKit::WebPageSerializerClient), public RenderView, - NON_EXPORTED_BASE(public webkit::npapi::WebPluginPageDelegate), + NON_EXPORTED_BASE(public WebPluginPageDelegate), NON_EXPORTED_BASE(public WebMediaPlayerDelegate), public base::SupportsWeakPtr<RenderViewImpl> { public: @@ -746,15 +746,14 @@ class CONTENT_EXPORT RenderViewImpl // webkit_glue::WebPluginPageDelegate implementation ------------------------- - virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate( + virtual WebPluginDelegate* CreatePluginDelegate( const base::FilePath& file_path, const std::string& mime_type) OVERRIDE; virtual WebKit::WebPlugin* CreatePluginReplacement( const base::FilePath& file_path) OVERRIDE; virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE; virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE; - virtual void DidMovePlugin( - const webkit::npapi::WebPluginGeometry& move) OVERRIDE; + virtual void DidMovePlugin(const WebPluginGeometry& move) OVERRIDE; virtual void DidStartLoadingForPlugin() OVERRIDE; virtual void DidStopLoadingForPlugin() OVERRIDE; virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE; diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index cb6a14a..9dea50d 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -18,6 +18,7 @@ #include "cc/base/switches.h" #include "cc/output/output_surface.h" #include "cc/trees/layer_tree_host.h" +#include "content/child/npapi/webplugin.h" #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" #include "content/common/input_messages.h" #include "content/common/swapped_out_messages.h" @@ -57,7 +58,6 @@ #include "ui/gl/gl_switches.h" #include "ui/surface/transport_dib.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" #include "webkit/renderer/cursor_utils.h" @@ -2370,8 +2370,7 @@ void RenderWidget::didHandleGestureEvent( #endif } -void RenderWidget::SchedulePluginMove( - const webkit::npapi::WebPluginGeometry& move) { +void RenderWidget::SchedulePluginMove(const WebPluginGeometry& move) { size_t i = 0; for (; i < plugin_window_moves_.size(); ++i) { if (plugin_window_moves_[i].window == move.window) { diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index 841ae41..1343cbb 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -65,19 +65,16 @@ class Range; } namespace webkit { -namespace npapi { -struct WebPluginGeometry; -} // namespace npapi - namespace ppapi { class PluginInstance; } // namespace ppapi } // namespace webkit namespace content { -struct GpuRenderingStats; class RenderWidgetCompositor; class RenderWidgetTest; +struct GpuRenderingStats; +struct WebPluginGeometry; // RenderWidget provides a communication bridge between a WebWidget and // a RenderWidgetHost, the latter of which lives in a different process. @@ -162,7 +159,7 @@ class CONTENT_EXPORT RenderWidget // Called when a plugin is moved. These events are queued up and sent with // the next paint or scroll message to the host. - void SchedulePluginMove(const webkit::npapi::WebPluginGeometry& move); + void SchedulePluginMove(const WebPluginGeometry& move); // Called when a plugin window has been destroyed, to make sure the currently // pending moves don't try to reference it. @@ -657,7 +654,7 @@ class CONTENT_EXPORT RenderWidget WebKit::WebPopupType popup_type_; // Holds all the needed plugin window moves for a scroll. - typedef std::vector<webkit::npapi::WebPluginGeometry> WebPluginGeometryVector; + typedef std::vector<WebPluginGeometry> WebPluginGeometryVector; WebPluginGeometryVector plugin_window_moves_; // A custom background for the widget. diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc index 48937ad..2fa7066 100644 --- a/content/renderer/webplugin_delegate_proxy.cc +++ b/content/renderer/webplugin_delegate_proxy.cc @@ -25,6 +25,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/version.h" #include "content/child/child_process.h" +#include "content/child/npapi/webplugin.h" #include "content/child/npobject_proxy.h" #include "content/child/npobject_stub.h" #include "content/child/npobject_util.h" @@ -50,7 +51,6 @@ #include "ui/gfx/skia_util.h" #include "webkit/common/cursors/webcursor.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/plugin_constants.h" #include "webkit/plugins/sad_plugin.h" @@ -99,7 +99,7 @@ ScopedLogLevel::~ScopedLogLevel() { // Proxy for WebPluginResourceClient. The object owns itself after creation, // deleting itself after its callback has been called. -class ResourceClientProxy : public webkit::npapi::WebPluginResourceClient { +class ResourceClientProxy : public WebPluginResourceClient { public: ResourceClientProxy(PluginChannelHost* channel, int instance_id) : channel_(channel), instance_id_(instance_id), resource_id_(0), @@ -283,7 +283,7 @@ bool WebPluginDelegateProxy::Initialize( const GURL& url, const std::vector<std::string>& arg_names, const std::vector<std::string>& arg_values, - webkit::npapi::WebPlugin* plugin, + WebPlugin* plugin, bool load_manually) { // TODO(shess): Attempt to work around http://crbug.com/97285 and // http://crbug.com/141055 by retrying the connection. Reports seem @@ -1101,8 +1101,7 @@ void WebPluginDelegateProxy::OnHandleURLRequest( params.popups_allowed, params.notify_redirects); } -webkit::npapi::WebPluginResourceClient* -WebPluginDelegateProxy::CreateResourceClient( +WebPluginResourceClient* WebPluginDelegateProxy::CreateResourceClient( unsigned long resource_id, const GURL& url, int notify_id) { if (!channel_host_.get()) return NULL; @@ -1113,8 +1112,7 @@ WebPluginDelegateProxy::CreateResourceClient( return proxy; } -webkit::npapi::WebPluginResourceClient* -WebPluginDelegateProxy::CreateSeekableResourceClient( +WebPluginResourceClient* WebPluginDelegateProxy::CreateSeekableResourceClient( unsigned long resource_id, int range_request_id) { if (!channel_host_.get()) return NULL; diff --git a/content/renderer/webplugin_delegate_proxy.h b/content/renderer/webplugin_delegate_proxy.h index d0ec957..bc6d721 100644 --- a/content/renderer/webplugin_delegate_proxy.h +++ b/content/renderer/webplugin_delegate_proxy.h @@ -12,6 +12,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/sequenced_task_runner_helpers.h" +#include "content/child/npapi/webplugin_delegate.h" #include "ipc/ipc_listener.h" #include "ipc/ipc_message.h" #include "ipc/ipc_sender.h" @@ -19,7 +20,6 @@ #include "ui/gfx/rect.h" #include "ui/surface/transport_dib.h" #include "url/gurl.h" -#include "webkit/plugins/npapi/webplugin_delegate.h" #include "webkit/plugins/webplugininfo.h" #if defined(OS_MACOSX) @@ -49,7 +49,7 @@ class RenderViewImpl; // An implementation of WebPluginDelegate that proxies all calls to // the plugin process. class WebPluginDelegateProxy - : public webkit::npapi::WebPluginDelegate, + : public WebPluginDelegate, public IPC::Listener, public IPC::Sender, public base::SupportsWeakPtr<WebPluginDelegateProxy> { @@ -62,7 +62,7 @@ class WebPluginDelegateProxy virtual bool Initialize(const GURL& url, const std::vector<std::string>& arg_names, const std::vector<std::string>& arg_values, - webkit::npapi::WebPlugin* plugin, + WebPlugin* plugin, bool load_manually) OVERRIDE; virtual void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect) OVERRIDE; @@ -124,9 +124,9 @@ class WebPluginDelegateProxy virtual void DidReceiveManualData(const char* buffer, int length) OVERRIDE; virtual void DidFinishManualLoading() OVERRIDE; virtual void DidManualLoadFail() OVERRIDE; - virtual webkit::npapi::WebPluginResourceClient* CreateResourceClient( + virtual WebPluginResourceClient* CreateResourceClient( unsigned long resource_id, const GURL& url, int notify_id) OVERRIDE; - virtual webkit::npapi::WebPluginResourceClient* CreateSeekableResourceClient( + virtual WebPluginResourceClient* CreateSeekableResourceClient( unsigned long resource_id, int range_request_id) OVERRIDE; gfx::PluginWindowHandle GetPluginWindowHandle(); @@ -247,7 +247,7 @@ class WebPluginDelegateProxy #endif base::WeakPtr<RenderViewImpl> render_view_; - webkit::npapi::WebPlugin* plugin_; + WebPlugin* plugin_; bool uses_shared_bitmaps_; #if defined(OS_MACOSX) bool uses_compositor_; diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/content/renderer/webplugin_impl.cc index 928fde8..6c37442 100644 --- a/webkit/plugins/npapi/webplugin_impl.cc +++ b/content/renderer/webplugin_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/plugins/npapi/webplugin_impl.h" +#include "content/renderer/webplugin_impl.h" #include "base/bind.h" #include "base/debug/crash_logging.h" @@ -13,6 +13,10 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "cc/layers/io_surface_layer.h" +#include "content/child/npapi/plugin_host.h" +#include "content/child/npapi/plugin_instance.h" +#include "content/child/npapi/webplugin_delegate.h" +#include "content/renderer/webplugin_page_delegate.h" #include "net/base/escape.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" @@ -41,10 +45,6 @@ #include "url/gurl.h" #include "url/url_util.h" #include "webkit/glue/multipart_response_delegate.h" -#include "webkit/plugins/npapi/plugin_host.h" -#include "webkit/plugins/npapi/plugin_instance.h" -#include "webkit/plugins/npapi/webplugin_delegate.h" -#include "webkit/plugins/npapi/webplugin_page_delegate.h" #include "webkit/plugins/plugin_constants.h" #include "webkit/renderer/appcache/web_application_cache_host_impl.h" #include "webkit/renderer/compositor_bindings/web_layer_impl.h" @@ -78,8 +78,7 @@ using WebKit::WebVector; using WebKit::WebView; using webkit_glue::MultipartResponseDelegate; -namespace webkit { -namespace npapi { +namespace content { namespace { @@ -1444,5 +1443,4 @@ void WebPluginImpl::SetReferrer(WebKit::WebURLRequest* request, } } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/webplugin_impl.h b/content/renderer/webplugin_impl.h index dfbed94..3ad2bbc 100644 --- a/webkit/plugins/npapi/webplugin_impl.h +++ b/content/renderer/webplugin_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_IMPL_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_IMPL_H_ +#ifndef CONTENT_RENDERER_WEBPLUGIN_IMPL_H_ +#define CONTENT_RENDERER_WEBPLUGIN_IMPL_H_ #include <map> #include <string> @@ -13,6 +13,9 @@ #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "content/child/npapi/webplugin.h" +#include "content/common/content_export.h" +#include "content/common/webplugin_geometry.h" #include "third_party/WebKit/public/platform/WebRect.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" @@ -21,8 +24,6 @@ #include "third_party/WebKit/public/web/WebPlugin.h" #include "ui/gfx/native_widget_types.h" #include "url/gurl.h" -#include "webkit/plugins/npapi/webplugin.h" -#include "webkit/plugins/webkit_plugins_export.h" namespace cc { class IOSurfaceLayer; @@ -41,8 +42,7 @@ namespace webkit_glue { class MultipartResponseDelegate; } // namespace webkit_glue -namespace webkit { -namespace npapi { +namespace content { class WebPluginDelegate; class WebPluginPageDelegate; @@ -50,10 +50,9 @@ class WebPluginPageDelegate; // This is the WebKit side of the plugin implementation that forwards calls, // after changing out of WebCore types, to a delegate. The delegate may // be in a different process. -class WEBKIT_PLUGINS_EXPORT WebPluginImpl : - NON_EXPORTED_BASE(public WebPlugin), - NON_EXPORTED_BASE(public WebKit::WebPlugin), - NON_EXPORTED_BASE(public WebKit::WebURLLoaderClient) { +class WebPluginImpl : public WebPlugin, + public WebKit::WebPlugin, + public WebKit::WebURLLoaderClient { public: WebPluginImpl( WebKit::WebFrame* frame, @@ -63,9 +62,9 @@ class WEBKIT_PLUGINS_EXPORT WebPluginImpl : virtual ~WebPluginImpl(); // Helper function for sorting post data. - static bool SetPostData(WebKit::WebURLRequest* request, - const char* buf, - uint32 length); + CONTENT_EXPORT static bool SetPostData(WebKit::WebURLRequest* request, + const char* buf, + uint32 length); virtual WebPluginDelegate* delegate(); @@ -336,7 +335,6 @@ class WEBKIT_PLUGINS_EXPORT WebPluginImpl : DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_IMPL_H_ +#endif // CONTENT_RENDERER_WEBPLUGIN_IMPL_H_ diff --git a/webkit/plugins/npapi/webplugin_impl_unittest.cc b/content/renderer/webplugin_impl_unittest.cc index 9f531b8..98d0f7b 100644 --- a/webkit/plugins/npapi/webplugin_impl_unittest.cc +++ b/content/renderer/webplugin_impl_unittest.cc @@ -3,18 +3,17 @@ // found in the LICENSE file. #include "base/strings/string_util.h" +#include "content/renderer/webplugin_impl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/WebCString.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURLRequest.h" -#include "webkit/plugins/npapi/webplugin_impl.h" using WebKit::WebHTTPBody; using WebKit::WebString; using WebKit::WebURLRequest; -namespace webkit { -namespace npapi { +namespace content { namespace { @@ -230,5 +229,4 @@ TEST(WebPluginImplTest, PostParserBodyWithBinaryData) { EXPECT_EQ(0xFF, (unsigned char)body[3]); } -} // namespace npapi -} // namespace webkit +} // namespace content diff --git a/webkit/plugins/npapi/webplugin_page_delegate.h b/content/renderer/webplugin_page_delegate.h index e632014..49006ce 100644 --- a/webkit/plugins/npapi/webplugin_page_delegate.h +++ b/content/renderer/webplugin_page_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_PAGE_DELEGATE_H_ -#define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_PAGE_DELEGATE_H_ +#ifndef CONTENT_RENDERER_WEBPLUGIN_PAGE_DELEGATE_H_ +#define CONTENT_RENDERER_WEBPLUGIN_PAGE_DELEGATE_H_ #include <string> @@ -18,8 +18,7 @@ class WebCookieJar; class WebPlugin; } -namespace webkit { -namespace npapi { +namespace content { class WebPluginDelegate; struct WebPluginGeometry; @@ -51,8 +50,7 @@ class WebPluginPageDelegate { // Keeps track of the necessary window move for a plugin window that resulted // from a scroll operation. That way, all plugin windows can be moved at the // same time as each other and the page. - virtual void DidMovePlugin( - const WebPluginGeometry& move) = 0; + virtual void DidMovePlugin(const WebPluginGeometry& move) = 0; // Notifies the parent view that a load has begun. virtual void DidStartLoadingForPlugin() = 0; @@ -67,7 +65,6 @@ class WebPluginPageDelegate { virtual ~WebPluginPageDelegate() {} }; -} // namespace npapi -} // namespace webkit +} // namespace content -#endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_PAGE_DELEGATE_H_ +#endif // CONTENT_RENDERER_WEBPLUGIN_PAGE_DELEGATE_H_ diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc index 16d87ef..f0e483b 100644 --- a/content/utility/utility_thread_impl.cc +++ b/content/utility/utility_thread_impl.cc @@ -12,12 +12,12 @@ #include "content/child/child_process.h" #include "content/child/webkitplatformsupport_impl.h" #include "content/common/child_process_messages.h" +#include "content/common/plugin_list.h" #include "content/common/utility_messages.h" #include "content/public/common/content_switches.h" #include "content/public/utility/content_utility_client.h" #include "ipc/ipc_sync_channel.h" #include "third_party/WebKit/public/web/WebKit.h" -#include "webkit/plugins/npapi/plugin_list.h" #if defined(TOOLKIT_GTK) #include <gtk/gtk.h> @@ -128,8 +128,7 @@ void UtilityThreadImpl::OnBatchModeFinished() { #if defined(OS_POSIX) void UtilityThreadImpl::OnLoadPlugins( const std::vector<base::FilePath>& plugin_paths) { - webkit::npapi::PluginList* plugin_list = - webkit::npapi::PluginList::Singleton(); + PluginList* plugin_list = PluginList::Singleton(); // On Linux, some plugins expect the browser to have loaded glib/gtk. Do that // before attempting to call into the plugin. diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc index 2e14a2b..cb123c0 100644 --- a/webkit/glue/webkitplatformsupport_impl.cc +++ b/webkit/glue/webkitplatformsupport_impl.cc @@ -48,7 +48,6 @@ #include "webkit/glue/webkit_glue.h" #include "webkit/glue/websocketstreamhandle_impl.h" #include "webkit/glue/weburlloader_impl.h" -#include "webkit/plugins/npapi/plugin_instance.h" #include "webkit/plugins/webplugininfo.h" using WebKit::WebAudioBus; diff --git a/webkit/plugins/npapi/plugin_utils.cc b/webkit/plugins/npapi/plugin_utils.cc index beaeb22..c110a44 100644 --- a/webkit/plugins/npapi/plugin_utils.cc +++ b/webkit/plugins/npapi/plugin_utils.cc @@ -10,6 +10,10 @@ #include "base/strings/string_util.h" #include "base/version.h" +#if defined(OS_WIN) +#include "ui/base/win/hwnd_util.h" +#endif + namespace webkit { namespace npapi { @@ -63,5 +67,69 @@ bool ShouldForcefullyTerminatePluginProcess() { return g_forcefully_terminate_plugin_process; } +#if defined(OS_WIN) + +const char16 kNativeWindowClassName[] = L"NativeWindowClass"; +const char16 kPluginNameAtomProperty[] = L"PluginNameAtom"; +const char16 kPluginVersionAtomProperty[] = L"PluginVersionAtom"; +const char16 kDummyActivationWindowName[] = L"DummyWindowForActivation"; + +namespace { + +bool GetPluginPropertyFromWindow( + HWND window, const wchar_t* plugin_atom_property, + base::string16* plugin_property) { + ATOM plugin_atom = reinterpret_cast<ATOM>( + GetPropW(window, plugin_atom_property)); + if (plugin_atom != 0) { + WCHAR plugin_property_local[MAX_PATH] = {0}; + GlobalGetAtomNameW(plugin_atom, + plugin_property_local, + ARRAYSIZE(plugin_property_local)); + *plugin_property = plugin_property_local; + return true; + } + return false; +} + +} // namespace + +bool IsPluginDelegateWindow(HWND window) { + return ui::GetClassName(window) == base::string16(kNativeWindowClassName); +} + +// static +bool GetPluginNameFromWindow( + HWND window, base::string16* plugin_name) { + return IsPluginDelegateWindow(window) && + GetPluginPropertyFromWindow( + window, kPluginNameAtomProperty, plugin_name); +} + +// static +bool GetPluginVersionFromWindow( + HWND window, base::string16* plugin_version) { + return IsPluginDelegateWindow(window) && + GetPluginPropertyFromWindow( + window, kPluginVersionAtomProperty, plugin_version); +} + +bool IsDummyActivationWindow(HWND window) { + if (!IsWindow(window)) + return false; + + wchar_t window_title[MAX_PATH + 1] = {0}; + if (GetWindowText(window, window_title, arraysize(window_title))) { + return (0 == lstrcmpiW(window_title, kDummyActivationWindowName)); + } + return false; +} + +HWND GetDefaultWindowParent() { + return GetDesktopWindow(); +} + +#endif + } // namespace npapi } // namespace webkit diff --git a/webkit/plugins/npapi/plugin_utils.h b/webkit/plugins/npapi/plugin_utils.h index cc241d8..3cce1c5 100644 --- a/webkit/plugins/npapi/plugin_utils.h +++ b/webkit/plugins/npapi/plugin_utils.h @@ -6,6 +6,7 @@ #define WEBKIT_PLUGINS_NPAPI_PLUGIN_UTILS_H_ #include "base/strings/string16.h" +#include "ui/gfx/native_widget_types.h" namespace base { class Version; @@ -31,6 +32,25 @@ void SetForcefullyTerminatePluginProcess(bool value); // instead of exiting cleanly. bool ShouldForcefullyTerminatePluginProcess(); +#if defined(OS_WIN) +// The window class name for a plugin window. +extern const char16 kNativeWindowClassName[]; +extern const char16 kPluginNameAtomProperty[]; +extern const char16 kPluginVersionAtomProperty[]; +extern const char16 kDummyActivationWindowName[]; + +bool IsPluginDelegateWindow(HWND window); +bool GetPluginNameFromWindow(HWND window, base::string16* plugin_name); +bool GetPluginVersionFromWindow(HWND window, base::string16* plugin_version); + +// Returns true if the window handle passed in is that of the dummy +// activation window for windowless plugins. +bool IsDummyActivationWindow(HWND window); + +// Returns the default HWND to parent the windowed plugins and dummy windows +// for activation to when none isavailable. +HWND GetDefaultWindowParent(); +#endif } // namespace npapi } // namespace webkit diff --git a/webkit/plugins/webkit_plugins.gyp b/webkit/plugins/webkit_plugins.gyp index 74751ae..2d5209d 100644 --- a/webkit/plugins/webkit_plugins.gyp +++ b/webkit/plugins/webkit_plugins.gyp @@ -30,13 +30,6 @@ '../plugins/plugin_constants.h', '../plugins/plugin_switches.cc', '../plugins/plugin_switches.h', - '../plugins/npapi/plugin_constants_win.cc', - '../plugins/npapi/plugin_constants_win.h', - '../plugins/npapi/plugin_list.cc', - '../plugins/npapi/plugin_list.h', - '../plugins/npapi/plugin_list_mac.mm', - '../plugins/npapi/plugin_list_posix.cc', - '../plugins/npapi/plugin_list_win.cc', '../plugins/npapi/plugin_utils.cc', '../plugins/npapi/plugin_utils.h', '../common/plugins/ppapi/ppapi_utils.cc', @@ -49,16 +42,6 @@ ], 'sources/': [['exclude', '_x11\\.cc$']], }], - ['OS!="mac"', { - 'sources/': [['exclude', '_mac\\.(cc|mm)$']], - }, { # else: OS=="mac" - 'sources/': [['exclude', 'plugin_list_posix\\.cc$']], - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', - ], - }, - }], ['OS!="win"', { 'sources/': [['exclude', '_win\\.cc$']], }, { # else: OS=="win" diff --git a/webkit/plugins/webkit_plugins.gypi b/webkit/plugins/webkit_plugins.gypi index dcf212e..0479a6c 100644 --- a/webkit/plugins/webkit_plugins.gypi +++ b/webkit/plugins/webkit_plugins.gypi @@ -46,42 +46,6 @@ # This list contains all .h, .cc, and .mm files in glue except for # those in the test subdirectory and those with unittest in in their # names. - '../plugins/npapi/gtk_plugin_container.cc', - '../plugins/npapi/gtk_plugin_container.h', - '../plugins/npapi/gtk_plugin_container_manager.cc', - '../plugins/npapi/gtk_plugin_container_manager.h', - '../plugins/npapi/plugin_host.cc', - '../plugins/npapi/plugin_host.h', - '../plugins/npapi/plugin_instance.cc', - '../plugins/npapi/plugin_instance.h', - '../plugins/npapi/plugin_instance_mac.mm', - '../plugins/npapi/plugin_lib.cc', - '../plugins/npapi/plugin_lib.h', - '../plugins/npapi/plugin_stream.cc', - '../plugins/npapi/plugin_stream.h', - '../plugins/npapi/plugin_stream_posix.cc', - '../plugins/npapi/plugin_stream_url.cc', - '../plugins/npapi/plugin_stream_url.h', - '../plugins/npapi/plugin_stream_win.cc', - '../plugins/npapi/plugin_string_stream.cc', - '../plugins/npapi/plugin_string_stream.h', - '../plugins/npapi/plugin_web_event_converter_mac.h', - '../plugins/npapi/plugin_web_event_converter_mac.mm', - '../plugins/npapi/webplugin.cc', - '../plugins/npapi/webplugin.h', - '../plugins/npapi/webplugin_accelerated_surface_mac.h', - '../plugins/npapi/webplugin_delegate.h', - '../plugins/npapi/webplugin_delegate_impl.cc', - '../plugins/npapi/webplugin_delegate_impl.h', - '../plugins/npapi/webplugin_delegate_impl_android.cc', - '../plugins/npapi/webplugin_delegate_impl_aura.cc', - '../plugins/npapi/webplugin_delegate_impl_gtk.cc', - '../plugins/npapi/webplugin_delegate_impl_mac.mm', - '../plugins/npapi/webplugin_delegate_impl_win.cc', - '../plugins/npapi/webplugin_ime_win.cc', - '../plugins/npapi/webplugin_ime_win.h', - '../plugins/npapi/webplugin_impl.cc', - '../plugins/npapi/webplugin_impl.h', '../plugins/ppapi/audio_helper.cc', '../plugins/ppapi/audio_helper.h', '../plugins/ppapi/common.h', @@ -170,31 +134,6 @@ '../plugins/webkit_plugins_export.h', ], 'conditions': [ - ['toolkit_uses_gtk == 1', { - 'dependencies': [ - '<(DEPTH)/build/linux/system.gyp:gtk', - ], - 'sources/': [['exclude', '_x11\\.cc$']], - }], - ['use_aura==1', { - 'sources/': [ - ['exclude', '^\\.\\./plugins/npapi/webplugin_delegate_impl_mac.mm'], - ], - }], - ['use_aura==1 and OS=="win"', { - 'sources/': [ - ['exclude', '^\\.\\./plugins/npapi/webplugin_delegate_impl_aura'], - ], - }], - ['OS!="mac"', { - 'sources/': [['exclude', '_mac\\.(cc|mm)$']], - }, { # else: OS=="mac" - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', - ], - }, - }], ['enable_gpu!=1', { 'sources!': [ '../plugins/ppapi/ppb_graphics_3d_impl.cc', diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi index 908b62a..4717896 100644 --- a/webkit/support/webkit_support.gypi +++ b/webkit/support/webkit_support.gypi @@ -27,7 +27,6 @@ '<(DEPTH)/webkit/common/user_agent/webkit_user_agent.gyp:user_agent', '<(DEPTH)/webkit/common/webkit_common.gyp:webkit_common', '<(DEPTH)/webkit/glue/webkit_glue_common.gyp:glue_common', - '<(DEPTH)/webkit/plugins/webkit_plugins.gyp:plugins_common', '<(DEPTH)/webkit/renderer/compositor_bindings/compositor_bindings.gyp:webkit_compositor_bindings', '<(DEPTH)/webkit/renderer/compositor_bindings/compositor_bindings.gyp:webkit_compositor_support', '<(DEPTH)/webkit/renderer/webkit_renderer.gyp:webkit_renderer', |