Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 | 160 |
| 161 std::string app_id; | 161 std::string app_id; |
| 162 TaskType task_type; | 162 TaskType task_type; |
| 163 std::string action_id; | 163 std::string action_id; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 // Describes a task with extra information such as icon URL. | 166 // Describes a task with extra information such as icon URL. |
| 167 class FullTaskDescriptor { | 167 class FullTaskDescriptor { |
| 168 public: | 168 public: |
| 169 FullTaskDescriptor(const TaskDescriptor& task_descriptor, | 169 FullTaskDescriptor(const TaskDescriptor& task_descriptor, |
| 170 const std::string& task_title, | 170 const base::string16& task_title, |
| 171 const GURL& icon_url, | 171 const GURL& icon_url, |
| 172 bool is_default, | 172 bool is_default, |
| 173 bool is_generic_file_handler); | 173 bool is_generic_file_handler); |
| 174 ~FullTaskDescriptor(); | |
|
fukino
2016/04/11 09:19:43
Unnecessary change?
cmihail
2016/04/13 07:36:46
Sorry, I forgot to remove it after adding and remo
| |
| 175 | |
| 174 const TaskDescriptor& task_descriptor() const { return task_descriptor_; } | 176 const TaskDescriptor& task_descriptor() const { return task_descriptor_; } |
| 175 | 177 |
| 176 // The title of the task. | 178 // The title of the task. |
| 177 const std::string& task_title() const { return task_title_; } | 179 const base::string16& task_title() const { return task_title_; } |
| 178 // The icon URL for the task (ex. app icon) | 180 // The icon URL for the task (ex. app icon) |
| 179 const GURL& icon_url() const { return icon_url_; } | 181 const GURL& icon_url() const { return icon_url_; } |
| 180 | 182 |
| 181 // True if this task is set as default. | 183 // True if this task is set as default. |
| 182 bool is_default() const { return is_default_; } | 184 bool is_default() const { return is_default_; } |
| 183 void set_is_default(bool is_default) { is_default_ = is_default; } | 185 void set_is_default(bool is_default) { is_default_ = is_default; } |
| 184 | 186 |
| 185 // True if this task is from generic file handler. Generic file handler is a | 187 // True if this task is from generic file handler. Generic file handler is a |
| 186 // file handler which handles any type of files (e.g. extensions: ["*"], | 188 // file handler which handles any type of files (e.g. extensions: ["*"], |
| 187 // types: ["*/*"]). Partial wild card (e.g. types: ["image/*"]) is not | 189 // types: ["*/*"]). Partial wild card (e.g. types: ["image/*"]) is not |
| 188 // generic file handler. | 190 // generic file handler. |
| 189 bool is_generic_file_handler() const { return is_generic_file_handler_; } | 191 bool is_generic_file_handler() const { return is_generic_file_handler_; } |
| 190 void set_is_generic_file_handler(bool is_generic_file_handler) { | 192 void set_is_generic_file_handler(bool is_generic_file_handler) { |
| 191 is_generic_file_handler_ = is_generic_file_handler; | 193 is_generic_file_handler_ = is_generic_file_handler; |
| 192 } | 194 } |
| 193 | 195 |
| 194 private: | 196 private: |
| 195 TaskDescriptor task_descriptor_; | 197 TaskDescriptor task_descriptor_; |
| 196 std::string task_title_; | 198 base::string16 task_title_; |
| 197 GURL icon_url_; | 199 GURL icon_url_; |
| 198 bool is_default_; | 200 bool is_default_; |
| 199 bool is_generic_file_handler_; | 201 bool is_generic_file_handler_; |
| 200 }; | 202 }; |
| 201 | 203 |
| 202 // Update the default file handler for the given sets of suffixes and MIME | 204 // Update the default file handler for the given sets of suffixes and MIME |
| 203 // types. | 205 // types. |
| 204 void UpdateDefaultTask(PrefService* pref_service, | 206 void UpdateDefaultTask(PrefService* pref_service, |
| 205 const std::string& task_id, | 207 const std::string& task_id, |
| 206 const std::set<std::string>& suffixes, | 208 const std::set<std::string>& suffixes, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 // task is found (i.e. the default task may not exist in |tasks|). No tasks | 308 // task is found (i.e. the default task may not exist in |tasks|). No tasks |
| 307 // should be set as default before calling this function. | 309 // should be set as default before calling this function. |
| 308 void ChooseAndSetDefaultTask(const PrefService& pref_service, | 310 void ChooseAndSetDefaultTask(const PrefService& pref_service, |
| 309 const std::vector<extensions::EntryInfo>& entries, | 311 const std::vector<extensions::EntryInfo>& entries, |
| 310 std::vector<FullTaskDescriptor>* tasks); | 312 std::vector<FullTaskDescriptor>* tasks); |
| 311 | 313 |
| 312 } // namespace file_tasks | 314 } // namespace file_tasks |
| 313 } // namespace file_manager | 315 } // namespace file_manager |
| 314 | 316 |
| 315 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ | 317 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ |
| OLD | NEW |