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 "chrome/renderer/chrome_render_process_observer.h" | 5 #include "chrome/renderer/chrome_render_process_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/common/net/net_resource_provider.h" | 21 #include "chrome/common/net/net_resource_provider.h" |
22 #include "chrome/common/render_messages.h" | 22 #include "chrome/common/render_messages.h" |
23 #include "chrome/renderer/chrome_content_renderer_client.h" | 23 #include "chrome/renderer/chrome_content_renderer_client.h" |
24 #include "chrome/renderer/content_settings_observer.h" | 24 #include "chrome/renderer/content_settings_observer.h" |
25 #include "chrome/renderer/security_filter_peer.h" | 25 #include "chrome/renderer/security_filter_peer.h" |
26 #include "content/public/common/resource_dispatcher_delegate.h" | 26 #include "content/public/common/resource_dispatcher_delegate.h" |
27 #include "content/public/renderer/render_thread.h" | 27 #include "content/public/renderer/render_thread.h" |
28 #include "content/public/renderer/render_view_visitor.h" | 28 #include "content/public/renderer/render_view_visitor.h" |
29 #include "content/public/renderer/render_view.h" | 29 #include "content/public/renderer/render_view.h" |
30 #include "crypto/nss_util.h" | 30 #include "crypto/nss_util.h" |
31 #include "media/base/media.h" | |
32 #include "media/base/media_switches.h" | 31 #include "media/base/media_switches.h" |
33 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
34 #include "net/base/net_module.h" | 33 #include "net/base/net_module.h" |
35 #include "third_party/sqlite/sqlite3.h" | 34 #include "third_party/sqlite/sqlite3.h" |
36 #include "third_party/tcmalloc/chromium/src/google/heap-profiler.h" | 35 #include "third_party/tcmalloc/chromium/src/google/heap-profiler.h" |
37 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" | 36 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCrossOriginPreflig
htResultCache.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCrossOriginPreflig
htResultCache.h" |
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFontCache.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFontCache.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 crypto::DisableNSSForkCheck(); | 215 crypto::DisableNSSForkCheck(); |
217 crypto::ForceNSSNoDBInit(); | 216 crypto::ForceNSSNoDBInit(); |
218 crypto::EnsureNSSInit(); | 217 crypto::EnsureNSSInit(); |
219 } | 218 } |
220 #elif defined(OS_WIN) | 219 #elif defined(OS_WIN) |
221 // crypt32.dll is used to decode X509 certificates for Chromoting. | 220 // crypt32.dll is used to decode X509 certificates for Chromoting. |
222 // Only load this library when the feature is enabled. | 221 // Only load this library when the feature is enabled. |
223 std::string error; | 222 std::string error; |
224 base::LoadNativeLibrary(FilePath(L"crypt32.dll"), &error); | 223 base::LoadNativeLibrary(FilePath(L"crypt32.dll"), &error); |
225 #endif | 224 #endif |
226 | |
227 // Note that under Linux, the media library will normally already have | |
228 // been initialized by the Zygote before this instance became a Renderer. | |
229 FilePath media_path; | |
230 PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path); | |
231 if (!media_path.empty()) | |
232 media::InitializeMediaLibrary(media_path); | |
233 } | 225 } |
234 | 226 |
235 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() { | 227 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() { |
236 } | 228 } |
237 | 229 |
238 bool ChromeRenderProcessObserver::OnControlMessageReceived( | 230 bool ChromeRenderProcessObserver::OnControlMessageReceived( |
239 const IPC::Message& message) { | 231 const IPC::Message& message) { |
240 bool handled = true; | 232 bool handled = true; |
241 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) | 233 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) |
242 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, | 234 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, |
(...skipping 13 matching lines...) Expand all Loading... |
256 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats, | 248 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats, |
257 OnGetCacheResourceStats) | 249 OnGetCacheResourceStats) |
258 IPC_MESSAGE_HANDLER(ChromeViewMsg_PurgeMemory, OnPurgeMemory) | 250 IPC_MESSAGE_HANDLER(ChromeViewMsg_PurgeMemory, OnPurgeMemory) |
259 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, | 251 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, |
260 OnSetContentSettingRules) | 252 OnSetContentSettingRules) |
261 IPC_MESSAGE_UNHANDLED(handled = false) | 253 IPC_MESSAGE_UNHANDLED(handled = false) |
262 IPC_END_MESSAGE_MAP() | 254 IPC_END_MESSAGE_MAP() |
263 return handled; | 255 return handled; |
264 } | 256 } |
265 | 257 |
266 void ChromeRenderProcessObserver::WebKitInitialized() { | |
267 WebRuntimeFeatures::enableMediaPlayer(media::IsMediaLibraryInitialized()); | |
268 } | |
269 | |
270 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( | 258 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( |
271 bool is_incognito_process) { | 259 bool is_incognito_process) { |
272 is_incognito_process_ = is_incognito_process; | 260 is_incognito_process_ = is_incognito_process; |
273 } | 261 } |
274 | 262 |
275 void ChromeRenderProcessObserver::OnSetContentSettingRules( | 263 void ChromeRenderProcessObserver::OnSetContentSettingRules( |
276 const RendererContentSettingRules& rules) { | 264 const RendererContentSettingRules& rules) { |
277 content_setting_rules_ = rules; | 265 content_setting_rules_ = rules; |
278 } | 266 } |
279 | 267 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 if (clear_cache_pending_) { | 374 if (clear_cache_pending_) { |
387 clear_cache_pending_ = false; | 375 clear_cache_pending_ = false; |
388 WebCache::clear(); | 376 WebCache::clear(); |
389 } | 377 } |
390 } | 378 } |
391 | 379 |
392 const RendererContentSettingRules* | 380 const RendererContentSettingRules* |
393 ChromeRenderProcessObserver::content_setting_rules() const { | 381 ChromeRenderProcessObserver::content_setting_rules() const { |
394 return &content_setting_rules_; | 382 return &content_setting_rules_; |
395 } | 383 } |
OLD | NEW |