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

Side by Side Diff: chrome/browser/renderer_host/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: Move check to be based on ChromeURLRequestContext. Created 9 years, 10 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/render_message_filter.h" 5 #include "chrome/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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 bool prompt_for_save_location = false; 840 bool prompt_for_save_location = false;
841 resource_dispatcher_host_->BeginDownload(url, 841 resource_dispatcher_host_->BeginDownload(url,
842 referrer, 842 referrer,
843 DownloadSaveInfo(), 843 DownloadSaveInfo(),
844 prompt_for_save_location, 844 prompt_for_save_location,
845 render_process_id_, 845 render_process_id_,
846 message.routing_id(), 846 message.routing_id(),
847 context); 847 context);
848 } 848 }
849 849
850 void RenderMessageFilter::OnIsWebCopyCutEnabled(const GURL& url,
851 bool* enabled) {
852 // TODO(dcheng): is this right? Will it be NULL if it's not an extension?
Aaron Boodman 2011/02/22 21:49:01 No, this is not correct, unfortunately. Extensions
853 ChromeURLRequestContext* context = GetRequestContextForURL(url);
854 *enabled = context->extension_info_map() != NULL;
855 }
856
857 void RenderMessageFilter::OnIsWebPasteEnabled(const GURL& url,
858 bool* enabled) {
859 ChromeURLRequestContext* context = GetRequestContextForURL(url);
860 *enabled = context->extension_info_map() != NULL &&
861 context->extension_info_map()->CheckURLAccessToExtensionPermission(
862 url, Extension::kClipboardPermission);
863 }
864
850 void RenderMessageFilter::OnClipboardWriteObjectsSync( 865 void RenderMessageFilter::OnClipboardWriteObjectsSync(
851 const ui::Clipboard::ObjectMap& objects, 866 const ui::Clipboard::ObjectMap& objects,
852 base::SharedMemoryHandle bitmap_handle) { 867 base::SharedMemoryHandle bitmap_handle) {
853 DCHECK(base::SharedMemory::IsHandleValid(bitmap_handle)) 868 DCHECK(base::SharedMemory::IsHandleValid(bitmap_handle))
854 << "Bad bitmap handle"; 869 << "Bad bitmap handle";
855 // We cannot write directly from the IO thread, and cannot service the IPC 870 // We cannot write directly from the IO thread, and cannot service the IPC
856 // on the UI thread. We'll copy the relevant data and get a handle to any 871 // on the UI thread. We'll copy the relevant data and get a handle to any
857 // shared memory so it doesn't go away when we resume the renderer, and post 872 // shared memory so it doesn't go away when we resume the renderer, and post
858 // a task to perform the write on the UI thread. 873 // a task to perform the write on the UI thread.
859 ui::Clipboard::ObjectMap* long_living_objects = 874 ui::Clipboard::ObjectMap* long_living_objects =
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 } 1724 }
1710 1725
1711 CookiesEnabledCompletion::~CookiesEnabledCompletion() {} 1726 CookiesEnabledCompletion::~CookiesEnabledCompletion() {}
1712 1727
1713 void CookiesEnabledCompletion::RunWithParams(const Tuple1<int>& params) { 1728 void CookiesEnabledCompletion::RunWithParams(const Tuple1<int>& params) {
1714 bool result = params.a != net::ERR_ACCESS_DENIED; 1729 bool result = params.a != net::ERR_ACCESS_DENIED;
1715 ViewHostMsg_CookiesEnabled::WriteReplyParams(reply_msg_, result); 1730 ViewHostMsg_CookiesEnabled::WriteReplyParams(reply_msg_, result);
1716 filter_->Send(reply_msg_); 1731 filter_->Send(reply_msg_);
1717 delete this; 1732 delete this;
1718 } 1733 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698