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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_tasks.h

Issue 686393002: Add isGenericFileHandler property to FileTask. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment. Created 6 years, 1 month 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
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 // This file provides utility functions for "file tasks". 5 // This file provides utility functions for "file tasks".
6 // 6 //
7 // WHAT ARE FILE TASKS? 7 // WHAT ARE FILE TASKS?
8 // 8 //
9 // File tasks are representation of actions that can be performed over the 9 // File tasks are representation of actions that can be performed over the
10 // currently selected files from Files.app. A task can be either of: 10 // currently selected files from Files.app. A task can be either of:
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // without any handler. Browser will take care of handling the file (ex. PDF). 97 // without any handler. Browser will take care of handling the file (ex. PDF).
98 // 98 //
99 // chrome.fileManagerPrivate.executeTasks() is used to open a file with a 99 // chrome.fileManagerPrivate.executeTasks() is used to open a file with a
100 // handler (Chrome Extension/App or Drive App). 100 // handler (Chrome Extension/App or Drive App).
101 // 101 //
102 // Some built-in handlers such as "play" are handled internally in Files.app. 102 // Some built-in handlers such as "play" are handled internally in Files.app.
103 // "mount-archive" is handled very differently. The task execution business 103 // "mount-archive" is handled very differently. The task execution business
104 // should be simplified: crbug.com/267313 104 // should be simplified: crbug.com/267313
105 // 105 //
106 // See also: 106 // See also:
107 // ui/file_manager/file_manager/js/file_tasks.js 107 // ui/file_manager/file_manager/foreground/js/file_tasks.js
108 // 108 //
109 109
110 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ 110 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_
111 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ 111 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_
112 112
113 #include <set> 113 #include <set>
114 #include <string> 114 #include <string>
115 #include <vector> 115 #include <vector>
116 116
117 #include "base/basictypes.h" 117 #include "base/basictypes.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 TaskType task_type; 159 TaskType task_type;
160 std::string action_id; 160 std::string action_id;
161 }; 161 };
162 162
163 // Describes a task with extra information such as icon URL. 163 // Describes a task with extra information such as icon URL.
164 class FullTaskDescriptor { 164 class FullTaskDescriptor {
165 public: 165 public:
166 FullTaskDescriptor(const TaskDescriptor& task_descriptor, 166 FullTaskDescriptor(const TaskDescriptor& task_descriptor,
167 const std::string& task_title, 167 const std::string& task_title,
168 const GURL& icon_url, 168 const GURL& icon_url,
169 bool is_default); 169 bool is_default,
170 bool is_generic_file_handler);
170 const TaskDescriptor& task_descriptor() const { return task_descriptor_; } 171 const TaskDescriptor& task_descriptor() const { return task_descriptor_; }
171 172
172 // The title of the task. 173 // The title of the task.
173 const std::string& task_title() const { return task_title_; } 174 const std::string& task_title() const { return task_title_; }
174 // The icon URL for the task (ex. app icon) 175 // The icon URL for the task (ex. app icon)
175 const GURL& icon_url() const { return icon_url_; } 176 const GURL& icon_url() const { return icon_url_; }
176 177
177 // True if this task is set as default. 178 // True if this task is set as default.
178 bool is_default() const { return is_default_; } 179 bool is_default() const { return is_default_; }
179 void set_is_default(bool is_default) { is_default_ = is_default; } 180 void set_is_default(bool is_default) { is_default_ = is_default; }
180 181
182 // True if this task is from generic file handler.
satorux1 2014/10/30 08:17:21 Please add some explanation about what is a generi
yawano 2014/10/31 01:26:30 Done.
183 bool is_generic_file_handler() const { return is_generic_file_handler_; }
184 void set_is_generic_file_handler(bool is_generic_file_handler) {
185 is_generic_file_handler_ = is_generic_file_handler;
186 }
187
181 private: 188 private:
182 TaskDescriptor task_descriptor_; 189 TaskDescriptor task_descriptor_;
183 std::string task_title_; 190 std::string task_title_;
184 GURL icon_url_; 191 GURL icon_url_;
185 bool is_default_; 192 bool is_default_;
193 bool is_generic_file_handler_;
186 }; 194 };
187 195
188 // Update the default file handler for the given sets of suffixes and MIME 196 // Update the default file handler for the given sets of suffixes and MIME
189 // types. 197 // types.
190 void UpdateDefaultTask(PrefService* pref_service, 198 void UpdateDefaultTask(PrefService* pref_service,
191 const std::string& task_id, 199 const std::string& task_id,
192 const std::set<std::string>& suffixes, 200 const std::set<std::string>& suffixes,
193 const std::set<std::string>& mime_types); 201 const std::set<std::string>& mime_types);
194 202
195 // Returns the task ID of the default task for the given |mime_type|/|suffix| 203 // Returns the task ID of the default task for the given |mime_type|/|suffix|
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // task is found (i.e. the default task may not exist in |tasks|). No tasks 299 // task is found (i.e. the default task may not exist in |tasks|). No tasks
292 // should be set as default before calling this function. 300 // should be set as default before calling this function.
293 void ChooseAndSetDefaultTask(const PrefService& pref_service, 301 void ChooseAndSetDefaultTask(const PrefService& pref_service,
294 const PathAndMimeTypeSet& path_mime_set, 302 const PathAndMimeTypeSet& path_mime_set,
295 std::vector<FullTaskDescriptor>* tasks); 303 std::vector<FullTaskDescriptor>* tasks);
296 304
297 } // namespace file_tasks 305 } // namespace file_tasks
298 } // namespace file_manager 306 } // namespace file_manager
299 307
300 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ 308 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698