| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/drive/file_system_util.h" | 7 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 8 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 8 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
| 9 #include "chrome/browser/chromeos/file_manager/file_tasks.h" | 9 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
| 10 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 10 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 suffixes.insert(url.path().Extension()); | 40 suffixes.insert(url.path().Extension()); |
| 41 } | 41 } |
| 42 return suffixes; | 42 return suffixes; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Make a set of unique MIME types out of the list of MIME types. | 45 // Make a set of unique MIME types out of the list of MIME types. |
| 46 std::set<std::string> GetUniqueMimeTypes( | 46 std::set<std::string> GetUniqueMimeTypes( |
| 47 const std::vector<std::string>& mime_type_list) { | 47 const std::vector<std::string>& mime_type_list) { |
| 48 std::set<std::string> mime_types; | 48 std::set<std::string> mime_types; |
| 49 for (size_t i = 0; i < mime_type_list.size(); ++i) { | 49 for (size_t i = 0; i < mime_type_list.size(); ++i) { |
| 50 std::string mime_type; | 50 const std::string mime_type = mime_type_list[i]; |
| 51 // We'll skip empty MIME types. | 51 // We'll skip empty MIME types and existing MIME types. |
| 52 if (!mime_type.empty()) | 52 if (!mime_type.empty()) |
| 53 mime_types.insert(mime_type); | 53 mime_types.insert(mime_type); |
| 54 } | 54 } |
| 55 return mime_types; | 55 return mime_types; |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 bool FileBrowserPrivateExecuteTaskFunction::RunImpl() { | 60 bool FileBrowserPrivateExecuteTaskFunction::RunImpl() { |
| 61 using extensions::api::file_browser_private::ExecuteTask::Params; | 61 using extensions::api::file_browser_private::ExecuteTask::Params; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 SetResult(new base::FundamentalValue(true)); | 203 SetResult(new base::FundamentalValue(true)); |
| 204 return true; | 204 return true; |
| 205 } | 205 } |
| 206 | 206 |
| 207 file_manager::file_tasks::UpdateDefaultTask( | 207 file_manager::file_tasks::UpdateDefaultTask( |
| 208 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types); | 208 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types); |
| 209 return true; | 209 return true; |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace extensions | 212 } // namespace extensions |
| OLD | NEW |