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

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

Issue 1872223002: Add verbs API to file handlers. Modify the Chrome OS UI so that it displayes the internationalized … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add an enum for verbs in idl file. Created 4 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
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 std::string app_id; 164 std::string app_id;
165 TaskType task_type; 165 TaskType task_type;
166 std::string action_id; 166 std::string action_id;
167 }; 167 };
168 168
169 // Describes a task with extra information such as icon URL. 169 // Describes a task with extra information such as icon URL.
170 class FullTaskDescriptor { 170 class FullTaskDescriptor {
171 public: 171 public:
172 FullTaskDescriptor(const TaskDescriptor& task_descriptor, 172 FullTaskDescriptor(
173 const std::string& task_title, 173 const TaskDescriptor& task_descriptor,
174 const GURL& icon_url, 174 const std::string& task_title,
175 bool is_default, 175 const extensions::api::file_manager_private::Verb& task_verb,
Devlin 2016/05/18 18:49:40 const enum& is a little excessive - just pass by v
cmihail 2016/05/18 22:53:36 Done.
176 bool is_generic_file_handler); 176 const GURL& icon_url,
177 bool is_default,
178 bool is_generic_file_handler);
179
180 ~FullTaskDescriptor();
181
177 FullTaskDescriptor(const FullTaskDescriptor& other); 182 FullTaskDescriptor(const FullTaskDescriptor& other);
178 const TaskDescriptor& task_descriptor() const { return task_descriptor_; } 183 const TaskDescriptor& task_descriptor() const { return task_descriptor_; }
179 184
180 // The title of the task. 185 // The title of the task.
181 const std::string& task_title() const { return task_title_; } 186 const std::string& task_title() const { return task_title_; }
187 // The verb of the task.
188 const extensions::api::file_manager_private::Verb& task_verb() const {
189 return task_verb_;
190 }
182 // The icon URL for the task (ex. app icon) 191 // The icon URL for the task (ex. app icon)
183 const GURL& icon_url() const { return icon_url_; } 192 const GURL& icon_url() const { return icon_url_; }
184 193
185 // True if this task is set as default. 194 // True if this task is set as default.
186 bool is_default() const { return is_default_; } 195 bool is_default() const { return is_default_; }
187 void set_is_default(bool is_default) { is_default_ = is_default; } 196 void set_is_default(bool is_default) { is_default_ = is_default; }
188 197
189 // True if this task is from generic file handler. Generic file handler is a 198 // True if this task is from generic file handler. Generic file handler is a
190 // file handler which handles any type of files (e.g. extensions: ["*"], 199 // file handler which handles any type of files (e.g. extensions: ["*"],
191 // types: ["*/*"]). Partial wild card (e.g. types: ["image/*"]) is not 200 // types: ["*/*"]). Partial wild card (e.g. types: ["image/*"]) is not
192 // generic file handler. 201 // generic file handler.
193 bool is_generic_file_handler() const { return is_generic_file_handler_; } 202 bool is_generic_file_handler() const { return is_generic_file_handler_; }
194 void set_is_generic_file_handler(bool is_generic_file_handler) { 203 void set_is_generic_file_handler(bool is_generic_file_handler) {
195 is_generic_file_handler_ = is_generic_file_handler; 204 is_generic_file_handler_ = is_generic_file_handler;
196 } 205 }
197 206
198 private: 207 private:
199 TaskDescriptor task_descriptor_; 208 TaskDescriptor task_descriptor_;
200 std::string task_title_; 209 std::string task_title_;
210 extensions::api::file_manager_private::Verb task_verb_;
201 GURL icon_url_; 211 GURL icon_url_;
202 bool is_default_; 212 bool is_default_;
203 bool is_generic_file_handler_; 213 bool is_generic_file_handler_;
204 }; 214 };
205 215
206 // Update the default file handler for the given sets of suffixes and MIME 216 // Update the default file handler for the given sets of suffixes and MIME
207 // types. 217 // types.
208 void UpdateDefaultTask(PrefService* pref_service, 218 void UpdateDefaultTask(PrefService* pref_service,
209 const std::string& task_id, 219 const std::string& task_id,
210 const std::set<std::string>& suffixes, 220 const std::set<std::string>& suffixes,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // task is found (i.e. the default task may not exist in |tasks|). No tasks 325 // task is found (i.e. the default task may not exist in |tasks|). No tasks
316 // should be set as default before calling this function. 326 // should be set as default before calling this function.
317 void ChooseAndSetDefaultTask(const PrefService& pref_service, 327 void ChooseAndSetDefaultTask(const PrefService& pref_service,
318 const std::vector<extensions::EntryInfo>& entries, 328 const std::vector<extensions::EntryInfo>& entries,
319 std::vector<FullTaskDescriptor>* tasks); 329 std::vector<FullTaskDescriptor>* tasks);
320 330
321 } // namespace file_tasks 331 } // namespace file_tasks
322 } // namespace file_manager 332 } // namespace file_manager
323 333
324 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ 334 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698