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

Unified Diff: chrome/browser/chromeos/extensions/file_handler_util.h

Issue 9808023: Grant file access permissions for cached file paths to file browsers/handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another rebase Created 8 years, 9 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
Index: chrome/browser/chromeos/extensions/file_handler_util.h
diff --git a/chrome/browser/chromeos/extensions/file_handler_util.h b/chrome/browser/chromeos/extensions/file_handler_util.h
index f17fd01a37e1ed840de3610846c4efae9d7d0c35..9e5b4651aa72a672a526fc0444d4e5a5d96ad8ae 100644
--- a/chrome/browser/chromeos/extensions/file_handler_util.h
+++ b/chrome/browser/chromeos/extensions/file_handler_util.h
@@ -17,15 +17,22 @@ class Profile;
namespace file_handler_util {
+// Gets read-write file access permission flags.
int GetReadWritePermissions();
+// Gets read-only file access permission flags.
+int GetReadOnlyPermissions();
+// Generates file task id for the file actin specified by the extension.
std::string MakeTaskID(const std::string& extension_id,
const std::string& action_id);
+// Extracts action and extension id bound to the file task.
bool CrackTaskID(const std::string& task_id,
std::string* target_extension_id,
std::string* action_id);
+// Struct that keeps track of when a handler was `last used.
+// It is used to determine default file action for a file.
struct LastUsedHandler {
LastUsedHandler(int t, const FileBrowserHandler* h, URLPatternSet p)
: timestamp(t),
@@ -40,14 +47,19 @@ struct LastUsedHandler {
typedef std::vector<LastUsedHandler> LastUsedHandlerList;
+// Generates list of tasks common for all files in |file_list|.
+// The resulting list is sorted by last usage time.
bool FindCommonTasks(Profile* profile,
const std::vector<GURL>& files_list,
LastUsedHandlerList* named_action_list);
+// Find the default task for a file whose url is |url|. (The default task is the
+// task that is assigned to file browser task button by default).
bool GetDefaultTask(Profile* profile,
const GURL& url,
const FileBrowserHandler** handler);
+// Helper class for executing file browser file action.
class FileTaskExecutor : public base::RefCountedThreadSafe<FileTaskExecutor> {
public:

Powered by Google App Engine
This is Rietveld 408576698