summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 23:19:57 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 23:19:57 +0000
commitbcd90b701089e050a74b82f0670cf36ff72bd7d7 (patch)
tree5cdab65729fe20ef41c05aa3b92f0a1748d134d6 /content
parent6289ffbc2945eda8893b5fcf899e87539214ddc9 (diff)
downloadchromium_src-bcd90b701089e050a74b82f0670cf36ff72bd7d7.zip
chromium_src-bcd90b701089e050a74b82f0670cf36ff72bd7d7.tar.gz
chromium_src-bcd90b701089e050a74b82f0670cf36ff72bd7d7.tar.bz2
Create a public header with the child_process_sandbox_support_linux functions that are used in chrome. Also move everything to the content namespace, now that we have one. This gets rid of the last content/common includes from chrome/renderer and so I've tightened up the DEPS.
Also get rid of the webkit_glue versions of the font functions since they weren't used anymore. BUG=98716 Review URL: http://codereview.chromium.org/8319017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/DEPS7
-rw-r--r--content/common/child_process_sandbox_support_impl_linux.cc (renamed from content/common/child_process_sandbox_support_linux.cc)10
-rw-r--r--content/common/child_process_sandbox_support_impl_linux.h34
-rw-r--r--content/content_common.gypi5
-rw-r--r--content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc14
-rw-r--r--content/public/common/child_process_sandbox_support_linux.h (renamed from content/common/child_process_sandbox_support_linux.h)30
-rw-r--r--content/renderer/renderer_glue.cc18
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.cc14
-rw-r--r--content/test/render_view_test.cc15
-rw-r--r--content/test/render_view_test.h7
10 files changed, 76 insertions, 78 deletions
diff --git a/content/DEPS b/content/DEPS
index 91ac066..aa15b45 100644
--- a/content/DEPS
+++ b/content/DEPS
@@ -8,13 +8,6 @@ include_rules = [
# make use of it.
"+chrome/test",
- # The following directories have been refactored, so no new dependencies
- # should be added from these directories.
- "-chrome/browser/printing",
- "-chrome/browser/extensions",
- "-chrome/common/extensions",
- "-chrome/renderer/extensions",
-
# The subdirectories in content/ will manually allow their own include
# directories in content/ so we disallow all of them.
"-content",
diff --git a/content/common/child_process_sandbox_support_linux.cc b/content/common/child_process_sandbox_support_impl_linux.cc
index 92eea45..692d4ed 100644
--- a/content/common/child_process_sandbox_support_linux.cc
+++ b/content/common/child_process_sandbox_support_impl_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/common/child_process_sandbox_support_linux.h"
+#include "content/common/child_process_sandbox_support_impl_linux.h"
#include <sys/stat.h>
@@ -19,9 +19,9 @@ static int GetSandboxFD() {
return kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor;
}
-namespace child_process_sandbox_support {
+namespace content {
-std::string getFontFamilyForCharacters(const uint16_t* utf16,
+std::string GetFontFamilyForCharacters(const uint16_t* utf16,
size_t num_utf16,
const char* preferred_locale) {
Pickle request;
@@ -45,7 +45,7 @@ std::string getFontFamilyForCharacters(const uint16_t* utf16,
return family_name;
}
-void getRenderStyleForStrike(const char* family, int sizeAndStyle,
+void GetRenderStyleForStrike(const char* family, int sizeAndStyle,
WebKit::WebFontRenderStyle* out) {
Pickle request;
request.WriteInt(LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE);
@@ -185,4 +185,4 @@ bool GetFontTable(int fd, uint32_t table, uint8_t* output,
return true;
}
-} // namespace child_process_sandbox_support
+} // namespace content
diff --git a/content/common/child_process_sandbox_support_impl_linux.h b/content/common/child_process_sandbox_support_impl_linux.h
new file mode 100644
index 0000000..b26634a
--- /dev/null
+++ b/content/common/child_process_sandbox_support_impl_linux.h
@@ -0,0 +1,34 @@
+// 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_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_IMPL_LINUX_H_
+#define CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_IMPL_LINUX_H_
+#pragma once
+
+#include "content/public/common/child_process_sandbox_support_linux.h"
+
+namespace WebKit {
+struct WebFontRenderStyle;
+}
+
+namespace content {
+
+// Return a font family which provides glyphs for the Unicode code points
+// specified by |utf16|
+// utf16: a native-endian UTF16 string
+// num_utf16: the number of 16-bit words in |utf16|
+// preferred_locale: preferred locale identifier for the |utf16|
+//
+// Returns: the font family or an empty string if the request could not be
+// satisfied.
+std::string GetFontFamilyForCharacters(const uint16_t* utf16,
+ size_t num_utf16,
+ const char* preferred_locale);
+
+void GetRenderStyleForStrike(const char* family, int sizeAndStyle,
+ WebKit::WebFontRenderStyle* out);
+
+}; // namespace content
+
+#endif // CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_IMPL_LINUX_H_
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 22ad357..2534708 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -29,6 +29,7 @@
],
'sources': [
'public/common/bindings_policy.h',
+ 'public/common/child_process_sandbox_support_linux.h',
'public/common/content_switches.cc',
'public/common/content_switches.h',
'public/common/page_transition_types.cc',
@@ -49,8 +50,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_process_sandbox_support_impl_linux.cc',
+ 'common/child_process_sandbox_support_impl_linux.h',
'common/child_thread.cc',
'common/child_thread.h',
'common/child_trace_message_filter.cc',
diff --git a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc
index 82f330c..4733909 100644
--- a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc
+++ b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc
@@ -18,7 +18,7 @@
#elif defined(OS_MACOSX)
#include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebSandboxSupport.h"
#elif defined(OS_POSIX)
-#include "content/common/child_process_sandbox_support_linux.h"
+#include "content/common/child_process_sandbox_support_impl_linux.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebSandboxSupport.h"
#endif
@@ -92,19 +92,17 @@ PpapiWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters(
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);
+ const std::string family_name = content::GetFontFamilyForCharacters(
+ characters,
+ num_characters,
+ preferred_locale);
unicode_font_families_.insert(make_pair(key, family_name));
return WebString::fromUTF8(family_name);
}
void PpapiWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike(
const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) {
- child_process_sandbox_support::getRenderStyleForStrike(family, sizeAndStyle,
- out);
+ content::GetRenderStyleForStrike(family, sizeAndStyle, out);
}
#endif
diff --git a/content/common/child_process_sandbox_support_linux.h b/content/public/common/child_process_sandbox_support_linux.h
index a7537c2..c373ba4 100644
--- a/content/common/child_process_sandbox_support_linux.h
+++ b/content/public/common/child_process_sandbox_support_linux.h
@@ -2,36 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_
-#define CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_
+#ifndef CONTENT_PULIC_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_
+#define CONTENT_PULIC_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_
#pragma once
#include <stdint.h>
-
#include <string>
#include "content/common/content_export.h"
-namespace WebKit {
-struct WebFontRenderStyle;
-}
-
-namespace child_process_sandbox_support {
-
-// Return a font family which provides glyphs for the Unicode code points
-// specified by |utf16|
-// utf16: a native-endian UTF16 string
-// num_utf16: the number of 16-bit words in |utf16|
-// preferred_locale: preferred locale identifier for the |utf16|
-//
-// Returns: the font family or an empty string if the request could not be
-// satisfied.
-std::string getFontFamilyForCharacters(const uint16_t* utf16,
- size_t num_utf16,
- const char* preferred_locale);
-
-void getRenderStyleForStrike(const char* family, int sizeAndStyle,
- WebKit::WebFontRenderStyle* out);
+namespace content {
// Returns a file descriptor for a shared memory segment.
// The second argument is ignored because SHM segments are always
@@ -57,6 +37,6 @@ CONTENT_EXPORT int MatchFontWithFallback(const std::string& face, bool bold,
CONTENT_EXPORT bool GetFontTable(int fd, uint32_t table, uint8_t* output,
size_t* output_length);
-}; // namespace child_process_sandbox_support
+}; // namespace content
-#endif // CONTENT_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_
+#endif // CONTENT_PULIC_COMMON_CHILD_PROCESS_SANDBOX_SUPPORT_LINUX_H_
diff --git a/content/renderer/renderer_glue.cc b/content/renderer/renderer_glue.cc
index f873993..fb0fbfe 100644
--- a/content/renderer/renderer_glue.cc
+++ b/content/renderer/renderer_glue.cc
@@ -36,10 +36,6 @@
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/websocketstreamhandle_bridge.h"
-#if defined(OS_LINUX)
-#include "content/common/child_process_sandbox_support_linux.h"
-#endif
-
// This definition of WriteBitmapFromPixels uses shared memory to communicate
// across processes.
void ScopedClipboardWriterGlue::WriteBitmapFromPixels(const void* pixels,
@@ -205,20 +201,6 @@ WebSocketStreamHandleBridge* WebSocketStreamHandleBridge::Create(
return dispatcher->CreateBridge(handle, delegate);
}
-#if defined(OS_LINUX)
-int MatchFontWithFallback(const std::string& face, bool bold,
- bool italic, int charset) {
- 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 child_process_sandbox_support::GetFontTable(
- fd, table, output, output_length);
-}
-#endif
-
string16 GetLocalizedString(int message_id) {
return content::GetContentClient()->GetLocalizedString(message_id);
}
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 6ed042b..0d31ac5 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -61,7 +61,7 @@
#include <map>
#include "base/synchronization/lock.h"
-#include "content/common/child_process_sandbox_support_linux.h"
+#include "content/common/child_process_sandbox_support_impl_linux.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebSandboxSupport.h"
#endif
@@ -492,11 +492,10 @@ RendererWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters(
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);
+ const std::string family_name = content::GetFontFamilyForCharacters(
+ characters,
+ num_characters,
+ preferred_locale);
unicode_font_families_.insert(make_pair(key, family_name));
return WebString::fromUTF8(family_name);
}
@@ -504,8 +503,7 @@ RendererWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters(
void
RendererWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike(
const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) {
- child_process_sandbox_support::getRenderStyleForStrike(family, sizeAndStyle,
- out);
+ content::GetRenderStyleForStrike(family, sizeAndStyle, out);
}
#endif
diff --git a/content/test/render_view_test.cc b/content/test/render_view_test.cc
index 661974b..e47dcaf 100644
--- a/content/test/render_view_test.cc
+++ b/content/test/render_view_test.cc
@@ -309,14 +309,21 @@ void RenderViewTest::ClearHistory() {
impl->history_page_ids_.clear();
}
-bool RenderViewTest::OnMessageReceived(const IPC::Message& msg) {
+void RenderViewTest::Reload(const GURL& url) {
+ ViewMsg_Navigate_Params params;
+ params.url = url;
+ params.navigation_type = ViewMsg_Navigate_Type::RELOAD;
RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
- return impl->OnMessageReceived(msg);
+ impl->OnNavigate(params);
+}
+
+uint32 RenderViewTest::GetNavigationIPCType() {
+ return ViewHostMsg_FrameNavigate::ID;
}
-void RenderViewTest::OnNavigate(const ViewMsg_Navigate_Params& params) {
+bool RenderViewTest::OnMessageReceived(const IPC::Message& msg) {
RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
- impl->OnNavigate(params);
+ return impl->OnMessageReceived(msg);
}
void RenderViewTest::DidNavigateWithinPage(WebKit::WebFrame* frame,
diff --git a/content/test/render_view_test.h b/content/test/render_view_test.h
index 7f6ac85..1d3a6a5 100644
--- a/content/test/render_view_test.h
+++ b/content/test/render_view_test.h
@@ -95,9 +95,14 @@ class RenderViewTest : public testing::Test {
// Clears anything associated with the browsing history.
void ClearHistory();
+ // Simulates a navigation with a type of reload to the given url.
+ void Reload(const GURL& url);
+
+ // Returns the IPC message ID of the navigation message.
+ uint32 GetNavigationIPCType();
+
// These are all methods from RenderViewImpl that we expose to testing code.
bool OnMessageReceived(const IPC::Message& msg);
- void OnNavigate(const ViewMsg_Navigate_Params& params);
void DidNavigateWithinPage(WebKit::WebFrame* frame, bool is_new_navigation);
void SendContentStateImmediately();
WebKit::WebWidget* GetWebWidget();