Chromium Code Reviews| 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_tasks.h" | 5 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 496 } | 496 } |
| 497 | 497 |
| 498 for (const auto& entry : handlers_for_entries) { | 498 for (const auto& entry : handlers_for_entries) { |
| 499 const extensions::FileHandlerInfo* handler = entry.second.first; | 499 const extensions::FileHandlerInfo* handler = entry.second.first; |
| 500 std::string task_id = file_tasks::MakeTaskID( | 500 std::string task_id = file_tasks::MakeTaskID( |
| 501 extension->id(), file_tasks::TASK_TYPE_FILE_HANDLER, handler->id); | 501 extension->id(), file_tasks::TASK_TYPE_FILE_HANDLER, handler->id); |
| 502 | 502 |
| 503 GURL best_icon = extensions::ExtensionIconSource::GetIconURL( | 503 GURL best_icon = extensions::ExtensionIconSource::GetIconURL( |
| 504 extension, drive::util::kPreferredIconSize, | 504 extension, drive::util::kPreferredIconSize, |
| 505 ExtensionIconSet::MATCH_BIGGER, | 505 ExtensionIconSet::MATCH_BIGGER, |
| 506 false, // grayscale | 506 false); // grayscale |
| 507 NULL); // exists | |
| 508 | 507 |
| 509 // If file handler doesn't match as good match, regards it as generic file | 508 // If file handler doesn't match as good match, regards it as generic file |
| 510 // handler. | 509 // handler. |
| 511 const bool is_generic_file_handler = | 510 const bool is_generic_file_handler = |
| 512 !IsGoodMatchFileHandler(*handler, entries); | 511 !IsGoodMatchFileHandler(*handler, entries); |
| 513 Verb verb; | 512 Verb verb; |
| 514 if (handler->verb == extensions::file_handler_verbs::kAddTo) { | 513 if (handler->verb == extensions::file_handler_verbs::kAddTo) { |
| 515 verb = Verb::VERB_ADD_TO; | 514 verb = Verb::VERB_ADD_TO; |
| 516 } else if (handler->verb == extensions::file_handler_verbs::kPackWith) { | 515 } else if (handler->verb == extensions::file_handler_verbs::kPackWith) { |
| 517 verb = Verb::VERB_PACK_WITH; | 516 verb = Verb::VERB_PACK_WITH; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 iter != common_tasks.end(); | 551 iter != common_tasks.end(); |
| 553 ++iter) { | 552 ++iter) { |
| 554 const FileBrowserHandler* handler = *iter; | 553 const FileBrowserHandler* handler = *iter; |
| 555 const std::string extension_id = handler->extension_id(); | 554 const std::string extension_id = handler->extension_id(); |
| 556 const Extension* extension = enabled_extensions.GetByID(extension_id); | 555 const Extension* extension = enabled_extensions.GetByID(extension_id); |
| 557 DCHECK(extension); | 556 DCHECK(extension); |
| 558 | 557 |
| 559 // TODO(zelidrag): Figure out how to expose icon URL that task defined in | 558 // TODO(zelidrag): Figure out how to expose icon URL that task defined in |
| 560 // manifest instead of the default extension icon. | 559 // manifest instead of the default extension icon. |
| 561 const GURL icon_url = extensions::ExtensionIconSource::GetIconURL( | 560 const GURL icon_url = extensions::ExtensionIconSource::GetIconURL( |
| 562 extension, | 561 extension, extension_misc::EXTENSION_ICON_BITTY, |
| 563 extension_misc::EXTENSION_ICON_BITTY, | |
| 564 ExtensionIconSet::MATCH_BIGGER, | 562 ExtensionIconSet::MATCH_BIGGER, |
| 565 false, // grayscale | 563 false); // exists |
|
Devlin
2016/12/16 19:54:54
s/exists/grayscale
Evan Stade
2016/12/16 21:37:04
Done.
| |
| 566 NULL); // exists | |
| 567 | 564 |
| 568 result_list->push_back(FullTaskDescriptor( | 565 result_list->push_back(FullTaskDescriptor( |
| 569 TaskDescriptor(extension_id, file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, | 566 TaskDescriptor(extension_id, file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, |
| 570 handler->id()), | 567 handler->id()), |
| 571 handler->title(), Verb::VERB_NONE /* no verb for FileBrowserHandler */, | 568 handler->title(), Verb::VERB_NONE /* no verb for FileBrowserHandler */, |
| 572 icon_url, false /* is_default */, false /* is_generic_file_handler */)); | 569 icon_url, false /* is_default */, false /* is_generic_file_handler */)); |
| 573 } | 570 } |
| 574 } | 571 } |
| 575 | 572 |
| 576 void FindExtensionAndAppTasks( | 573 void FindExtensionAndAppTasks( |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 DCHECK(!task->is_default()); | 640 DCHECK(!task->is_default()); |
| 644 if (IsFallbackFileHandler(task->task_descriptor())) { | 641 if (IsFallbackFileHandler(task->task_descriptor())) { |
| 645 task->set_is_default(true); | 642 task->set_is_default(true); |
| 646 return; | 643 return; |
| 647 } | 644 } |
| 648 } | 645 } |
| 649 } | 646 } |
| 650 | 647 |
| 651 } // namespace file_tasks | 648 } // namespace file_tasks |
| 652 } // namespace file_manager | 649 } // namespace file_manager |
| OLD | NEW |