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 representatiosn of actions that can be performed over the | 9 // File tasks are representatiosn 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 // The title of the task. | 171 // The title of the task. |
172 const std::string& task_title() { return task_title_; } | 172 const std::string& task_title() { return task_title_; } |
173 // The icon URL for the task (ex. app icon) | 173 // The icon URL for the task (ex. app icon) |
174 const GURL& icon_url() const { return icon_url_; } | 174 const GURL& icon_url() const { return icon_url_; } |
175 | 175 |
176 // True if this task is set as default. | 176 // True if this task is set as default. |
177 bool is_default() const { return is_default_; } | 177 bool is_default() const { return is_default_; } |
178 void set_is_default(bool is_default) { is_default_ = is_default; } | 178 void set_is_default(bool is_default) { is_default_ = is_default; } |
179 | 179 |
180 // Returns a DictionaryValue representation, which looks like: | |
181 // | |
182 // { | |
183 // "driveApp": true, | |
184 // "iconUrl": "<app_icon_url>", | |
185 // "isDefault": false, | |
186 // "taskId": "<drive_app_id>|drive|open-with", | |
187 // "title": "Drive App Name (ex. Pixlr Editor)" | |
188 // }, | |
189 // | |
190 // "iconUrl" is omitted if icon_url_ is empty. | |
191 // | |
192 // This representation will be used to send task info to the JavaScript. | |
193 scoped_ptr<base::DictionaryValue> AsDictionaryValue() const; | |
194 | |
195 private: | 180 private: |
196 TaskDescriptor task_descriptor_; | 181 TaskDescriptor task_descriptor_; |
197 std::string task_title_; | 182 std::string task_title_; |
198 GURL icon_url_; | 183 GURL icon_url_; |
199 bool is_default_; | 184 bool is_default_; |
200 }; | 185 }; |
201 | 186 |
202 // Update the default file handler for the given sets of suffixes and MIME | 187 // Update the default file handler for the given sets of suffixes and MIME |
203 // types. | 188 // types. |
204 void UpdateDefaultTask(PrefService* pref_service, | 189 void UpdateDefaultTask(PrefService* pref_service, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 // task is found (i.e. the default task may not exist in |tasks|). No tasks | 311 // task is found (i.e. the default task may not exist in |tasks|). No tasks |
327 // should be set as default before calling this function. | 312 // should be set as default before calling this function. |
328 void ChooseAndSetDefaultTask(const PrefService& pref_service, | 313 void ChooseAndSetDefaultTask(const PrefService& pref_service, |
329 const PathAndMimeTypeSet& path_mime_set, | 314 const PathAndMimeTypeSet& path_mime_set, |
330 std::vector<FullTaskDescriptor>* tasks); | 315 std::vector<FullTaskDescriptor>* tasks); |
331 | 316 |
332 } // namespace file_tasks | 317 } // namespace file_tasks |
333 } // namespace file_manager | 318 } // namespace file_manager |
334 | 319 |
335 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_TASKS_H_ | 320 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_TASKS_H_ |
OLD | NEW |