| 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/browser/renderer_host/render_message_filter.h" | 5 #include "content/browser/renderer_host/render_message_filter.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/debug/alias.h" | 12 #include "base/debug/alias.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
| 15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "base/threading/worker_pool.h" | 17 #include "base/threading/worker_pool.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "content/browser/browser_main_loop.h" |
| 19 #include "content/browser/child_process_security_policy_impl.h" | 20 #include "content/browser/child_process_security_policy_impl.h" |
| 20 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 21 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 21 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 22 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 22 #include "content/browser/download/download_stats.h" | 23 #include "content/browser/download/download_stats.h" |
| 23 #include "content/browser/gpu/gpu_data_manager_impl.h" | 24 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 24 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 25 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 25 #include "content/browser/media/media_internals.h" | 26 #include "content/browser/media/media_internals.h" |
| 26 #include "content/browser/plugin_process_host.h" | 27 #include "content/browser/plugin_process_host.h" |
| 27 #include "content/browser/plugin_service_impl.h" | 28 #include "content/browser/plugin_service_impl.h" |
| 28 #include "content/browser/ppapi_plugin_process_host.h" | 29 #include "content/browser/ppapi_plugin_process_host.h" |
| 29 #include "content/browser/renderer_host/render_process_host_impl.h" | 30 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 30 #include "content/browser/renderer_host/render_view_host_delegate.h" | 31 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 31 #include "content/browser/renderer_host/render_widget_helper.h" | 32 #include "content/browser/renderer_host/render_widget_helper.h" |
| 32 #include "content/common/child_process_host_impl.h" | 33 #include "content/common/child_process_host_impl.h" |
| 33 #include "content/common/child_process_messages.h" | 34 #include "content/common/child_process_messages.h" |
| 34 #include "content/common/desktop_notification_messages.h" | 35 #include "content/common/desktop_notification_messages.h" |
| 35 #include "content/common/view_messages.h" | 36 #include "content/common/view_messages.h" |
| 36 #include "content/public/browser/browser_context.h" | 37 #include "content/public/browser/browser_context.h" |
| 37 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 38 #include "content/public/browser/content_browser_client.h" | 39 #include "content/public/browser/content_browser_client.h" |
| 39 #include "content/public/browser/download_save_info.h" | 40 #include "content/public/browser/download_save_info.h" |
| 40 #include "content/public/browser/plugin_service_filter.h" | 41 #include "content/public/browser/plugin_service_filter.h" |
| 41 #include "content/public/browser/resource_context.h" | 42 #include "content/public/browser/resource_context.h" |
| 42 #include "content/public/browser/user_metrics.h" | 43 #include "content/public/browser/user_metrics.h" |
| 43 #include "content/public/common/content_switches.h" | 44 #include "content/public/common/content_switches.h" |
| 44 #include "content/public/common/context_menu_params.h" | 45 #include "content/public/common/context_menu_params.h" |
| 45 #include "content/public/common/url_constants.h" | 46 #include "content/public/common/url_constants.h" |
| 46 #include "ipc/ipc_channel_handle.h" | 47 #include "ipc/ipc_channel_handle.h" |
| 47 #include "ipc/ipc_platform_file.h" | 48 #include "ipc/ipc_platform_file.h" |
| 49 #include "media/audio/audio_manager.h" |
| 48 #include "media/audio/audio_manager_base.h" | 50 #include "media/audio/audio_manager_base.h" |
| 49 #include "media/audio/audio_util.h" | 51 #include "media/audio/audio_parameters.h" |
| 50 #include "media/base/media_log_event.h" | 52 #include "media/base/media_log_event.h" |
| 51 #include "net/base/io_buffer.h" | 53 #include "net/base/io_buffer.h" |
| 52 #include "net/base/keygen_handler.h" | 54 #include "net/base/keygen_handler.h" |
| 53 #include "net/base/mime_util.h" | 55 #include "net/base/mime_util.h" |
| 54 #include "net/cookies/canonical_cookie.h" | 56 #include "net/cookies/canonical_cookie.h" |
| 55 #include "net/cookies/cookie_monster.h" | 57 #include "net/cookies/cookie_monster.h" |
| 56 #include "net/http/http_cache.h" | 58 #include "net/http/http_cache.h" |
| 57 #include "net/url_request/url_request_context.h" | 59 #include "net/url_request/url_request_context.h" |
| 58 #include "net/url_request/url_request_context_getter.h" | 60 #include "net/url_request/url_request_context_getter.h" |
| 59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen
ter.h" | 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen
ter.h" |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 void RenderMessageFilter::OnGetCPUUsage(int* cpu_usage) { | 771 void RenderMessageFilter::OnGetCPUUsage(int* cpu_usage) { |
| 770 base::TimeTicks now = base::TimeTicks::Now(); | 772 base::TimeTicks now = base::TimeTicks::Now(); |
| 771 int64 since_last_sample_ms = (now - cpu_usage_sample_time_).InMilliseconds(); | 773 int64 since_last_sample_ms = (now - cpu_usage_sample_time_).InMilliseconds(); |
| 772 if (since_last_sample_ms > kCPUUsageSampleIntervalMs) { | 774 if (since_last_sample_ms > kCPUUsageSampleIntervalMs) { |
| 773 cpu_usage_sample_time_ = now; | 775 cpu_usage_sample_time_ = now; |
| 774 cpu_usage_ = static_cast<int>(process_metrics_->GetCPUUsage()); | 776 cpu_usage_ = static_cast<int>(process_metrics_->GetCPUUsage()); |
| 775 } | 777 } |
| 776 *cpu_usage = cpu_usage_; | 778 *cpu_usage = cpu_usage_; |
| 777 } | 779 } |
| 778 | 780 |
| 781 // TODO(xians): refactor the API to return input and output AudioParameters. |
| 779 void RenderMessageFilter::OnGetAudioHardwareConfig( | 782 void RenderMessageFilter::OnGetAudioHardwareConfig( |
| 780 int* output_buffer_size, int* output_sample_rate, int* input_sample_rate, | 783 int* output_buffer_size, int* output_sample_rate, int* input_sample_rate, |
| 781 media::ChannelLayout* input_channel_layout) { | 784 media::ChannelLayout* input_channel_layout) { |
| 782 *output_buffer_size = media::GetAudioHardwareBufferSize(); | 785 media::AudioManager* audio_manager = BrowserMainLoop::GetAudioManager(); |
| 783 *output_sample_rate = media::GetAudioHardwareSampleRate(); | 786 const media::AudioParameters output_parameters = |
| 787 audio_manager->GetDefaultOutputStreamParameters(); |
| 788 *output_buffer_size = output_parameters.frames_per_buffer(); |
| 789 *output_sample_rate = output_parameters.sample_rate(); |
| 784 | 790 |
| 785 // TODO(henrika): add support for all available input devices. | 791 // TODO(henrika): add support for all available input devices. |
| 786 *input_sample_rate = media::GetAudioInputHardwareSampleRate( | 792 const media::AudioParameters input_parameters = |
| 787 media::AudioManagerBase::kDefaultDeviceId); | 793 audio_manager->GetInputStreamParameters( |
| 788 *input_channel_layout = media::GetAudioInputHardwareChannelLayout( | 794 media::AudioManagerBase::kDefaultDeviceId); |
| 789 media::AudioManagerBase::kDefaultDeviceId); | 795 *input_sample_rate = input_parameters.sample_rate(); |
| 796 *input_channel_layout = input_parameters.channel_layout(); |
| 790 } | 797 } |
| 791 | 798 |
| 792 void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) { | 799 void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) { |
| 793 #if defined(OS_WIN) | 800 #if defined(OS_WIN) |
| 794 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); | 801 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 795 if (BackingStoreWin::ColorManagementEnabled()) | 802 if (BackingStoreWin::ColorManagementEnabled()) |
| 796 return; | 803 return; |
| 797 #endif | 804 #endif |
| 798 *profile = g_color_profile.Get().profile(); | 805 *profile = g_color_profile.Get().profile(); |
| 799 } | 806 } |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 | 1129 |
| 1123 HENHMETAFILE metafile = CloseEnhMetaFile(hdc); | 1130 HENHMETAFILE metafile = CloseEnhMetaFile(hdc); |
| 1124 | 1131 |
| 1125 if (metafile) { | 1132 if (metafile) { |
| 1126 DeleteEnhMetaFile(metafile); | 1133 DeleteEnhMetaFile(metafile); |
| 1127 } | 1134 } |
| 1128 } | 1135 } |
| 1129 #endif | 1136 #endif |
| 1130 | 1137 |
| 1131 } // namespace content | 1138 } // namespace content |
| OLD | NEW |