| 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 <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/allocator/allocator_extension.h" | 10 #include "base/allocator/allocator_extension.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/metrics/statistics_recorder.h" | 18 #include "base/metrics/statistics_recorder.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/thread_task_runner_handle.h" | 22 #include "base/thread_task_runner_handle.h" |
| 23 #include "base/threading/platform_thread.h" | 23 #include "base/threading/platform_thread.h" |
| 24 #include "chrome/common/child_process_logging.h" | 24 #include "chrome/common/child_process_logging.h" |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/media/media_resource_provider.h" |
| 27 #include "chrome/common/net/net_resource_provider.h" | 28 #include "chrome/common/net/net_resource_provider.h" |
| 28 #include "chrome/common/render_messages.h" | 29 #include "chrome/common/render_messages.h" |
| 29 #include "chrome/common/resource_usage_reporter.mojom.h" | 30 #include "chrome/common/resource_usage_reporter.mojom.h" |
| 30 #include "chrome/common/resource_usage_reporter_type_converters.h" | 31 #include "chrome/common/resource_usage_reporter_type_converters.h" |
| 31 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 32 #include "chrome/renderer/content_settings_observer.h" | 33 #include "chrome/renderer/content_settings_observer.h" |
| 33 #include "chrome/renderer/security_filter_peer.h" | 34 #include "chrome/renderer/security_filter_peer.h" |
| 34 #include "components/variations/variations_util.h" | 35 #include "components/variations/variations_util.h" |
| 35 #include "content/public/child/resource_dispatcher_delegate.h" | 36 #include "content/public/child/resource_dispatcher_delegate.h" |
| 36 #include "content/public/common/service_registry.h" | 37 #include "content/public/common/service_registry.h" |
| 37 #include "content/public/renderer/render_thread.h" | 38 #include "content/public/renderer/render_thread.h" |
| 38 #include "content/public/renderer/render_view.h" | 39 #include "content/public/renderer/render_view.h" |
| 39 #include "content/public/renderer/render_view_visitor.h" | 40 #include "content/public/renderer/render_view_visitor.h" |
| 40 #include "crypto/nss_util.h" | 41 #include "crypto/nss_util.h" |
| 42 #include "media/base/media_resources.h" |
| 41 #include "net/base/net_errors.h" | 43 #include "net/base/net_errors.h" |
| 42 #include "net/base/net_module.h" | 44 #include "net/base/net_module.h" |
| 43 #include "third_party/WebKit/public/web/WebCache.h" | 45 #include "third_party/WebKit/public/web/WebCache.h" |
| 44 #include "third_party/WebKit/public/web/WebDocument.h" | 46 #include "third_party/WebKit/public/web/WebDocument.h" |
| 45 #include "third_party/WebKit/public/web/WebFrame.h" | 47 #include "third_party/WebKit/public/web/WebFrame.h" |
| 46 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 48 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 47 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 49 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 48 #include "third_party/WebKit/public/web/WebView.h" | 50 #include "third_party/WebKit/public/web/WebView.h" |
| 49 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | 51 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
| 50 | 52 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 thread->SetResourceDispatcherDelegate(resource_delegate_.get()); | 246 thread->SetResourceDispatcherDelegate(resource_delegate_.get()); |
| 245 | 247 |
| 246 content::ServiceRegistry* service_registry = thread->GetServiceRegistry(); | 248 content::ServiceRegistry* service_registry = thread->GetServiceRegistry(); |
| 247 if (service_registry) { | 249 if (service_registry) { |
| 248 service_registry->AddService<ResourceUsageReporter>( | 250 service_registry->AddService<ResourceUsageReporter>( |
| 249 base::Bind(CreateResourceUsageReporter, weak_factory_.GetWeakPtr())); | 251 base::Bind(CreateResourceUsageReporter, weak_factory_.GetWeakPtr())); |
| 250 } | 252 } |
| 251 | 253 |
| 252 // Configure modules that need access to resources. | 254 // Configure modules that need access to resources. |
| 253 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | 255 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
| 256 media::SetLocalizedStringProvider( |
| 257 chrome_common_media::LocalizedStringProvider); |
| 254 | 258 |
| 255 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(USE_OPENSSL) | 259 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(USE_OPENSSL) |
| 256 // On platforms where we use system NSS shared libraries, | 260 // On platforms where we use system NSS shared libraries, |
| 257 // initialize NSS now because it won't be able to load the .so's | 261 // initialize NSS now because it won't be able to load the .so's |
| 258 // after we engage the sandbox. | 262 // after we engage the sandbox. |
| 259 if (!command_line.HasSwitch(switches::kSingleProcess)) | 263 if (!command_line.HasSwitch(switches::kSingleProcess)) |
| 260 crypto::InitNSSSafely(); | 264 crypto::InitNSSSafely(); |
| 261 #endif | 265 #endif |
| 262 // Setup initial set of crash dump data for Field Trials in this renderer. | 266 // Setup initial set of crash dump data for Field Trials in this renderer. |
| 263 variations::SetVariationListCrashKeys(); | 267 variations::SetVariationListCrashKeys(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 ChromeRenderProcessObserver::content_setting_rules() const { | 333 ChromeRenderProcessObserver::content_setting_rules() const { |
| 330 return &content_setting_rules_; | 334 return &content_setting_rules_; |
| 331 } | 335 } |
| 332 | 336 |
| 333 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( | 337 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( |
| 334 const std::string& trial_name, | 338 const std::string& trial_name, |
| 335 const std::string& group_name) { | 339 const std::string& group_name) { |
| 336 content::RenderThread::Get()->Send( | 340 content::RenderThread::Get()->Send( |
| 337 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); | 341 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); |
| 338 } | 342 } |
| OLD | NEW |