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() {
// In single process the single process is all there is.
suspend_webkit_shared_timer_ = true;
notify_webkit_of_modal_loop_ = true;
plugin_refresh_allowed_ = true;
widget_count_ = 0;
hidden_widget_count_ = 0;
idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs;
......@@ -1036,9 +1035,9 @@ void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) {
// 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
// regenerated.
plugin_refresh_allowed_ = false;
webkit_platform_support_->set_plugin_refresh_allowed(false);
WebKit::resetPluginCache(reload_pages);
plugin_refresh_allowed_ = true;
webkit_platform_support_->set_plugin_refresh_allowed(true);
FOR_EACH_OBSERVER(RenderProcessObserver, observers_, PluginListChanged());
}
......
......@@ -198,8 +198,6 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
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
// has been lost.
GpuChannelHost* GetGpuChannel();
......@@ -268,9 +266,6 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
// Initialize COM when using plugins outside the sandbox (Windows only).
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.
int widget_count_;
......
......@@ -79,6 +79,7 @@
#include "base/file_descriptor_posix.h"
#endif
using content::RenderThread;
using WebKit::WebAudioDevice;
using WebKit::WebBlobRegistry;
using WebKit::WebFileInfo;
......@@ -167,6 +168,7 @@ RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl()
clipboard_(new webkit_glue::WebClipboardImpl(clipboard_client_.get())),
mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry),
sudden_termination_disables_(0),
plugin_refresh_allowed_(true),
shared_worker_repository_(new WebSharedWorkerRepositoryImpl) {
if (g_sandbox_enabled) {
sandbox_support_.reset(
......@@ -184,7 +186,7 @@ RendererWebKitPlatformSupportImpl::~RendererWebKitPlatformSupportImpl() {
namespace {
bool SendSyncMessageFromAnyThreadInternal(IPC::SyncMessage* msg) {
RenderThreadImpl* render_thread = RenderThreadImpl::current();
RenderThread* render_thread = RenderThread::Get();
if (render_thread)
return render_thread->Send(msg);
scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter(
......@@ -296,12 +298,12 @@ void RendererWebKitPlatformSupportImpl::cacheMetadata(
// browser may cache it and return it on subsequent responses to speed
// the processing of this resource.
std::vector<char> copy(data, data + size);
RenderThreadImpl::current()->Send(
RenderThread::Get()->Send(
new ViewHostMsg_DidGenerateCacheableMetadata(url, response_time, copy));
}
WebString RendererWebKitPlatformSupportImpl::defaultLocale() {
return ASCIIToUTF16(RenderThreadImpl::Get()->GetLocale());
return ASCIIToUTF16(RenderThread::Get()->GetLocale());
}
void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) {
......@@ -319,7 +321,7 @@ void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) {
return;
}
RenderThreadImpl* thread = RenderThreadImpl::current();
RenderThread* thread = RenderThread::Get();
if (thread) // NULL in unittests.
thread->Send(new ViewHostMsg_SuddenTerminationChanged(enabled));
}
......@@ -385,7 +387,7 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeForExtension(
// The sandbox restricts our access to the registry, so we need to proxy
// these calls over to the browser process.
std::string mime_type;
RenderThreadImpl::current()->Send(
RenderThread::Get()->Send(
new MimeRegistryMsg_GetMimeTypeFromExtension(
webkit_glue::WebStringToFilePathString(file_extension), &mime_type));
return ASCIIToUTF16(mime_type);
......@@ -400,7 +402,7 @@ WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile(
// The sandbox restricts our access to the registry, so we need to proxy
// these calls over to the browser process.
std::string mime_type;
RenderThreadImpl::current()->Send(new MimeRegistryMsg_GetMimeTypeFromFile(
RenderThread::Get()->Send(new MimeRegistryMsg_GetMimeTypeFromFile(
FilePath(webkit_glue::WebStringToFilePathString(file_path)),
&mime_type));
return ASCIIToUTF16(mime_type);
......@@ -416,7 +418,7 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::preferredExtensionForMIMEType(
// The sandbox restricts our access to the registry, so we need to proxy
// these calls over to the browser process.
FilePath::StringType file_extension;
RenderThreadImpl::current()->Send(
RenderThread::Get()->Send(
new MimeRegistryMsg_GetPreferredExtensionForMimeType(
UTF16ToASCII(mime_type), &file_extension));
return webkit_glue::FilePathStringToWebString(file_extension);
......@@ -456,7 +458,7 @@ bool RendererWebKitPlatformSupportImpl::SandboxSupport::ensureFontLoaded(
HFONT font) {
LOGFONT logfont;
GetObject(font, sizeof(LOGFONT), &logfont);
RenderThreadImpl::current()->PreCacheFont(logfont);
RenderThread::Get()->PreCacheFont(logfont);
return true;
}
......@@ -467,7 +469,7 @@ bool RendererWebKitPlatformSupportImpl::SandboxSupport::loadFont(
uint32 font_data_size;
FontDescriptor src_font_descriptor(src_font);
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))) {
*out = NULL;
*font_id = 0;
......@@ -648,7 +650,7 @@ RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString(
const WebKit::WebString& challenge,
const WebKit::WebURL& url) {
std::string signed_public_key;
RenderThreadImpl::current()->Send(new ViewHostMsg_Keygen(
RenderThread::Get()->Send(new ViewHostMsg_Keygen(
static_cast<uint32>(key_size_index),
challenge.utf8(),
GURL(url),
......@@ -661,7 +663,7 @@ RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString(
void RendererWebKitPlatformSupportImpl::screenColorProfile(
WebVector<char>* to_profile) {
std::vector<char> profile;
RenderThreadImpl::current()->Send(
RenderThread::Get()->Send(
new ViewHostMsg_GetMonitorColorProfile(&profile));
*to_profile = profile;
}
......@@ -691,9 +693,9 @@ WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent(
void RendererWebKitPlatformSupportImpl::GetPlugins(
bool refresh, std::vector<webkit::WebPluginInfo>* plugins) {
if (!RenderThreadImpl::current()->plugin_refresh_allowed())
if (!plugin_refresh_allowed_)
refresh = false;
RenderThreadImpl::current()->Send(
RenderThread::Get()->Send(
new ViewHostMsg_GetPlugins(refresh, plugins));
}
......
......@@ -30,6 +30,9 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
RendererWebKitPlatformSupportImpl();
virtual ~RendererWebKitPlatformSupportImpl();
void set_plugin_refresh_allowed(bool plugin_refresh_allowed) {
plugin_refresh_allowed_ = plugin_refresh_allowed;
}
// WebKitPlatformSupport methods:
virtual WebKit::WebClipboard* clipboard() OVERRIDE;
virtual WebKit::WebMimeRegistry* mimeRegistry() OVERRIDE;
......@@ -123,6 +126,9 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
// we tell the browser to enable fast termination.
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
// to WorkerService on the browser thread.
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