Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: chrome/browser/renderer_host/chrome_render_message_filter.cc

Issue 6480106: Add IPCs to check web copy/cut/paste for extensions with the appropriate permission bit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: . Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/renderer_host/chrome_render_message_filter.h" 5 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
11 #include "chrome/browser/extensions/extension_event_router.h" 11 #include "chrome/browser/extensions/extension_event_router.h"
12 #include "chrome/browser/extensions/extension_message_service.h" 12 #include "chrome/browser/extensions/extension_message_service.h"
13 #include "chrome/browser/metrics/histogram_synchronizer.h" 13 #include "chrome/browser/metrics/histogram_synchronizer.h"
14 #include "chrome/browser/nacl_host/nacl_process_host.h" 14 #include "chrome/browser/nacl_host/nacl_process_host.h"
15 #include "chrome/browser/net/chrome_url_request_context.h" 15 #include "chrome/browser/net/chrome_url_request_context.h"
16 #include "chrome/browser/net/predictor_api.h" 16 #include "chrome/browser/net/predictor_api.h"
17 #include "chrome/browser/prefs/pref_member.h" 17 #include "chrome/browser/prefs/pref_member.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/task_manager/task_manager.h" 19 #include "chrome/browser/task_manager/task_manager.h"
20 #include "chrome/common/extensions/extension_file_util.h" 20 #include "chrome/common/extensions/extension_file_util.h"
21 #include "chrome/common/extensions/extension_message_bundle.h" 21 #include "chrome/common/extensions/extension_message_bundle.h"
22 #include "chrome/common/extensions/extension_messages.h" 22 #include "chrome/common/extensions/extension_messages.h"
23 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
24 #include "chrome/common/render_messages.h" 24 #include "chrome/common/render_messages.h"
25 #include "content/browser/renderer_host/render_process_host.h" 25 #include "content/browser/renderer_host/render_process_host.h"
26 #include "content/browser/renderer_host/resource_dispatcher_host.h" 26 #include "content/browser/renderer_host/resource_dispatcher_host.h"
27 #include "content/common/url_constants.h"
28 #include "googleurl/src/gurl.h"
27 29
28 #if defined(USE_TCMALLOC) 30 #if defined(USE_TCMALLOC)
29 #include "chrome/browser/browser_about_handler.h" 31 #include "chrome/browser/browser_about_handler.h"
30 #endif 32 #endif
31 33
32 using WebKit::WebCache; 34 using WebKit::WebCache;
33 35
34 ChromeRenderMessageFilter::ChromeRenderMessageFilter( 36 ChromeRenderMessageFilter::ChromeRenderMessageFilter(
35 int render_process_id, 37 int render_process_id,
36 Profile* profile, 38 Profile* profile,
(...skipping 30 matching lines...) Expand all
67 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddListener, OnExtensionAddListener) 69 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddListener, OnExtensionAddListener)
68 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveListener, 70 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveListener,
69 OnExtensionRemoveListener) 71 OnExtensionRemoveListener)
70 IPC_MESSAGE_HANDLER(ExtensionHostMsg_CloseChannel, OnExtensionCloseChannel) 72 IPC_MESSAGE_HANDLER(ExtensionHostMsg_CloseChannel, OnExtensionCloseChannel)
71 #if defined(USE_TCMALLOC) 73 #if defined(USE_TCMALLOC)
72 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererTcmalloc, OnRendererTcmalloc) 74 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererTcmalloc, OnRendererTcmalloc)
73 #endif 75 #endif
74 IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginPolicies, 76 IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginPolicies,
75 OnGetPluginPolicies) 77 OnGetPluginPolicies)
76 IPC_MESSAGE_HANDLER(ViewHostMsg_AllowDatabase, OnAllowDatabase) 78 IPC_MESSAGE_HANDLER(ViewHostMsg_AllowDatabase, OnAllowDatabase)
79 IPC_MESSAGE_HANDLER(ViewHostMsg_CanTriggerClipboardRead,
80 OnCanTriggerClipboardRead)
81 IPC_MESSAGE_HANDLER(ViewHostMsg_CanTriggerClipboardWrite,
82 OnCanTriggerClipboardWrite)
77 IPC_MESSAGE_UNHANDLED(handled = false) 83 IPC_MESSAGE_UNHANDLED(handled = false)
78 IPC_END_MESSAGE_MAP() 84 IPC_END_MESSAGE_MAP()
79 85
80 return handled; 86 return handled;
81 } 87 }
82 88
83 void ChromeRenderMessageFilter::OnDestruct() const { 89 void ChromeRenderMessageFilter::OnDestruct() const {
84 // Destroy on the UI thread because we contain a PrefMember. 90 // Destroy on the UI thread because we contain a PrefMember.
85 BrowserThread::DeleteOnUIThread::Destruct(this); 91 BrowserThread::DeleteOnUIThread::Destruct(this);
86 } 92 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 bool* result) { 311 bool* result) {
306 GURL url(origin_url); 312 GURL url(origin_url);
307 ContentSetting content_setting = 313 ContentSetting content_setting =
308 host_content_settings_map_->GetContentSetting( 314 host_content_settings_map_->GetContentSetting(
309 url, CONTENT_SETTINGS_TYPE_COOKIES, ""); 315 url, CONTENT_SETTINGS_TYPE_COOKIES, "");
310 DCHECK((content_setting == CONTENT_SETTING_ALLOW) || 316 DCHECK((content_setting == CONTENT_SETTING_ALLOW) ||
311 (content_setting == CONTENT_SETTING_BLOCK) || 317 (content_setting == CONTENT_SETTING_BLOCK) ||
312 (content_setting == CONTENT_SETTING_SESSION_ONLY)); 318 (content_setting == CONTENT_SETTING_SESSION_ONLY));
313 *result = content_setting != CONTENT_SETTING_BLOCK; 319 *result = content_setting != CONTENT_SETTING_BLOCK;
314 } 320 }
321
322 void ChromeRenderMessageFilter::OnCanTriggerClipboardRead(const GURL& url,
323 bool* allowed) {
324 ChromeURLRequestContext* context = static_cast<ChromeURLRequestContext*>(
325 request_context_->GetURLRequestContext());
326 *allowed = context->extension_info_map()->CheckURLAccessToExtensionPermission(
327 url, Extension::kClipboardReadPermission);
328 }
329
330 void ChromeRenderMessageFilter::OnCanTriggerClipboardWrite(const GURL& url,
331 bool* allowed) {
332 ChromeURLRequestContext* context = static_cast<ChromeURLRequestContext*>(
333 request_context_->GetURLRequestContext());
334 // Since all extensions could historically write to the clipboard, preserve it
335 // for compatibility.
336 *allowed = url.SchemeIs(chrome::kExtensionScheme) ||
337 context->extension_info_map()->CheckURLAccessToExtensionPermission(
338 url, Extension::kClipboardWritePermission);
339 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_render_message_filter.h ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698