OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 5 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #include "url/gurl.h" | 77 #include "url/gurl.h" |
78 #include "webkit/common/gpu/context_provider_web_context.h" | 78 #include "webkit/common/gpu/context_provider_web_context.h" |
79 #include "webkit/common/quota/quota_types.h" | 79 #include "webkit/common/quota/quota_types.h" |
80 | 80 |
81 #if defined(OS_ANDROID) | 81 #if defined(OS_ANDROID) |
82 #include "content/renderer/android/synchronous_compositor_factory.h" | 82 #include "content/renderer/android/synchronous_compositor_factory.h" |
83 #include "content/renderer/media/android/audio_decoder_android.h" | 83 #include "content/renderer/media/android/audio_decoder_android.h" |
84 #endif | 84 #endif |
85 | 85 |
86 #if defined(OS_MACOSX) | 86 #if defined(OS_MACOSX) |
87 #include "base/mac/mac_util.h" | |
88 #include "content/common/mac/font_descriptor.h" | 87 #include "content/common/mac/font_descriptor.h" |
89 #include "content/common/mac/font_loader.h" | 88 #include "content/common/mac/font_loader.h" |
90 #include "content/renderer/webscrollbarbehavior_impl_mac.h" | 89 #include "content/renderer/webscrollbarbehavior_impl_mac.h" |
91 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" | 90 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" |
92 #endif | 91 #endif |
93 | 92 |
94 #if defined(OS_POSIX) | 93 #if defined(OS_POSIX) |
95 #include "base/file_descriptor_posix.h" | 94 #include "base/file_descriptor_posix.h" |
96 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 95 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
97 #include <map> | 96 #include <map> |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 public: | 195 public: |
197 virtual ~SandboxSupport() {} | 196 virtual ~SandboxSupport() {} |
198 | 197 |
199 #if defined(OS_WIN) | 198 #if defined(OS_WIN) |
200 virtual bool ensureFontLoaded(HFONT); | 199 virtual bool ensureFontLoaded(HFONT); |
201 #elif defined(OS_MACOSX) | 200 #elif defined(OS_MACOSX) |
202 virtual bool loadFont( | 201 virtual bool loadFont( |
203 NSFont* src_font, | 202 NSFont* src_font, |
204 CGFontRef* container, | 203 CGFontRef* container, |
205 uint32* font_id); | 204 uint32* font_id); |
206 virtual CGColorSpaceRef displayColorSpace(); | |
207 #elif defined(OS_POSIX) | 205 #elif defined(OS_POSIX) |
208 virtual void getFallbackFontForCharacter( | 206 virtual void getFallbackFontForCharacter( |
209 blink::WebUChar32 character, | 207 blink::WebUChar32 character, |
210 const char* preferred_locale, | 208 const char* preferred_locale, |
211 blink::WebFallbackFont* fallbackFont); | 209 blink::WebFallbackFont* fallbackFont); |
212 virtual void getRenderStyleForStrike( | 210 virtual void getRenderStyleForStrike( |
213 const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out); | 211 const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out); |
214 | 212 |
215 private: | 213 private: |
216 // WebKit likes to ask us for the correct font family to use for a set of | 214 // WebKit likes to ask us for the correct font family to use for a set of |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 return false; | 566 return false; |
569 } | 567 } |
570 | 568 |
571 // TODO(jeremy): Need to call back into WebKit to make sure that the font | 569 // TODO(jeremy): Need to call back into WebKit to make sure that the font |
572 // isn't already activated, based on the font id. If it's already | 570 // isn't already activated, based on the font id. If it's already |
573 // activated, don't reactivate it here - crbug.com/72727 . | 571 // activated, don't reactivate it here - crbug.com/72727 . |
574 | 572 |
575 return FontLoader::CGFontRefFromBuffer(font_data, font_data_size, out); | 573 return FontLoader::CGFontRefFromBuffer(font_data, font_data_size, out); |
576 } | 574 } |
577 | 575 |
578 CGColorSpaceRef | |
579 RendererWebKitPlatformSupportImpl::SandboxSupport::displayColorSpace() { | |
580 return base::mac::GetSystemColorSpace(); | |
581 } | |
582 | |
583 #elif defined(OS_ANDROID) | 576 #elif defined(OS_ANDROID) |
584 | 577 |
585 // WebKit doesn't use WebSandboxSupport on android so we don't need to | 578 // WebKit doesn't use WebSandboxSupport on android so we don't need to |
586 // implement anything here. This is cleaner to support than excluding the | 579 // implement anything here. This is cleaner to support than excluding the |
587 // whole class for android. | 580 // whole class for android. |
588 | 581 |
589 #elif defined(OS_POSIX) | 582 #elif defined(OS_POSIX) |
590 | 583 |
591 void | 584 void |
592 RendererWebKitPlatformSupportImpl::SandboxSupport::getFallbackFontForCharacter( | 585 RendererWebKitPlatformSupportImpl::SandboxSupport::getFallbackFontForCharacter( |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1182 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1190 const blink::WebBatteryStatus& status) { | 1183 const blink::WebBatteryStatus& status) { |
1191 PlatformEventObserverBase* observer = | 1184 PlatformEventObserverBase* observer = |
1192 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); | 1185 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); |
1193 if (!observer) | 1186 if (!observer) |
1194 return; | 1187 return; |
1195 observer->SendFakeDataForTesting((void*)&status); | 1188 observer->SendFakeDataForTesting((void*)&status); |
1196 } | 1189 } |
1197 | 1190 |
1198 } // namespace content | 1191 } // namespace content |
OLD | NEW |