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/file_manager/file_browser_handlers.h" | 5 #include "chrome/browser/chromeos/file_manager/file_browser_handlers.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 const std::vector<FileSystemURL>& file_urls, | 473 const std::vector<FileSystemURL>& file_urls, |
474 const file_tasks::FileTaskFinishedCallback& done) { | 474 const file_tasks::FileTaskFinishedCallback& done) { |
475 // Forbid calling undeclared handlers. | 475 // Forbid calling undeclared handlers. |
476 if (!FindFileBrowserHandlerForActionId(extension, action_id)) | 476 if (!FindFileBrowserHandlerForActionId(extension, action_id)) |
477 return false; | 477 return false; |
478 | 478 |
479 // Some action IDs of the file manager's file browser handlers require the | 479 // Some action IDs of the file manager's file browser handlers require the |
480 // files to be directly opened with the browser. | 480 // files to be directly opened with the browser. |
481 if (ShouldBeOpenedWithBrowser(extension->id(), action_id)) { | 481 if (ShouldBeOpenedWithBrowser(extension->id(), action_id)) { |
482 const bool result = OpenFilesWithBrowser(profile, file_urls); | 482 const bool result = OpenFilesWithBrowser(profile, file_urls); |
483 done.Run(result | 483 if (!done.is_null()) { |
484 ? extensions::api::file_browser_private::TASK_RESULT_OPENED | 484 done.Run(result |
485 : extensions::api::file_browser_private::TASK_RESULT_FAILED); | 485 ? extensions::api::file_browser_private::TASK_RESULT_OPENED |
| 486 : extensions::api::file_browser_private::TASK_RESULT_FAILED); |
| 487 } |
486 return result; | 488 return result; |
487 } | 489 } |
488 | 490 |
489 // The executor object will be self deleted on completion. | 491 // The executor object will be self deleted on completion. |
490 (new FileBrowserHandlerExecutor( | 492 (new FileBrowserHandlerExecutor( |
491 profile, extension, action_id))->Execute(file_urls, done); | 493 profile, extension, action_id))->Execute(file_urls, done); |
492 return true; | 494 return true; |
493 } | 495 } |
494 | 496 |
495 bool IsFallbackFileBrowserHandler(const file_tasks::TaskDescriptor& task) { | 497 bool IsFallbackFileBrowserHandler(const file_tasks::TaskDescriptor& task) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 common_handlers.erase(gallery_iter); | 554 common_handlers.erase(gallery_iter); |
553 else | 555 else |
554 common_handlers.erase(watch_iter); | 556 common_handlers.erase(watch_iter); |
555 } | 557 } |
556 | 558 |
557 return common_handlers; | 559 return common_handlers; |
558 } | 560 } |
559 | 561 |
560 } // namespace file_browser_handlers | 562 } // namespace file_browser_handlers |
561 } // namespace file_manager | 563 } // namespace file_manager |
OLD | NEW |