| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/ptr_util.h" |
| 13 #include "chrome/browser/chromeos/drive/file_system_util.h" | 14 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 14 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 15 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 15 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 16 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| 16 #include "chrome/browser/extensions/api/file_handlers/directory_util.h" | 17 #include "chrome/browser/extensions/api/file_handlers/directory_util.h" |
| 17 #include "chrome/browser/extensions/api/file_handlers/mime_util.h" | 18 #include "chrome/browser/extensions/api/file_handlers/mime_util.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/common/extensions/api/file_manager_private.h" | 20 #include "chrome/common/extensions/api/file_manager_private.h" |
| 20 #include "chrome/common/extensions/api/file_manager_private_internal.h" | 21 #include "chrome/common/extensions/api/file_manager_private_internal.h" |
| 21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 22 #include "extensions/browser/entry_info.h" | 23 #include "extensions/browser/entry_info.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 const std::set<std::string> mime_types = | 229 const std::set<std::string> mime_types = |
| 229 GetUniqueMimeTypes(params->mime_types); | 230 GetUniqueMimeTypes(params->mime_types); |
| 230 | 231 |
| 231 // If there weren't any mime_types, and all the suffixes were blank, | 232 // If there weren't any mime_types, and all the suffixes were blank, |
| 232 // then we "succeed", but don't actually associate with anything. | 233 // then we "succeed", but don't actually associate with anything. |
| 233 // Otherwise, any time we set the default on a file with no extension | 234 // Otherwise, any time we set the default on a file with no extension |
| 234 // on the local drive, we'd fail. | 235 // on the local drive, we'd fail. |
| 235 // TODO(gspencer): Fix file manager so that it never tries to set default in | 236 // TODO(gspencer): Fix file manager so that it never tries to set default in |
| 236 // cases where extensionless local files are part of the selection. | 237 // cases where extensionless local files are part of the selection. |
| 237 if (suffixes.empty() && mime_types.empty()) { | 238 if (suffixes.empty() && mime_types.empty()) { |
| 238 SetResult(new base::FundamentalValue(true)); | 239 SetResult(base::MakeUnique<base::FundamentalValue>(true)); |
| 239 return true; | 240 return true; |
| 240 } | 241 } |
| 241 | 242 |
| 242 file_manager::file_tasks::UpdateDefaultTask( | 243 file_manager::file_tasks::UpdateDefaultTask( |
| 243 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types); | 244 GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types); |
| 244 return true; | 245 return true; |
| 245 } | 246 } |
| 246 | 247 |
| 247 } // namespace extensions | 248 } // namespace extensions |
| OLD | NEW |