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 #include "chrome/browser/chromeos/extensions/file_manager/open_util.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/open_util.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // 5. non-default file browser handler | 237 // 5. non-default file browser handler |
238 // Note that there can be at most one of default extension and default app. | 238 // Note that there can be at most one of default extension and default app. |
239 const FileBrowserHandler* handler = | 239 const FileBrowserHandler* handler = |
240 file_browser_handlers::FindFileBrowserHandlerForURLAndPath( | 240 file_browser_handlers::FindFileBrowserHandlerForURLAndPath( |
241 profile, url, file_path); | 241 profile, url, file_path); |
242 if (!handler) { | 242 if (!handler) { |
243 return OpenFileWithFileHandler( | 243 return OpenFileWithFileHandler( |
244 profile, file_path, url, mime_type, default_task_id); | 244 profile, file_path, url, mime_type, default_task_id); |
245 } | 245 } |
246 | 246 |
247 std::string handler_task_id = file_tasks::MakeTaskID( | 247 const file_tasks::TaskDescriptor task_descriptor( |
248 handler->extension_id(), | 248 handler->extension_id(), |
249 file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, | 249 file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, |
250 handler->id()); | 250 handler->id()); |
| 251 const std::string handler_task_id = |
| 252 file_tasks::TaskDescriptorToId(task_descriptor); |
251 if (handler_task_id != default_task_id && | 253 if (handler_task_id != default_task_id && |
252 !file_browser_handlers::IsFallbackFileBrowserHandler(handler) && | 254 !file_browser_handlers::IsFallbackFileBrowserHandler(task_descriptor) && |
253 OpenFileWithFileHandler( | 255 OpenFileWithFileHandler( |
254 profile, file_path, url, mime_type, default_task_id)) { | 256 profile, file_path, url, mime_type, default_task_id)) { |
255 return true; | 257 return true; |
256 } | 258 } |
257 return OpenFileWithFileBrowserHandler(profile, file_path, *handler, url); | 259 return OpenFileWithFileBrowserHandler(profile, file_path, *handler, url); |
258 } | 260 } |
259 | 261 |
260 // Used to implement OpenItem(). | 262 // Used to implement OpenItem(). |
261 void ContinueOpenItem(Profile* profile, | 263 void ContinueOpenItem(Profile* profile, |
262 const base::FilePath& file_path, | 264 const base::FilePath& file_path, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 base::Bind(&ContinueOpenItem, profile, file_path)); | 328 base::Bind(&ContinueOpenItem, profile, file_path)); |
327 } | 329 } |
328 | 330 |
329 void ShowItemInFolder(const base::FilePath& file_path) { | 331 void ShowItemInFolder(const base::FilePath& file_path) { |
330 // This action changes the selection so we do not reuse existing tabs. | 332 // This action changes the selection so we do not reuse existing tabs. |
331 OpenFileManagerWithInternalActionId(file_path, "select"); | 333 OpenFileManagerWithInternalActionId(file_path, "select"); |
332 } | 334 } |
333 | 335 |
334 } // namespace util | 336 } // namespace util |
335 } // namespace file_manager | 337 } // namespace file_manager |
OLD | NEW |