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/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 using WebKit::WebPeerConnection00Handler; | 94 using WebKit::WebPeerConnection00Handler; |
95 using WebKit::WebPeerConnection00HandlerClient; | 95 using WebKit::WebPeerConnection00HandlerClient; |
96 using WebKit::WebPeerConnectionHandler; | 96 using WebKit::WebPeerConnectionHandler; |
97 using WebKit::WebPeerConnectionHandlerClient; | 97 using WebKit::WebPeerConnectionHandlerClient; |
98 using WebKit::WebSerializedScriptValue; | 98 using WebKit::WebSerializedScriptValue; |
99 using WebKit::WebStorageNamespace; | 99 using WebKit::WebStorageNamespace; |
100 using WebKit::WebString; | 100 using WebKit::WebString; |
101 using WebKit::WebURL; | 101 using WebKit::WebURL; |
102 using WebKit::WebVector; | 102 using WebKit::WebVector; |
103 | 103 |
| 104 static bool g_sandbox_enabled = true; |
| 105 |
104 //------------------------------------------------------------------------------ | 106 //------------------------------------------------------------------------------ |
105 | 107 |
106 class RendererWebKitPlatformSupportImpl::MimeRegistry | 108 class RendererWebKitPlatformSupportImpl::MimeRegistry |
107 : public webkit_glue::SimpleWebMimeRegistryImpl { | 109 : public webkit_glue::SimpleWebMimeRegistryImpl { |
108 public: | 110 public: |
109 virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); | 111 virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); |
110 virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); | 112 virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); |
111 virtual WebKit::WebString preferredExtensionForMIMEType( | 113 virtual WebKit::WebString preferredExtensionForMIMEType( |
112 const WebKit::WebString&); | 114 const WebKit::WebString&); |
113 }; | 115 }; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 #endif | 159 #endif |
158 }; | 160 }; |
159 #endif // defined(OS_ANDROID) | 161 #endif // defined(OS_ANDROID) |
160 | 162 |
161 //------------------------------------------------------------------------------ | 163 //------------------------------------------------------------------------------ |
162 | 164 |
163 RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl() | 165 RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl() |
164 : clipboard_client_(new RendererClipboardClient), | 166 : clipboard_client_(new RendererClipboardClient), |
165 clipboard_(new webkit_glue::WebClipboardImpl(clipboard_client_.get())), | 167 clipboard_(new webkit_glue::WebClipboardImpl(clipboard_client_.get())), |
166 mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry), | 168 mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry), |
167 sandbox_support_(new RendererWebKitPlatformSupportImpl::SandboxSupport), | |
168 sudden_termination_disables_(0), | 169 sudden_termination_disables_(0), |
169 shared_worker_repository_(new WebSharedWorkerRepositoryImpl) { | 170 shared_worker_repository_(new WebSharedWorkerRepositoryImpl) { |
| 171 if (g_sandbox_enabled) { |
| 172 sandbox_support_.reset( |
| 173 new RendererWebKitPlatformSupportImpl::SandboxSupport); |
| 174 } else { |
| 175 DVLOG(1) << "Disabling sandbox support for testing."; |
| 176 } |
170 } | 177 } |
171 | 178 |
172 RendererWebKitPlatformSupportImpl::~RendererWebKitPlatformSupportImpl() { | 179 RendererWebKitPlatformSupportImpl::~RendererWebKitPlatformSupportImpl() { |
173 } | 180 } |
174 | 181 |
175 //------------------------------------------------------------------------------ | 182 //------------------------------------------------------------------------------ |
176 | 183 |
177 namespace { | 184 namespace { |
178 | 185 |
179 bool SendSyncMessageFromAnyThreadInternal(IPC::SyncMessage* msg) { | 186 bool SendSyncMessageFromAnyThreadInternal(IPC::SyncMessage* msg) { |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 WebMediaStreamCenter* | 718 WebMediaStreamCenter* |
712 RendererWebKitPlatformSupportImpl::createMediaStreamCenter( | 719 RendererWebKitPlatformSupportImpl::createMediaStreamCenter( |
713 WebMediaStreamCenterClient* client) { | 720 WebMediaStreamCenterClient* client) { |
714 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 721 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
715 DCHECK(render_thread); | 722 DCHECK(render_thread); |
716 if (!render_thread) | 723 if (!render_thread) |
717 return NULL; | 724 return NULL; |
718 return render_thread->CreateMediaStreamCenter(client); | 725 return render_thread->CreateMediaStreamCenter(client); |
719 } | 726 } |
720 | 727 |
| 728 // static |
| 729 bool RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting( |
| 730 bool enable) { |
| 731 bool was_enabled = g_sandbox_enabled; |
| 732 g_sandbox_enabled = enable; |
| 733 return was_enabled; |
| 734 } |
| 735 |
721 GpuChannelHostFactory* | 736 GpuChannelHostFactory* |
722 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 737 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
723 return RenderThreadImpl::current(); | 738 return RenderThreadImpl::current(); |
724 } | 739 } |
OLD | NEW |