Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/renderer/renderer_webkitclient_impl.cc

Issue 132007: Linux: plumb fontconfig call out to the sandbox host. (Closed)
Patch Set: ... Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/renderer/renderer_webkitclient_impl.h ('k') | webkit/api/public/gtk/WebFontInfo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "chrome/renderer/renderer_webkitclient_impl.h" 5 #include "chrome/renderer/renderer_webkitclient_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/plugin/npobject_util.h" 10 #include "chrome/plugin/npobject_util.h"
11 #include "chrome/renderer/net/render_dns_master.h" 11 #include "chrome/renderer/net/render_dns_master.h"
12 #include "chrome/renderer/render_thread.h" 12 #include "chrome/renderer/render_thread.h"
13 #include "chrome/renderer/visitedlink_slave.h" 13 #include "chrome/renderer/visitedlink_slave.h"
14 #include "webkit/api/public/WebString.h" 14 #include "webkit/api/public/WebString.h"
15 #include "webkit/api/public/WebURL.h" 15 #include "webkit/api/public/WebURL.h"
16 #include "webkit/glue/glue_util.h" 16 #include "webkit/glue/glue_util.h"
17 #include "webkit/glue/webkit_glue.h" 17 #include "webkit/glue/webkit_glue.h"
18 18
19 #if defined(OS_LINUX)
20 #include "chrome/renderer/renderer_sandbox_support_linux.h"
21 #endif
22
19 using WebKit::WebString; 23 using WebKit::WebString;
20 using WebKit::WebURL; 24 using WebKit::WebURL;
21 25
22 //------------------------------------------------------------------------------ 26 //------------------------------------------------------------------------------
23 27
24 WebKit::WebClipboard* RendererWebKitClientImpl::clipboard() { 28 WebKit::WebClipboard* RendererWebKitClientImpl::clipboard() {
25 return &clipboard_; 29 return &clipboard_;
26 } 30 }
27 31
28 WebKit::WebMimeRegistry* RendererWebKitClientImpl::mimeRegistry() { 32 WebKit::WebMimeRegistry* RendererWebKitClientImpl::mimeRegistry() {
29 return &mime_registry_; 33 return &mime_registry_;
30 } 34 }
31 35
32 WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() { 36 WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() {
33 #if defined(OS_WIN) 37 #if defined(OS_WIN) || defined(OS_LINUX)
34 return &sandbox_support_; 38 return &sandbox_support_;
35 #else 39 #else
36 return NULL; 40 return NULL;
37 #endif 41 #endif
38 } 42 }
39 43
40 unsigned long long RendererWebKitClientImpl::visitedLinkHash( 44 unsigned long long RendererWebKitClientImpl::visitedLinkHash(
41 const char* canonical_url, 45 const char* canonical_url,
42 size_t length) { 46 size_t length) {
43 return RenderThread::current()->visited_link_slave()->ComputeURLFingerprint( 47 return RenderThread::current()->visited_link_slave()->ComputeURLFingerprint(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 //------------------------------------------------------------------------------ 136 //------------------------------------------------------------------------------
133 137
134 #if defined(OS_WIN) 138 #if defined(OS_WIN)
135 139
136 bool RendererWebKitClientImpl::SandboxSupport::ensureFontLoaded(HFONT font) { 140 bool RendererWebKitClientImpl::SandboxSupport::ensureFontLoaded(HFONT font) {
137 LOGFONT logfont; 141 LOGFONT logfont;
138 GetObject(font, sizeof(LOGFONT), &logfont); 142 GetObject(font, sizeof(LOGFONT), &logfont);
139 return RenderThread::current()->Send(new ViewHostMsg_LoadFont(logfont)); 143 return RenderThread::current()->Send(new ViewHostMsg_LoadFont(logfont));
140 } 144 }
141 145
146 #elif defined(OS_LINUX)
147
148 WebString RendererWebKitClientImpl::SandboxSupport::getFontFamilyForCharacters(
149 const WebKit::WebUChar* characters, size_t num_characters) {
150 AutoLock lock(unicode_font_families_mutex_);
151 const std::string key(reinterpret_cast<const char*>(characters),
152 num_characters * sizeof(characters[0]));
153 const std::map<std::string, std::string>::const_iterator iter =
154 unicode_font_families_.find(key);
155 if (iter != unicode_font_families_.end())
156 return WebString::fromUTF8(iter->second.data(), iter->second.size());
157
158 const std::string family_name =
159 renderer_sandbox_support::getFontFamilyForCharacters(characters,
160 num_characters);
161 unicode_font_families_.insert(make_pair(key, family_name));
162 return WebString::fromUTF8(family_name);
163 }
164
142 #endif 165 #endif
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_webkitclient_impl.h ('k') | webkit/api/public/gtk/WebFontInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698