Chromium Code Reviews| Index: chrome/browser/chromeos/note_taking_helper.cc |
| diff --git a/chrome/browser/chromeos/note_taking_helper.cc b/chrome/browser/chromeos/note_taking_helper.cc |
| index 273d740760b1246f5b93910205fb4d01b4d60a4d..14090587c59c3cd86722a0a13e82cda074d6f472 100644 |
| --- a/chrome/browser/chromeos/note_taking_helper.cc |
| +++ b/chrome/browser/chromeos/note_taking_helper.cc |
| @@ -31,6 +31,7 @@ |
| #include "extensions/browser/extension_registry.h" |
| #include "extensions/common/api/app_runtime.h" |
| #include "extensions/common/extension.h" |
| +#include "extensions/common/manifest_constants.h" |
| #include "url/gurl.h" |
| namespace app_runtime = extensions::api::app_runtime; |
| @@ -38,6 +39,8 @@ namespace app_runtime = extensions::api::app_runtime; |
| namespace chromeos { |
| namespace { |
| +constexpr const char kNewNoteAction[] = "new_note"; |
|
Daniel Erat
2017/01/06 21:01:45
nit: mind renaming this to kChromeNewNoteAction or
Daniel Erat
2017/01/06 21:02:33
oh, and i'd also recommend making it a public stat
jdufault
2017/01/12 22:22:24
Done.
|
| + |
| // Pointer to singleton instance. |
| NoteTakingHelper* g_helper = nullptr; |
| @@ -263,8 +266,6 @@ std::vector<const extensions::Extension*> NoteTakingHelper::GetChromeApps( |
| const extensions::ExtensionSet& enabled_extensions = |
| extension_registry->enabled_extensions(); |
| - // TODO(derat): Query for additional Chrome apps once http://crbug.com/657139 |
| - // is resolved. |
| std::vector<const extensions::Extension*> extensions; |
| for (const auto& id : whitelisted_chrome_app_ids_) { |
| if (enabled_extensions.Contains(id)) { |
| @@ -272,6 +273,28 @@ std::vector<const extensions::Extension*> NoteTakingHelper::GetChromeApps( |
| id, extensions::ExtensionRegistry::ENABLED)); |
| } |
| } |
| + |
| + // Add any extensions which have a "note" action in their manifest |
| + // "action_handler" entry. |
| + for (const auto& extension : enabled_extensions) { |
| + // Find "action_handler" manifest entry. |
| + const base::ListValue* action_handlers; |
| + if (!extension->manifest()->GetList( |
| + extensions::manifest_keys::kActionHandlers, &action_handlers)) { |
| + continue; |
| + } |
| + |
| + // Check for "new_note" action. |
| + for (const auto& wrapped_action_handler : *action_handlers) { |
| + std::string action_handler; |
| + if (!wrapped_action_handler->GetAsString(&action_handler)) |
| + continue; |
| + |
| + if (action_handler == kNewNoteAction) |
| + extensions.push_back(extension.get()); |
| + } |
| + } |
| + |
| return extensions; |
| } |