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 34cc9b89c0c16da2bc1dff4e0d007a55afe55585..88cc18f00cf7ee432b32e49f0579418bcd993dd6 100644 |
| --- a/chrome/browser/chromeos/note_taking_helper.cc |
| +++ b/chrome/browser/chromeos/note_taking_helper.cc |
| @@ -32,6 +32,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; |
| @@ -70,6 +71,7 @@ arc::mojom::IntentInfoPtr CreateIntentInfo(const GURL& clip_data_uri) { |
| } // namespace |
| +const char NoteTakingHelper::kChromeNewNoteAction[] = "new_note"; |
| const char NoteTakingHelper::kIntentAction[] = |
| "org.chromium.arc.intent.action.CREATE_NOTE"; |
| const char NoteTakingHelper::kDevKeepExtensionId[] = |
| @@ -254,8 +256,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)) { |
| @@ -263,6 +263,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( |
|
Devlin
2017/01/09 23:39:02
This shouldn't be handled here. Instead, we shoul
jdufault
2017/01/12 22:22:24
Done.
|
| + 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 == kChromeNewNoteAction) |
| + extensions.push_back(extension.get()); |
| + } |
| + } |
| + |
| return extensions; |
| } |