OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "content/browser/plugin_process_host.h" | 33 #include "content/browser/plugin_process_host.h" |
34 #include "content/browser/plugin_service.h" | 34 #include "content/browser/plugin_service.h" |
35 #include "content/browser/ppapi_plugin_process_host.h" | 35 #include "content/browser/ppapi_plugin_process_host.h" |
36 #include "content/browser/ppapi_broker_process_host.h" | 36 #include "content/browser/ppapi_broker_process_host.h" |
37 #include "content/browser/renderer_host/browser_render_process_host.h" | 37 #include "content/browser/renderer_host/browser_render_process_host.h" |
38 #include "content/browser/renderer_host/render_view_host_delegate.h" | 38 #include "content/browser/renderer_host/render_view_host_delegate.h" |
39 #include "content/browser/renderer_host/render_view_host_notification_task.h" | 39 #include "content/browser/renderer_host/render_view_host_notification_task.h" |
40 #include "content/browser/renderer_host/render_widget_helper.h" | 40 #include "content/browser/renderer_host/render_widget_helper.h" |
41 #include "content/common/desktop_notification_messages.h" | 41 #include "content/common/desktop_notification_messages.h" |
42 #include "content/common/notification_service.h" | 42 #include "content/common/notification_service.h" |
| 43 #include "content/common/url_constants.h" |
43 #include "content/common/view_messages.h" | 44 #include "content/common/view_messages.h" |
44 #include "ipc/ipc_channel_handle.h" | 45 #include "ipc/ipc_channel_handle.h" |
45 #include "net/base/cookie_monster.h" | 46 #include "net/base/cookie_monster.h" |
46 #include "net/base/host_resolver_impl.h" | 47 #include "net/base/host_resolver_impl.h" |
47 #include "net/base/io_buffer.h" | 48 #include "net/base/io_buffer.h" |
48 #include "net/base/keygen_handler.h" | 49 #include "net/base/keygen_handler.h" |
49 #include "net/base/mime_util.h" | 50 #include "net/base/mime_util.h" |
50 #include "net/base/net_errors.h" | 51 #include "net/base/net_errors.h" |
51 #include "net/disk_cache/disk_cache.h" | 52 #include "net/disk_cache/disk_cache.h" |
52 #include "net/http/http_cache.h" | 53 #include "net/http/http_cache.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToPpapiBroker, | 359 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToPpapiBroker, |
359 OnOpenChannelToPpapiBroker) | 360 OnOpenChannelToPpapiBroker) |
360 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_UpdateRect, | 361 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_UpdateRect, |
361 render_widget_helper_->DidReceiveUpdateMsg(message)) | 362 render_widget_helper_->DidReceiveUpdateMsg(message)) |
362 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_CheckPermission, | 363 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_CheckPermission, |
363 OnCheckNotificationPermission) | 364 OnCheckNotificationPermission) |
364 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) | 365 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) |
365 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateSharedMemoryBuffer, | 366 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateSharedMemoryBuffer, |
366 OnAllocateSharedMemoryBuffer) | 367 OnAllocateSharedMemoryBuffer) |
367 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) | 368 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) |
| 369 IPC_MESSAGE_HANDLER(ViewHostMsg_CanTriggerClipboardRead, |
| 370 OnCanTriggerClipboardRead) |
| 371 IPC_MESSAGE_HANDLER(ViewHostMsg_CanTriggerClipboardWrite, |
| 372 OnCanTriggerClipboardWrite) |
368 #if defined(OS_MACOSX) | 373 #if defined(OS_MACOSX) |
369 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB, OnAllocTransportDIB) | 374 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB, OnAllocTransportDIB) |
370 IPC_MESSAGE_HANDLER(ViewHostMsg_FreeTransportDIB, OnFreeTransportDIB) | 375 IPC_MESSAGE_HANDLER(ViewHostMsg_FreeTransportDIB, OnFreeTransportDIB) |
371 #endif | 376 #endif |
372 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseCurrentConnections, | 377 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseCurrentConnections, |
373 OnCloseCurrentConnections) | 378 OnCloseCurrentConnections) |
374 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCacheMode, OnSetCacheMode) | 379 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCacheMode, OnSetCacheMode) |
375 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ClearCache, OnClearCache) | 380 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ClearCache, OnClearCache) |
376 IPC_MESSAGE_HANDLER(ViewHostMsg_ClearHostResolverCache, | 381 IPC_MESSAGE_HANDLER(ViewHostMsg_ClearHostResolverCache, |
377 OnClearHostResolverCache) | 382 OnClearHostResolverCache) |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 void RenderMessageFilter::OnDidZoomURL(const IPC::Message& message, | 704 void RenderMessageFilter::OnDidZoomURL(const IPC::Message& message, |
700 double zoom_level, | 705 double zoom_level, |
701 bool remember, | 706 bool remember, |
702 const GURL& url) { | 707 const GURL& url) { |
703 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 708 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
704 NewRunnableMethod(this, | 709 NewRunnableMethod(this, |
705 &RenderMessageFilter::UpdateHostZoomLevelsOnUIThread, | 710 &RenderMessageFilter::UpdateHostZoomLevelsOnUIThread, |
706 zoom_level, remember, url, render_process_id_, message.routing_id())); | 711 zoom_level, remember, url, render_process_id_, message.routing_id())); |
707 } | 712 } |
708 | 713 |
| 714 void RenderMessageFilter::OnCanTriggerClipboardRead(const GURL& url, |
| 715 bool* allowed) { |
| 716 ChromeURLRequestContext* context = GetRequestContextForURL(url); |
| 717 *allowed = context->extension_info_map()->CheckURLAccessToExtensionPermission( |
| 718 url, Extension::kClipboardReadPermission); |
| 719 } |
| 720 |
| 721 void RenderMessageFilter::OnCanTriggerClipboardWrite(const GURL& url, |
| 722 bool* allowed) { |
| 723 ChromeURLRequestContext* context = GetRequestContextForURL(url); |
| 724 // Since all extensions could historically write to the clipboard, preserve it |
| 725 // for compatibility. |
| 726 *allowed = url.SchemeIs(chrome::kExtensionScheme) || |
| 727 context->extension_info_map()->CheckURLAccessToExtensionPermission( |
| 728 url, Extension::kClipboardWritePermission); |
| 729 } |
| 730 |
709 void RenderMessageFilter::UpdateHostZoomLevelsOnUIThread( | 731 void RenderMessageFilter::UpdateHostZoomLevelsOnUIThread( |
710 double zoom_level, | 732 double zoom_level, |
711 bool remember, | 733 bool remember, |
712 const GURL& url, | 734 const GURL& url, |
713 int render_process_id, | 735 int render_process_id, |
714 int render_view_id) { | 736 int render_view_id) { |
715 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 737 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
716 if (remember) { | 738 if (remember) { |
717 host_zoom_map_->SetZoomLevel(url, zoom_level); | 739 host_zoom_map_->SetZoomLevel(url, zoom_level); |
718 // Notify renderers from this profile. | 740 // Notify renderers from this profile. |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 | 1090 |
1069 ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg_, cookies); | 1091 ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg_, cookies); |
1070 filter_->Send(reply_msg_); | 1092 filter_->Send(reply_msg_); |
1071 delete this; | 1093 delete this; |
1072 } | 1094 } |
1073 } | 1095 } |
1074 | 1096 |
1075 void GetCookiesCompletion::set_cookie_store(CookieStore* cookie_store) { | 1097 void GetCookiesCompletion::set_cookie_store(CookieStore* cookie_store) { |
1076 cookie_store_ = cookie_store; | 1098 cookie_store_ = cookie_store; |
1077 } | 1099 } |
OLD | NEW |