Commit a70b4351 authored by fsamuel@chromium.org's avatar fsamuel@chromium.org

Make plugins work in a RenderViewTest

BUG=none
Test=Some new browser plugin tests that will be upstreamed independently


Review URL: https://chromiumcodereview.appspot.com/10823086

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149297 0039d316-1c4b-4281-b951-d872f2087c98
parent 2d6576ce
...@@ -214,7 +214,6 @@ void RenderThreadImpl::Init() { ...@@ -214,7 +214,6 @@ void RenderThreadImpl::Init() {
// In single process the single process is all there is. // In single process the single process is all there is.
suspend_webkit_shared_timer_ = true; suspend_webkit_shared_timer_ = true;
notify_webkit_of_modal_loop_ = true; notify_webkit_of_modal_loop_ = true;
plugin_refresh_allowed_ = true;
widget_count_ = 0; widget_count_ = 0;
hidden_widget_count_ = 0; hidden_widget_count_ = 0;
idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs;
...@@ -1036,9 +1035,9 @@ void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) { ...@@ -1036,9 +1035,9 @@ void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) {
// point we already know that the browser has refreshed its list, so disable // point we already know that the browser has refreshed its list, so disable
// refresh temporarily to prevent each renderer process causing the list to be // refresh temporarily to prevent each renderer process causing the list to be
// regenerated. // regenerated.
plugin_refresh_allowed_ = false; webkit_platform_support_->set_plugin_refresh_allowed(false);
WebKit::resetPluginCache(reload_pages); WebKit::resetPluginCache(reload_pages);
plugin_refresh_allowed_ = true; webkit_platform_support_->set_plugin_refresh_allowed(true);
FOR_EACH_OBSERVER(RenderProcessObserver, observers_, PluginListChanged()); FOR_EACH_OBSERVER(RenderProcessObserver, observers_, PluginListChanged());
} }
......
...@@ -198,8 +198,6 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, ...@@ -198,8 +198,6 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
return vc_manager_.get(); return vc_manager_.get();
} }
bool plugin_refresh_allowed() const { return plugin_refresh_allowed_; }
// Get the GPU channel. Returns NULL if the channel is not established or // Get the GPU channel. Returns NULL if the channel is not established or
// has been lost. // has been lost.
GpuChannelHost* GetGpuChannel(); GpuChannelHost* GetGpuChannel();
...@@ -268,9 +266,6 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, ...@@ -268,9 +266,6 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
// Initialize COM when using plugins outside the sandbox (Windows only). // Initialize COM when using plugins outside the sandbox (Windows only).
scoped_ptr<base::win::ScopedCOMInitializer> initialize_com_; scoped_ptr<base::win::ScopedCOMInitializer> initialize_com_;
// If true, then a GetPlugins call is allowed to rescan the disk.
bool plugin_refresh_allowed_;
// The count of RenderWidgets running through this thread. // The count of RenderWidgets running through this thread.
int widget_count_; int widget_count_;
......
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
#include "base/file_descriptor_posix.h" #include "base/file_descriptor_posix.h"
#endif #endif
using content::RenderThread;
using WebKit::WebAudioDevice; using WebKit::WebAudioDevice;
using WebKit::WebBlobRegistry; using WebKit::WebBlobRegistry;
using WebKit::WebFileInfo; using WebKit::WebFileInfo;
...@@ -167,6 +168,7 @@ RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl() ...@@ -167,6 +168,7 @@ RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl()
clipboard_(new webkit_glue::WebClipboardImpl(clipboard_client_.get())), clipboard_(new webkit_glue::WebClipboardImpl(clipboard_client_.get())),
mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry), mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry),
sudden_termination_disables_(0), sudden_termination_disables_(0),
plugin_refresh_allowed_(true),
shared_worker_repository_(new WebSharedWorkerRepositoryImpl) { shared_worker_repository_(new WebSharedWorkerRepositoryImpl) {
if (g_sandbox_enabled) { if (g_sandbox_enabled) {
sandbox_support_.reset( sandbox_support_.reset(
...@@ -184,7 +186,7 @@ RendererWebKitPlatformSupportImpl::~RendererWebKitPlatformSupportImpl() { ...@@ -184,7 +186,7 @@ RendererWebKitPlatformSupportImpl::~RendererWebKitPlatformSupportImpl() {
namespace { namespace {
bool SendSyncMessageFromAnyThreadInternal(IPC::SyncMessage* msg) { bool SendSyncMessageFromAnyThreadInternal(IPC::SyncMessage* msg) {
RenderThreadImpl* render_thread = RenderThreadImpl::current(); RenderThread* render_thread = RenderThread::Get();
if (render_thread) if (render_thread)
return render_thread->Send(msg); return render_thread->Send(msg);
scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter( scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter(
...@@ -296,12 +298,12 @@ void RendererWebKitPlatformSupportImpl::cacheMetadata( ...@@ -296,12 +298,12 @@ void RendererWebKitPlatformSupportImpl::cacheMetadata(
// browser may cache it and return it on subsequent responses to speed // browser may cache it and return it on subsequent responses to speed
// the processing of this resource. // the processing of this resource.
std::vector<char> copy(data, data + size); std::vector<char> copy(data, data + size);
RenderThreadImpl::current()->Send( RenderThread::Get()->Send(
new ViewHostMsg_DidGenerateCacheableMetadata(url, response_time, copy)); new ViewHostMsg_DidGenerateCacheableMetadata(url, response_time, copy));
} }
WebString RendererWebKitPlatformSupportImpl::defaultLocale() { WebString RendererWebKitPlatformSupportImpl::defaultLocale() {
return ASCIIToUTF16(RenderThreadImpl::Get()->GetLocale()); return ASCIIToUTF16(RenderThread::Get()->GetLocale());
} }
void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) { void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) {
...@@ -319,7 +321,7 @@ void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) { ...@@ -319,7 +321,7 @@ void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) {
return; return;
} }
RenderThreadImpl* thread = RenderThreadImpl::current(); RenderThread* thread = RenderThread::Get();
if (thread) // NULL in unittests. if (thread) // NULL in unittests.
thread->Send(new ViewHostMsg_SuddenTerminationChanged(enabled)); thread->Send(new ViewHostMsg_SuddenTerminationChanged(enabled));
} }
...@@ -385,7 +387,7 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeForExtension( ...@@ -385,7 +387,7 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeForExtension(
// The sandbox restricts our access to the registry, so we need to proxy // The sandbox restricts our access to the registry, so we need to proxy
// these calls over to the browser process. // these calls over to the browser process.
std::string mime_type; std::string mime_type;
RenderThreadImpl::current()->Send( RenderThread::Get()->Send(
new MimeRegistryMsg_GetMimeTypeFromExtension( new MimeRegistryMsg_GetMimeTypeFromExtension(
webkit_glue::WebStringToFilePathString(file_extension), &mime_type)); webkit_glue::WebStringToFilePathString(file_extension), &mime_type));
return ASCIIToUTF16(mime_type); return ASCIIToUTF16(mime_type);
...@@ -400,7 +402,7 @@ WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile( ...@@ -400,7 +402,7 @@ WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile(
// The sandbox restricts our access to the registry, so we need to proxy // The sandbox restricts our access to the registry, so we need to proxy
// these calls over to the browser process. // these calls over to the browser process.
std::string mime_type; std::string mime_type;
RenderThreadImpl::current()->Send(new MimeRegistryMsg_GetMimeTypeFromFile( RenderThread::Get()->Send(new MimeRegistryMsg_GetMimeTypeFromFile(
FilePath(webkit_glue::WebStringToFilePathString(file_path)), FilePath(webkit_glue::WebStringToFilePathString(file_path)),
&mime_type)); &mime_type));
return ASCIIToUTF16(mime_type); return ASCIIToUTF16(mime_type);
...@@ -416,7 +418,7 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::preferredExtensionForMIMEType( ...@@ -416,7 +418,7 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::preferredExtensionForMIMEType(
// The sandbox restricts our access to the registry, so we need to proxy // The sandbox restricts our access to the registry, so we need to proxy
// these calls over to the browser process. // these calls over to the browser process.
FilePath::StringType file_extension; FilePath::StringType file_extension;
RenderThreadImpl::current()->Send( RenderThread::Get()->Send(
new MimeRegistryMsg_GetPreferredExtensionForMimeType( new MimeRegistryMsg_GetPreferredExtensionForMimeType(
UTF16ToASCII(mime_type), &file_extension)); UTF16ToASCII(mime_type), &file_extension));
return webkit_glue::FilePathStringToWebString(file_extension); return webkit_glue::FilePathStringToWebString(file_extension);
...@@ -456,7 +458,7 @@ bool RendererWebKitPlatformSupportImpl::SandboxSupport::ensureFontLoaded( ...@@ -456,7 +458,7 @@ bool RendererWebKitPlatformSupportImpl::SandboxSupport::ensureFontLoaded(
HFONT font) { HFONT font) {
LOGFONT logfont; LOGFONT logfont;
GetObject(font, sizeof(LOGFONT), &logfont); GetObject(font, sizeof(LOGFONT), &logfont);
RenderThreadImpl::current()->PreCacheFont(logfont); RenderThread::Get()->PreCacheFont(logfont);
return true; return true;
} }
...@@ -467,7 +469,7 @@ bool RendererWebKitPlatformSupportImpl::SandboxSupport::loadFont( ...@@ -467,7 +469,7 @@ bool RendererWebKitPlatformSupportImpl::SandboxSupport::loadFont(
uint32 font_data_size; uint32 font_data_size;
FontDescriptor src_font_descriptor(src_font); FontDescriptor src_font_descriptor(src_font);
base::SharedMemoryHandle font_data; base::SharedMemoryHandle font_data;
if (!RenderThreadImpl::current()->Send(new ViewHostMsg_LoadFont( if (!RenderThread::Get()->Send(new ViewHostMsg_LoadFont(
src_font_descriptor, &font_data_size, &font_data, font_id))) { src_font_descriptor, &font_data_size, &font_data, font_id))) {
*out = NULL; *out = NULL;
*font_id = 0; *font_id = 0;
...@@ -648,7 +650,7 @@ RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( ...@@ -648,7 +650,7 @@ RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString(
const WebKit::WebString& challenge, const WebKit::WebString& challenge,
const WebKit::WebURL& url) { const WebKit::WebURL& url) {
std::string signed_public_key; std::string signed_public_key;
RenderThreadImpl::current()->Send(new ViewHostMsg_Keygen( RenderThread::Get()->Send(new ViewHostMsg_Keygen(
static_cast<uint32>(key_size_index), static_cast<uint32>(key_size_index),
challenge.utf8(), challenge.utf8(),
GURL(url), GURL(url),
...@@ -661,7 +663,7 @@ RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( ...@@ -661,7 +663,7 @@ RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString(
void RendererWebKitPlatformSupportImpl::screenColorProfile( void RendererWebKitPlatformSupportImpl::screenColorProfile(
WebVector<char>* to_profile) { WebVector<char>* to_profile) {
std::vector<char> profile; std::vector<char> profile;
RenderThreadImpl::current()->Send( RenderThread::Get()->Send(
new ViewHostMsg_GetMonitorColorProfile(&profile)); new ViewHostMsg_GetMonitorColorProfile(&profile));
*to_profile = profile; *to_profile = profile;
} }
...@@ -691,9 +693,9 @@ WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent( ...@@ -691,9 +693,9 @@ WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent(
void RendererWebKitPlatformSupportImpl::GetPlugins( void RendererWebKitPlatformSupportImpl::GetPlugins(
bool refresh, std::vector<webkit::WebPluginInfo>* plugins) { bool refresh, std::vector<webkit::WebPluginInfo>* plugins) {
if (!RenderThreadImpl::current()->plugin_refresh_allowed()) if (!plugin_refresh_allowed_)
refresh = false; refresh = false;
RenderThreadImpl::current()->Send( RenderThread::Get()->Send(
new ViewHostMsg_GetPlugins(refresh, plugins)); new ViewHostMsg_GetPlugins(refresh, plugins));
} }
......
...@@ -30,6 +30,9 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl ...@@ -30,6 +30,9 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
RendererWebKitPlatformSupportImpl(); RendererWebKitPlatformSupportImpl();
virtual ~RendererWebKitPlatformSupportImpl(); virtual ~RendererWebKitPlatformSupportImpl();
void set_plugin_refresh_allowed(bool plugin_refresh_allowed) {
plugin_refresh_allowed_ = plugin_refresh_allowed;
}
// WebKitPlatformSupport methods: // WebKitPlatformSupport methods:
virtual WebKit::WebClipboard* clipboard() OVERRIDE; virtual WebKit::WebClipboard* clipboard() OVERRIDE;
virtual WebKit::WebMimeRegistry* mimeRegistry() OVERRIDE; virtual WebKit::WebMimeRegistry* mimeRegistry() OVERRIDE;
...@@ -123,6 +126,9 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl ...@@ -123,6 +126,9 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
// we tell the browser to enable fast termination. // we tell the browser to enable fast termination.
int sudden_termination_disables_; int sudden_termination_disables_;
// If true, then a GetPlugins call is allowed to rescan the disk.
bool plugin_refresh_allowed_;
// Implementation of the WebSharedWorkerRepository APIs (provides an interface // Implementation of the WebSharedWorkerRepository APIs (provides an interface
// to WorkerService on the browser thread. // to WorkerService on the browser thread.
scoped_ptr<WebSharedWorkerRepositoryImpl> shared_worker_repository_; scoped_ptr<WebSharedWorkerRepositoryImpl> shared_worker_repository_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment