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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/file_handler_util.h

Issue 15975004: Replace sets with vectors when storing file handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_HANDLER_UTIL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_HANDLER_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_HANDLER_UTIL_H_ 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_HANDLER_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 10 matching lines...) Expand all
21 namespace extensions { 21 namespace extensions {
22 class Extension; 22 class Extension;
23 } // namespace extensions 23 } // namespace extensions
24 24
25 namespace fileapi { 25 namespace fileapi {
26 class FileSystemURL; 26 class FileSystemURL;
27 } 27 }
28 28
29 namespace file_handler_util { 29 namespace file_handler_util {
30 30
31 // Tasks are stored as a vector in order of priorities.
32 typedef std::vector<const FileBrowserHandler*> FileBrowserHandlerList;
33
31 // Specifies the task type for a task id that represents some file action, Drive 34 // Specifies the task type for a task id that represents some file action, Drive
32 // action, or Web Intent action. 35 // action, or Web Intent action.
33 extern const char kTaskFile[]; 36 extern const char kTaskFile[];
34 extern const char kTaskDrive[]; 37 extern const char kTaskDrive[];
35 extern const char kTaskApp[]; 38 extern const char kTaskApp[];
36 39
37 void UpdateFileHandlerUsageStats(Profile* profile, const std::string& task_id); 40 void UpdateFileHandlerUsageStats(Profile* profile, const std::string& task_id);
38 41
39 // Update the default file handler for the given sets of suffixes and MIME 42 // Update the default file handler for the given sets of suffixes and MIME
40 // types. 43 // types.
(...skipping 22 matching lines...) Expand all
63 const std::string& action_id); 66 const std::string& action_id);
64 67
65 // Extracts action, type and extension id bound to the file task. Either 68 // Extracts action, type and extension id bound to the file task. Either
66 // |target_extension_id| or |action_id| are allowed to be NULL if caller isn't 69 // |target_extension_id| or |action_id| are allowed to be NULL if caller isn't
67 // interested in those values. Returns false on failure to parse. 70 // interested in those values. Returns false on failure to parse.
68 bool CrackTaskID(const std::string& task_id, 71 bool CrackTaskID(const std::string& task_id,
69 std::string* target_extension_id, 72 std::string* target_extension_id,
70 std::string* task_type, 73 std::string* task_type,
71 std::string* action_id); 74 std::string* action_id);
72 75
73 // This generates a list of default tasks (tasks set as default by the user in 76 // This generates a list of default tasks (tasks list as default by the user in
kinaba 2013/05/24 07:34:13 nit: probably this "set" is a past participle of t
mtomasz 2013/05/24 07:49:45 Done.
74 // prefs) from the |common_tasks|. 77 // prefs) from the |common_tasks|.
75 void FindDefaultTasks(Profile* profile, 78 void FindDefaultTasks(Profile* profile,
76 const std::vector<base::FilePath>& files_list, 79 const std::vector<base::FilePath>& files_list,
77 const std::set<const FileBrowserHandler*>& common_tasks, 80 const FileBrowserHandlerList& common_tasks,
78 std::set<const FileBrowserHandler*>* default_tasks); 81 FileBrowserHandlerList* default_tasks);
79 82
80 // This generates list of tasks common for all files in |file_list|. 83 // This generates list of tasks common for all files in |file_list|.
81 bool FindCommonTasks(Profile* profile, 84 bool FindCommonTasks(Profile* profile,
82 const std::vector<GURL>& files_list, 85 const std::vector<GURL>& files_list,
83 std::set<const FileBrowserHandler*>* common_tasks); 86 FileBrowserHandlerList* common_tasks);
84 87
85 // Finds a task for a file whose URL is |url| and whose path is |path|. 88 // Finds a task for a file whose URL is |url| and whose path is |path|.
86 // Returns default task if one is defined (The default task is the task that is 89 // Returns default task if one is defined (The default task is the task that is
87 // assigned to file browser task button by default). If default task is not 90 // assigned to file browser task button by default). If default task is not
88 // found, tries to match the url with one of the builtin tasks. 91 // found, tries to match the url with one of the builtin tasks.
89 bool GetTaskForURLAndPath(Profile* profile, 92 bool GetTaskForURLAndPath(Profile* profile,
90 const GURL& url, 93 const GURL& url,
91 const base::FilePath& path, 94 const base::FilePath& path,
92 const FileBrowserHandler** handler); 95 const FileBrowserHandler** handler);
93 96
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 151
149 Profile* profile_; 152 Profile* profile_;
150 const GURL source_url_; 153 const GURL source_url_;
151 const std::string file_browser_id_; 154 const std::string file_browser_id_;
152 const std::string extension_id_; 155 const std::string extension_id_;
153 }; 156 };
154 157
155 } // namespace file_handler_util 158 } // namespace file_handler_util
156 159
157 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_HANDLER_UTIL_H_ 160 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_HANDLER_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698