Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1184)

Unified Diff: chrome/browser/chromeos/note_taking_helper.cc

Issue 2618493002: Chrome app manifest support for action handlers. (Closed)
Patch Set: Initial upload Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/note_taking_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | chrome/browser/chromeos/note_taking_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698