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

Side by Side Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 549213004: [Mac] Implement a new WebSandboxSupport method to get the display's color space. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
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
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"
87 #include "content/common/mac/font_descriptor.h" 88 #include "content/common/mac/font_descriptor.h"
88 #include "content/common/mac/font_loader.h" 89 #include "content/common/mac/font_loader.h"
89 #include "content/renderer/webscrollbarbehavior_impl_mac.h" 90 #include "content/renderer/webscrollbarbehavior_impl_mac.h"
90 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" 91 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h"
91 #endif 92 #endif
92 93
93 #if defined(OS_POSIX) 94 #if defined(OS_POSIX)
94 #include "base/file_descriptor_posix.h" 95 #include "base/file_descriptor_posix.h"
95 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) 96 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
96 #include <map> 97 #include <map>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 public: 196 public:
196 virtual ~SandboxSupport() {} 197 virtual ~SandboxSupport() {}
197 198
198 #if defined(OS_WIN) 199 #if defined(OS_WIN)
199 virtual bool ensureFontLoaded(HFONT); 200 virtual bool ensureFontLoaded(HFONT);
200 #elif defined(OS_MACOSX) 201 #elif defined(OS_MACOSX)
201 virtual bool loadFont( 202 virtual bool loadFont(
202 NSFont* src_font, 203 NSFont* src_font,
203 CGFontRef* container, 204 CGFontRef* container,
204 uint32* font_id); 205 uint32* font_id);
206 virtual CGColorSpaceRef displayColorSpace();
205 #elif defined(OS_POSIX) 207 #elif defined(OS_POSIX)
206 virtual void getFallbackFontForCharacter( 208 virtual void getFallbackFontForCharacter(
207 blink::WebUChar32 character, 209 blink::WebUChar32 character,
208 const char* preferred_locale, 210 const char* preferred_locale,
209 blink::WebFallbackFont* fallbackFont); 211 blink::WebFallbackFont* fallbackFont);
210 virtual void getRenderStyleForStrike( 212 virtual void getRenderStyleForStrike(
211 const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out); 213 const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out);
212 214
213 private: 215 private:
214 // WebKit likes to ask us for the correct font family to use for a set of 216 // 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
566 return false; 568 return false;
567 } 569 }
568 570
569 // TODO(jeremy): Need to call back into WebKit to make sure that the font 571 // TODO(jeremy): Need to call back into WebKit to make sure that the font
570 // isn't already activated, based on the font id. If it's already 572 // isn't already activated, based on the font id. If it's already
571 // activated, don't reactivate it here - crbug.com/72727 . 573 // activated, don't reactivate it here - crbug.com/72727 .
572 574
573 return FontLoader::CGFontRefFromBuffer(font_data, font_data_size, out); 575 return FontLoader::CGFontRefFromBuffer(font_data, font_data_size, out);
574 } 576 }
575 577
578 CGColorSpaceRef
579 RendererWebKitPlatformSupportImpl::SandboxSupport::displayColorSpace() {
580 return base::mac::GetSystemColorSpace();
Noel Gordon 2014/09/10 07:35:37 This could be called on an arbitrary thread, such
Noel Gordon 2014/09/10 07:52:50 And it seems we're not; the other code review ht
Robert Sesek 2014/09/10 14:34:12 That has nothing to do with thread safety. There's
581 }
582
576 #elif defined(OS_ANDROID) 583 #elif defined(OS_ANDROID)
577 584
578 // WebKit doesn't use WebSandboxSupport on android so we don't need to 585 // WebKit doesn't use WebSandboxSupport on android so we don't need to
579 // implement anything here. This is cleaner to support than excluding the 586 // implement anything here. This is cleaner to support than excluding the
580 // whole class for android. 587 // whole class for android.
581 588
582 #elif defined(OS_POSIX) 589 #elif defined(OS_POSIX)
583 590
584 void 591 void
585 RendererWebKitPlatformSupportImpl::SandboxSupport::getFallbackFontForCharacter( 592 RendererWebKitPlatformSupportImpl::SandboxSupport::getFallbackFontForCharacter(
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 challenge.utf8(), 834 challenge.utf8(),
828 GURL(url), 835 GURL(url),
829 &signed_public_key)); 836 &signed_public_key));
830 return WebString::fromUTF8(signed_public_key); 837 return WebString::fromUTF8(signed_public_key);
831 } 838 }
832 839
833 //------------------------------------------------------------------------------ 840 //------------------------------------------------------------------------------
834 841
835 void RendererWebKitPlatformSupportImpl::screenColorProfile( 842 void RendererWebKitPlatformSupportImpl::screenColorProfile(
836 WebVector<char>* to_profile) { 843 WebVector<char>* to_profile) {
837 #if defined(OS_WIN) 844 #if defined(OS_WIN)
Noel Gordon 2014/09/10 07:35:37 Wonder what's going on here. See the comment at l
Robert Sesek 2014/09/10 14:34:12 Sorry, I didn't see this method. I'll see if this
838 // On Windows screen color profile is only available in the browser. 845 // On Windows screen color profile is only available in the browser.
839 std::vector<char> profile; 846 std::vector<char> profile;
840 // This Send() can be called from any impl-side thread. Use a thread 847 // This Send() can be called from any impl-side thread. Use a thread
841 // safe send to avoid crashing trying to access RenderThread::Get(), 848 // safe send to avoid crashing trying to access RenderThread::Get(),
842 // which is not accessible from arbitrary threads. 849 // which is not accessible from arbitrary threads.
843 thread_safe_sender_->Send( 850 thread_safe_sender_->Send(
844 new ViewHostMsg_GetMonitorColorProfile(&profile)); 851 new ViewHostMsg_GetMonitorColorProfile(&profile));
845 *to_profile = profile; 852 *to_profile = profile;
846 #else 853 #else
847 // On other platforms, the primary monitor color profile can be read 854 // On other platforms, the primary monitor color profile can be read
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( 1189 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting(
1183 const blink::WebBatteryStatus& status) { 1190 const blink::WebBatteryStatus& status) {
1184 PlatformEventObserverBase* observer = 1191 PlatformEventObserverBase* observer =
1185 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); 1192 platform_event_observers_.Lookup(blink::WebPlatformEventBattery);
1186 if (!observer) 1193 if (!observer)
1187 return; 1194 return;
1188 observer->SendFakeDataForTesting((void*)&status); 1195 observer->SendFakeDataForTesting((void*)&status);
1189 } 1196 }
1190 1197
1191 } // namespace content 1198 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698