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

Unified Diff: chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc

Issue 14807009: Merge 198744 "Fix security errors when accessing files and volum..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1500/src/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc
===================================================================
--- chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc (revision 199669)
+++ chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc (working copy)
@@ -817,13 +817,18 @@
if (!FileBrowserHasAccessPermissionForFiles(file_urls))
return false;
- scoped_refptr<const Extension> handler = GetExtension();
- if (!handler.get())
+ // Find the target extension.
+ scoped_refptr<const Extension> extension = GetExtension();
+ if (!extension.get())
return false;
- int handler_pid = ExtractProcessFromExtensionId(profile(), handler->id());
- if (handler_pid <= 0) {
- if (!extensions::BackgroundInfo::HasLazyBackgroundPage(handler))
+ // Forbid calling undeclared handlers.
+ if (!FindFileBrowserHandler(extension, action_id_))
+ return false;
+
+ int extension_pid = ExtractProcessFromExtensionId(profile(), extension->id());
+ if (extension_pid <= 0) {
+ if (!extensions::BackgroundInfo::HasLazyBackgroundPage(extension))
return false;
}
@@ -833,7 +838,7 @@
// send. The file access permissions will be granted to the extension in the
// file system context for the files in |file_urls|.
GURL site = extensions::ExtensionSystem::Get(profile())->extension_service()->
- GetSiteForExtensionId(handler->id());
+ GetSiteForExtensionId(extension->id());
scoped_refptr<fileapi::FileSystemContext> file_system_context_handler =
BrowserContext::GetStoragePartitionForSite(profile(), site)->
GetFileSystemContext();
@@ -844,9 +849,9 @@
&ExtensionTaskExecutor::RequestFileEntryOnFileThread,
this,
file_system_context_handler,
- Extension::GetBaseURLFromExtensionId(handler->id()),
- handler,
- handler_pid,
+ Extension::GetBaseURLFromExtensionId(extension->id()),
+ extension,
+ extension_pid,
file_urls));
return true;
}
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698