summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 21:17:48 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 21:17:48 +0000
commit7a1f7c6f6c982287b3f6bb2acded619f3824416c (patch)
tree82ff404c4bcf84520c21ea7f0526ad5a40661641 /content
parentbafaee12825a06890f114a282880e135a8b0b1ae (diff)
downloadchromium_src-7a1f7c6f6c982287b3f6bb2acded619f3824416c.zip
chromium_src-7a1f7c6f6c982287b3f6bb2acded619f3824416c.tar.gz
chromium_src-7a1f7c6f6c982287b3f6bb2acded619f3824416c.tar.bz2
Make the Pepper proxy support in-process font rendering.
This implements a WebKit thread in the PPAPI plugin process so we can do the font calls without IPC. The existing font support was refactored into a virtual class (to prevent PPAPI from depending on WebKit and creating a circular GYP dependency). This moves the renderer sandbox support into content/common so that it can be used by the PPAPI process. Review URL: http://codereview.chromium.org/6981001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84856 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/common/child_process_sandbox_support_linux.cc (renamed from content/renderer/renderer_sandbox_support_linux.cc)7
-rw-r--r--content/common/child_process_sandbox_support_linux.h (renamed from content/renderer/renderer_sandbox_support_linux.h)12
-rw-r--r--content/common/pepper_plugin_registry.cc14
-rw-r--r--content/common/pepper_plugin_registry.h3
-rw-r--r--content/content_browser.gypi2
-rw-r--r--content/content_common.gypi2
-rw-r--r--content/content_ppapi_plugin.gypi6
-rw-r--r--content/content_renderer.gypi4
-rw-r--r--content/ppapi_plugin/ppapi_thread.cc15
-rw-r--r--content/ppapi_plugin/ppapi_thread.h9
-rw-r--r--content/ppapi_plugin/ppapi_webkit_thread.cc44
-rw-r--r--content/ppapi_plugin/ppapi_webkit_thread.h50
-rw-r--r--content/ppapi_plugin/ppapi_webkitclient_impl.cc238
-rw-r--r--content/ppapi_plugin/ppapi_webkitclient_impl.h66
-rw-r--r--content/renderer/render_process_impl.cc4
-rw-r--r--content/renderer/renderer_glue.cc6
-rw-r--r--content/renderer/renderer_webkitclient_impl.cc21
17 files changed, 471 insertions, 32 deletions
diff --git a/content/renderer/renderer_sandbox_support_linux.cc b/content/common/child_process_sandbox_support_linux.cc
index 11d27a6..92eea45 100644
--- a/content/renderer/renderer_sandbox_support_linux.cc
+++ b/content/common/child_process_sandbox_support_linux.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 "content/renderer/renderer_sandbox_support_linux.h"
+#include "content/common/child_process_sandbox_support_linux.h"
#include <sys/stat.h>
@@ -13,14 +13,13 @@
#include "content/common/chrome_descriptors.h"
#include "content/common/sandbox_methods_linux.h"
#include "content/common/unix_domain_socket_posix.h"
-
#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h"
static int GetSandboxFD() {
return kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor;
}
-namespace renderer_sandbox_support {
+namespace child_process_sandbox_support {
std::string getFontFamilyForCharacters(const uint16_t* utf16,
size_t num_utf16,
@@ -186,4 +185,4 @@ bool GetFontTable(int fd, uint32_t table, uint8_t* output,
return true;
}
-} // namespace render_sandbox_support
+} // namespace child_process_sandbox_support
diff --git a/content/renderer/renderer_sandbox_support_linux.h b/content/common/child_process_sandbox_support_linux.h
index bc482bd..4e7b4fb 100644
--- a/content/renderer/renderer_sandbox_support_linux.h
+++ b/content/common/child_process_sandbox_support_linux.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_
-#define CONTENT_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_
+#ifndef CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_
+#define CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_
#pragma once
#include <stdint.h>
@@ -14,7 +14,7 @@ namespace WebKit {
struct WebFontRenderStyle;
}
-namespace renderer_sandbox_support {
+namespace child_process_sandbox_support {
// Return a font family which provides glyphs for the Unicode code points
// specified by |utf16|
@@ -54,6 +54,6 @@ int MatchFontWithFallback(const std::string& face, bool bold,
bool GetFontTable(int fd, uint32_t table, uint8_t* output,
size_t* output_length);
-}; // namespace render_sandbox_support
+}; // namespace child_process_sandbox_support
-#endif // CONTENT_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_
+#endif // CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_
diff --git a/content/common/pepper_plugin_registry.cc b/content/common/pepper_plugin_registry.cc
index c8b1c78..0d2a93c 100644
--- a/content/common/pepper_plugin_registry.cc
+++ b/content/common/pepper_plugin_registry.cc
@@ -232,5 +232,19 @@ base::WaitableEvent* PepperPluginRegistry::GetShutdownEvent() {
std::set<PP_Instance>* PepperPluginRegistry::GetGloballySeenInstanceIDSet() {
// This function is not needed on the host side of the proxy.
+ NOTREACHED();
return NULL;
}
+
+pp::shared_impl::WebKitForwarding* PepperPluginRegistry::GetWebKitForwarding() {
+ // This function is not needed on the host side of the proxy.
+ NOTREACHED();
+ return NULL;
+}
+
+void PepperPluginRegistry::PostToWebKitThread(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task) {
+ // This function is not needed on the host side of the proxy.
+ NOTREACHED();
+}
diff --git a/content/common/pepper_plugin_registry.h b/content/common/pepper_plugin_registry.h
index 7dd9038..ba4ea8a 100644
--- a/content/common/pepper_plugin_registry.h
+++ b/content/common/pepper_plugin_registry.h
@@ -100,6 +100,9 @@ class PepperPluginRegistry
virtual base::MessageLoopProxy* GetIPCMessageLoop();
virtual base::WaitableEvent* GetShutdownEvent();
virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet();
+ virtual pp::shared_impl::WebKitForwarding* GetWebKitForwarding();
+ virtual void PostToWebKitThread(const tracked_objects::Location& from_here,
+ const base::Closure& task);
// All known pepper plugins.
std::vector<PepperPluginInfo> plugin_list_;
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 13d01c1..613b4a7 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -10,7 +10,7 @@
'dependencies': [
'content_common',
'../app/app.gyp:app_resources',
- '../ppapi/ppapi.gyp:ppapi_proxy',
+ '../ppapi/ppapi_internal.gyp:ppapi_proxy',
'../skia/skia.gyp:skia',
'../third_party/flac/flac.gyp:libflac',
'../third_party/speex/speex.gyp:libspeex',
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 2e61611..252cf74 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -43,6 +43,8 @@
'common/child_process_info.cc',
'common/child_process_info.h',
'common/child_process_messages.h',
+ 'common/child_process_sandbox_support_linux.cc',
+ 'common/child_process_sandbox_support_linux.h',
'common/child_thread.cc',
'common/child_thread.h',
'common/child_trace_message_filter.cc',
diff --git a/content/content_ppapi_plugin.gypi b/content/content_ppapi_plugin.gypi
index e62050b..6dc13d3 100644
--- a/content/content_ppapi_plugin.gypi
+++ b/content/content_ppapi_plugin.gypi
@@ -9,7 +9,7 @@
'type': '<(library)',
'dependencies': [
'../base/base.gyp:base',
- '../ppapi/ppapi.gyp:ppapi_proxy',
+ '../ppapi/ppapi_internal.gyp:ppapi_proxy',
],
'sources': [
'ppapi_plugin/broker_process_dispatcher.cc',
@@ -20,6 +20,10 @@
'ppapi_plugin/ppapi_plugin_main.cc',
'ppapi_plugin/ppapi_thread.cc',
'ppapi_plugin/ppapi_thread.h',
+ 'ppapi_plugin/ppapi_webkit_thread.cc',
+ 'ppapi_plugin/ppapi_webkit_thread.h',
+ 'ppapi_plugin/ppapi_webkitclient_impl.cc',
+ 'ppapi_plugin/ppapi_webkitclient_impl.h',
],
'include_dirs': [
'..',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 21e6ac1..8271e75 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -11,7 +11,7 @@
'dependencies': [
'content_common',
'../jingle/jingle.gyp:jingle_glue',
- '../ppapi/ppapi.gyp:ppapi_proxy',
+ '../ppapi/ppapi_internal.gyp:ppapi_proxy',
'../skia/skia.gyp:skia',
'../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
'../third_party/icu/icu.gyp:icuuc',
@@ -102,8 +102,6 @@
'renderer/renderer_main_platform_delegate_linux.cc',
'renderer/renderer_main_platform_delegate_mac.mm',
'renderer/renderer_main_platform_delegate_win.cc',
- 'renderer/renderer_sandbox_support_linux.cc',
- 'renderer/renderer_sandbox_support_linux.h',
'renderer/renderer_webapplicationcachehost_impl.cc',
'renderer/renderer_webapplicationcachehost_impl.h',
'renderer/renderer_webaudiodevice_impl.cc',
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index 91c3f85..73c0d5f 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -12,11 +12,13 @@
#include "content/common/child_process.h"
#include "content/ppapi_plugin/broker_process_dispatcher.h"
#include "content/ppapi_plugin/plugin_process_dispatcher.h"
+#include "content/ppapi_plugin/ppapi_webkit_thread.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_sync_channel.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppp.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "webkit/plugins/ppapi/webkit_forwarding_impl.h"
#if defined(OS_WIN)
#include "sandbox/src/sandbox.h"
@@ -81,6 +83,19 @@ std::set<PP_Instance>* PpapiThread::GetGloballySeenInstanceIDSet() {
return &globally_seen_instance_ids_;
}
+pp::shared_impl::WebKitForwarding* PpapiThread::GetWebKitForwarding() {
+ if (!webkit_forwarding_.get())
+ webkit_forwarding_.reset(new webkit::ppapi::WebKitForwardingImpl);
+ return webkit_forwarding_.get();
+}
+
+void PpapiThread::PostToWebKitThread(const tracked_objects::Location& from_here,
+ const base::Closure& task) {
+ if (!webkit_thread_.get())
+ webkit_thread_.reset(new PpapiWebKitThread);
+ webkit_thread_->PostTask(from_here, task);
+}
+
void PpapiThread::OnMsgLoadPlugin(const FilePath& path) {
base::ScopedNativeLibrary library(base::LoadNativeLibrary(path, NULL));
diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h
index 50bda11..5b7e3c4 100644
--- a/content/ppapi_plugin/ppapi_thread.h
+++ b/content/ppapi_plugin/ppapi_thread.h
@@ -17,6 +17,7 @@
#include "ppapi/c/trusted/ppp_broker.h"
class FilePath;
+class PpapiWebKitThread;
namespace IPC {
struct ChannelHandle;
@@ -36,6 +37,9 @@ class PpapiThread : public ChildThread,
virtual base::MessageLoopProxy* GetIPCMessageLoop();
virtual base::WaitableEvent* GetShutdownEvent();
virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet();
+ virtual pp::shared_impl::WebKitForwarding* GetWebKitForwarding();
+ virtual void PostToWebKitThread(const tracked_objects::Location& from_here,
+ const base::Closure& task);
// Message handlers.
void OnMsgLoadPlugin(const FilePath& path);
@@ -70,6 +74,11 @@ class PpapiThread : public ChildThread,
// See Dispatcher::Delegate::GetGloballySeenInstanceIDSet.
std::set<PP_Instance> globally_seen_instance_ids_;
+ // Lazily created by GetWebKitForwarding.
+ scoped_ptr<pp::shared_impl::WebKitForwarding> webkit_forwarding_;
+
+ scoped_ptr<PpapiWebKitThread> webkit_thread_;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread);
};
diff --git a/content/ppapi_plugin/ppapi_webkit_thread.cc b/content/ppapi_plugin/ppapi_webkit_thread.cc
new file mode 100644
index 0000000..1320138
--- /dev/null
+++ b/content/ppapi_plugin/ppapi_webkit_thread.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2011 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.
+
+#include "content/ppapi_plugin/ppapi_webkit_thread.h"
+
+#include "base/logging.h"
+#include "content/ppapi_plugin/ppapi_webkitclient_impl.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
+
+PpapiWebKitThread::PpapiWebKitThread() {
+ DCHECK(!webkit_thread_.get());
+
+ webkit_thread_.reset(new InternalWebKitThread);
+ bool started = webkit_thread_->Start();
+ DCHECK(started);
+}
+
+PpapiWebKitThread::~PpapiWebKitThread() {
+}
+
+void PpapiWebKitThread::PostTask(const tracked_objects::Location& from_here,
+ const base::Closure& task) {
+ webkit_thread_->message_loop()->PostTask(from_here, task);
+}
+
+PpapiWebKitThread::InternalWebKitThread::InternalWebKitThread()
+ : base::Thread("PPAPIWebKit") {
+}
+
+PpapiWebKitThread::InternalWebKitThread::~InternalWebKitThread() {
+ Stop();
+}
+
+void PpapiWebKitThread::InternalWebKitThread::Init() {
+ DCHECK(!webkit_client_.get());
+ webkit_client_.reset(new PpapiWebKitClientImpl);
+ WebKit::initialize(webkit_client_.get());
+}
+
+void PpapiWebKitThread::InternalWebKitThread::CleanUp() {
+ DCHECK(webkit_client_.get());
+ WebKit::shutdown();
+}
diff --git a/content/ppapi_plugin/ppapi_webkit_thread.h b/content/ppapi_plugin/ppapi_webkit_thread.h
new file mode 100644
index 0000000..a6f338e
--- /dev/null
+++ b/content/ppapi_plugin/ppapi_webkit_thread.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2011 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_PPAPI_PLUGIN_PPAPI_WEBKIT_THREAD_H_
+#define CONTENT_PPAPI_PLUGIN_PPAPI_WEBKIT_THREAD_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/threading/thread.h"
+
+class PpapiWebKitClientImpl;
+
+// This creates a WebKit main thread on instantiation on construction and kills
+// it on deletion. See also content/browser/in_process_webkit for the
+// corresponding concept in the browser process.
+class PpapiWebKitThread {
+ public:
+ PpapiWebKitThread();
+ ~PpapiWebKitThread();
+
+ // Posts the given task to the thread, see MessageLoop::PostTask.
+ void PostTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task);
+
+ private:
+ // Must be private so that we can carefully control its lifetime.
+ class InternalWebKitThread : public base::Thread {
+ public:
+ InternalWebKitThread();
+ virtual ~InternalWebKitThread();
+ // Does the actual initialization and shutdown of WebKit. Called at the
+ // beginning and end of the thread's lifetime.
+ virtual void Init();
+ virtual void CleanUp();
+
+ private:
+ // The WebKitClient implementation. Only access on WebKit thread.
+ scoped_ptr<PpapiWebKitClientImpl> webkit_client_;
+ };
+
+ // Pointer to the actual WebKitThread.
+ scoped_ptr<InternalWebKitThread> webkit_thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(PpapiWebKitThread);
+};
+
+#endif // CONTENT_PPAPI_PLUGIN_PPAPI_WEBKIT_THREAD_H_
diff --git a/content/ppapi_plugin/ppapi_webkitclient_impl.cc b/content/ppapi_plugin/ppapi_webkitclient_impl.cc
new file mode 100644
index 0000000..1abbe94
--- /dev/null
+++ b/content/ppapi_plugin/ppapi_webkitclient_impl.cc
@@ -0,0 +1,238 @@
+// Copyright (c) 2011 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.
+
+#include "content/ppapi_plugin/ppapi_webkitclient_impl.h"
+
+#include <map>
+
+#include "base/synchronization/lock.h"
+#include "base/logging.h"
+#include "base/string16.h"
+#include "build/build_config.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
+
+#if defined(OS_WIN)
+#include "third_party/WebKit/Source/WebKit/chromium/public/win/WebSandboxSupport.h"
+#elif defined(OS_MACOSX)
+#include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebSandboxSupport.h"
+#elif defined(OS_LINUX)
+#include "content/common/child_process_sandbox_support_linux.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebSandboxSupport.h"
+#endif
+
+using WebKit::WebSandboxSupport;
+using WebKit::WebString;
+using WebKit::WebUChar;
+
+class PpapiWebKitClientImpl::SandboxSupport : public WebSandboxSupport {
+ public:
+#if defined(OS_WIN)
+ virtual bool ensureFontLoaded(HFONT);
+#elif defined(OS_MACOSX)
+ virtual bool loadFont(NSFont* srcFont, ATSFontContainerRef* out);
+#elif defined(OS_LINUX)
+ virtual WebString getFontFamilyForCharacters(
+ const WebUChar* characters,
+ size_t numCharacters,
+ const char* preferred_locale);
+ virtual void getRenderStyleForStrike(
+ const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out);
+
+ private:
+ // WebKit likes to ask us for the correct font family to use for a set of
+ // unicode code points. It needs this information frequently so we cache it
+ // here. The key in this map is an array of 16-bit UTF16 values from WebKit.
+ // The value is a string containing the correct font family.
+ base::Lock unicode_font_families_mutex_;
+ std::map<string16, std::string> unicode_font_families_;
+#endif
+};
+
+#if defined(OS_WIN)
+
+bool PpapiWebKitClientImpl::SandboxSupport::ensureFontLoaded(HFONT font) {
+ // TODO(brettw) this should do the something similar to what
+ // RendererWebKitClientImpl does and request that the browser load the font.
+ NOTIMPLEMENTED();
+ return false;
+}
+
+#elif defined(OS_MACOSX)
+
+bool PpapiWebKitClientImpl::SandboxSupport::loadFont(NSFont* srcFont,
+ ATSFontContainerRef* out) {
+ // TODO(brettw) this should do the something similar to what
+ // RendererWebKitClientImpl does and request that the browser load the font.
+ NOTIMPLEMENTED();
+ return false;
+}
+
+#elif defined(OS_LINUX)
+
+WebString PpapiWebKitClientImpl::SandboxSupport::getFontFamilyForCharacters(
+ const WebUChar* characters,
+ size_t num_characters,
+ const char* preferred_locale) {
+ base::AutoLock lock(unicode_font_families_mutex_);
+ const string16 key(characters, num_characters);
+ const std::map<string16, std::string>::const_iterator iter =
+ unicode_font_families_.find(key);
+ if (iter != unicode_font_families_.end())
+ return WebString::fromUTF8(iter->second);
+
+ const std::string family_name =
+ child_process_sandbox_support::getFontFamilyForCharacters(
+ characters,
+ num_characters,
+ preferred_locale);
+ unicode_font_families_.insert(make_pair(key, family_name));
+ return WebString::fromUTF8(family_name);
+}
+
+void PpapiWebKitClientImpl::SandboxSupport::getRenderStyleForStrike(
+ const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) {
+ child_process_sandbox_support::getRenderStyleForStrike(family, sizeAndStyle,
+ out);
+}
+
+#endif
+
+PpapiWebKitClientImpl::PpapiWebKitClientImpl() {
+}
+
+PpapiWebKitClientImpl::~PpapiWebKitClientImpl() {
+}
+
+WebKit::WebClipboard* PpapiWebKitClientImpl::clipboard() {
+ NOTREACHED();
+ return NULL;
+}
+
+WebKit::WebMimeRegistry* PpapiWebKitClientImpl::mimeRegistry() {
+ NOTREACHED();
+ return NULL;
+}
+
+WebKit::WebFileUtilities* PpapiWebKitClientImpl::fileUtilities() {
+ NOTREACHED();
+ return NULL;
+}
+
+WebKit::WebSandboxSupport* PpapiWebKitClientImpl::sandboxSupport() {
+ return sandbox_support_.get();
+}
+
+bool PpapiWebKitClientImpl::sandboxEnabled() {
+ return true; // Assume PPAPI is always sandboxed.
+}
+
+unsigned long long PpapiWebKitClientImpl::visitedLinkHash(
+ const char* canonical_url,
+ size_t length) {
+ NOTREACHED();
+ return 0;
+}
+
+bool PpapiWebKitClientImpl::isLinkVisited(unsigned long long link_hash) {
+ NOTREACHED();
+ return false;
+}
+
+WebKit::WebMessagePortChannel*
+PpapiWebKitClientImpl::createMessagePortChannel() {
+ NOTREACHED();
+ return NULL;
+}
+
+void PpapiWebKitClientImpl::setCookies(
+ const WebKit::WebURL& url,
+ const WebKit::WebURL& first_party_for_cookies,
+ const WebKit::WebString& value) {
+ NOTREACHED();
+}
+
+WebKit::WebString PpapiWebKitClientImpl::cookies(
+ const WebKit::WebURL& url,
+ const WebKit::WebURL& first_party_for_cookies) {
+ NOTREACHED();
+ return WebKit::WebString();
+}
+
+void PpapiWebKitClientImpl::prefetchHostName(const WebKit::WebString&) {
+ NOTREACHED();
+}
+
+WebKit::WebString PpapiWebKitClientImpl::defaultLocale() {
+ NOTREACHED();
+ return WebKit::WebString();
+}
+
+WebKit::WebThemeEngine* PpapiWebKitClientImpl::themeEngine() {
+ NOTREACHED();
+ return NULL;
+}
+
+WebKit::WebURLLoader* PpapiWebKitClientImpl::createURLLoader() {
+ NOTREACHED();
+ return NULL;
+}
+
+WebKit::WebSocketStreamHandle*
+ PpapiWebKitClientImpl::createSocketStreamHandle() {
+ NOTREACHED();
+ return NULL;
+}
+
+void PpapiWebKitClientImpl::getPluginList(bool refresh,
+ WebKit::WebPluginListBuilder* builder) {
+ NOTREACHED();
+}
+
+WebKit::WebData PpapiWebKitClientImpl::loadResource(const char* name) {
+ NOTREACHED();
+ return WebKit::WebData();
+}
+
+WebKit::WebStorageNamespace*
+PpapiWebKitClientImpl::createLocalStorageNamespace(
+ const WebKit::WebString& path, unsigned quota) {
+ NOTREACHED();
+ return 0;
+}
+
+void PpapiWebKitClientImpl::dispatchStorageEvent(
+ const WebKit::WebString& key, const WebKit::WebString& old_value,
+ const WebKit::WebString& new_value, const WebKit::WebString& origin,
+ const WebKit::WebURL& url, bool is_local_storage) {
+ NOTREACHED();
+}
+
+WebKit::WebSharedWorkerRepository*
+PpapiWebKitClientImpl::sharedWorkerRepository() {
+ NOTREACHED();
+ return NULL;
+}
+
+int PpapiWebKitClientImpl::databaseDeleteFile(
+ const WebKit::WebString& vfs_file_name, bool sync_dir) {
+ NOTREACHED();
+ return 0;
+}
+
+void PpapiWebKitClientImpl::createIDBKeysFromSerializedValuesAndKeyPath(
+ const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
+ const WebKit::WebString& keyPath,
+ WebKit::WebVector<WebKit::WebIDBKey>& keys) {
+ NOTREACHED();
+}
+
+WebKit::WebSerializedScriptValue
+PpapiWebKitClientImpl::injectIDBKeyIntoSerializedValue(
+ const WebKit::WebIDBKey& key,
+ const WebKit::WebSerializedScriptValue& value,
+ const WebKit::WebString& keyPath) {
+ NOTREACHED();
+ return WebKit::WebSerializedScriptValue();
+}
diff --git a/content/ppapi_plugin/ppapi_webkitclient_impl.h b/content/ppapi_plugin/ppapi_webkitclient_impl.h
new file mode 100644
index 0000000..5c3b90e
--- /dev/null
+++ b/content/ppapi_plugin/ppapi_webkitclient_impl.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2011 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_PPAPI_PLUGIN_PPAPI_WEBKITCLIENT_IMPL_H_
+#define CONTENT_PPAPI_PLUGIN_PPAPI_WEBKITCLIENT_IMPL_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "webkit/glue/webkitclient_impl.h"
+
+class PpapiWebKitClientImpl : public webkit_glue::WebKitClientImpl {
+ public:
+ PpapiWebKitClientImpl();
+ virtual ~PpapiWebKitClientImpl();
+
+ // WebKitClient methods:
+ virtual WebKit::WebClipboard* clipboard();
+ virtual WebKit::WebMimeRegistry* mimeRegistry();
+ virtual WebKit::WebFileUtilities* fileUtilities();
+ virtual WebKit::WebSandboxSupport* sandboxSupport();
+ virtual bool sandboxEnabled();
+ virtual unsigned long long visitedLinkHash(const char* canonicalURL,
+ size_t length);
+ virtual bool isLinkVisited(unsigned long long linkHash);
+ virtual WebKit::WebMessagePortChannel* createMessagePortChannel();
+ virtual void setCookies(const WebKit::WebURL& url,
+ const WebKit::WebURL& first_party_for_cookies,
+ const WebKit::WebString& value);
+ virtual WebKit::WebString cookies(
+ const WebKit::WebURL& url,
+ const WebKit::WebURL& first_party_for_cookies);
+ virtual void prefetchHostName(const WebKit::WebString&);
+ virtual WebKit::WebString defaultLocale();
+ virtual WebKit::WebThemeEngine* themeEngine();
+ virtual WebKit::WebURLLoader* createURLLoader();
+ virtual WebKit::WebSocketStreamHandle* createSocketStreamHandle();
+ virtual void getPluginList(bool refresh, WebKit::WebPluginListBuilder*);
+ virtual WebKit::WebData loadResource(const char* name);
+ virtual WebKit::WebStorageNamespace* createLocalStorageNamespace(
+ const WebKit::WebString& path, unsigned quota);
+ virtual void dispatchStorageEvent(const WebKit::WebString& key,
+ const WebKit::WebString& oldValue, const WebKit::WebString& newValue,
+ const WebKit::WebString& origin, const WebKit::WebURL& url,
+ bool isLocalStorage);
+ virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository();
+ virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
+ bool sync_dir);
+ virtual void createIDBKeysFromSerializedValuesAndKeyPath(
+ const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
+ const WebKit::WebString& keyPath,
+ WebKit::WebVector<WebKit::WebIDBKey>& keys);
+ virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue(
+ const WebKit::WebIDBKey& key,
+ const WebKit::WebSerializedScriptValue& value,
+ const WebKit::WebString& keyPath);
+
+ private:
+ class SandboxSupport;
+ scoped_ptr<SandboxSupport> sandbox_support_;
+
+ DISALLOW_COPY_AND_ASSIGN(PpapiWebKitClientImpl);
+};
+
+#endif // CONTENT_PPAPI_PLUGIN_PPAPI_WEBKITCLIENT_IMPL_H_
diff --git a/content/renderer/render_process_impl.cc b/content/renderer/render_process_impl.cc
index c03878e..1ded505 100644
--- a/content/renderer/render_process_impl.cc
+++ b/content/renderer/render_process_impl.cc
@@ -37,10 +37,6 @@
#include "base/mac/mac_util.h"
#endif
-#if defined(OS_LINUX)
-#include "content/renderer/renderer_sandbox_support_linux.h"
-#endif
-
RenderProcessImpl::RenderProcessImpl()
: ALLOW_THIS_IN_INITIALIZER_LIST(shared_mem_cache_cleaner_(
base::TimeDelta::FromSeconds(5),
diff --git a/content/renderer/renderer_glue.cc b/content/renderer/renderer_glue.cc
index 5ad03fd..8c78846 100644
--- a/content/renderer/renderer_glue.cc
+++ b/content/renderer/renderer_glue.cc
@@ -35,7 +35,7 @@
#include "webkit/glue/websocketstreamhandle_bridge.h"
#if defined(OS_LINUX)
-#include "content/renderer/renderer_sandbox_support_linux.h"
+#include "content/common/child_process_sandbox_support_linux.h"
#endif
// This definition of WriteBitmapFromPixels uses shared memory to communicate
@@ -262,13 +262,13 @@ void EnableSpdy(bool enable) {
#if defined(OS_LINUX)
int MatchFontWithFallback(const std::string& face, bool bold,
bool italic, int charset) {
- return renderer_sandbox_support::MatchFontWithFallback(
+ return child_process_sandbox_support::MatchFontWithFallback(
face, bold, italic, charset);
}
bool GetFontTable(int fd, uint32_t table, uint8_t* output,
size_t* output_length) {
- return renderer_sandbox_support::GetFontTable(
+ return child_process_sandbox_support::GetFontTable(
fd, table, output, output_length);
}
#endif
diff --git a/content/renderer/renderer_webkitclient_impl.cc b/content/renderer/renderer_webkitclient_impl.cc
index 99746c9..c68cc58 100644
--- a/content/renderer/renderer_webkitclient_impl.cc
+++ b/content/renderer/renderer_webkitclient_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -61,7 +61,7 @@
#include <map>
#include "base/synchronization/lock.h"
-#include "content/renderer/renderer_sandbox_support_linux.h"
+#include "content/common/child_process_sandbox_support_linux.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebSandboxSupport.h"
#endif
@@ -128,7 +128,7 @@ class RendererWebKitClientImpl::SandboxSupport
// here. The key in this map is an array of 16-bit UTF16 values from WebKit.
// The value is a string containing the correct font family.
base::Lock unicode_font_families_mutex_;
- std::map<std::string, std::string> unicode_font_families_;
+ std::map<string16, std::string> unicode_font_families_;
#endif
};
@@ -440,24 +440,25 @@ WebString RendererWebKitClientImpl::SandboxSupport::getFontFamilyForCharacters(
size_t num_characters,
const char* preferred_locale) {
base::AutoLock lock(unicode_font_families_mutex_);
- const std::string key(reinterpret_cast<const char*>(characters),
- num_characters * sizeof(characters[0]));
- const std::map<std::string, std::string>::const_iterator iter =
+ const string16 key(characters, num_characters);
+ const std::map<string16, std::string>::const_iterator iter =
unicode_font_families_.find(key);
if (iter != unicode_font_families_.end())
return WebString::fromUTF8(iter->second);
const std::string family_name =
- renderer_sandbox_support::getFontFamilyForCharacters(characters,
- num_characters,
- preferred_locale);
+ child_process_sandbox_support::getFontFamilyForCharacters(
+ characters,
+ num_characters,
+ preferred_locale);
unicode_font_families_.insert(make_pair(key, family_name));
return WebString::fromUTF8(family_name);
}
void RendererWebKitClientImpl::SandboxSupport::getRenderStyleForStrike(
const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) {
- renderer_sandbox_support::getRenderStyleForStrike(family, sizeAndStyle, out);
+ child_process_sandbox_support::getRenderStyleForStrike(family, sizeAndStyle,
+ out);
}
#elif defined(OS_MACOSX)