Index: chrome/common/extensions/manifest_handlers/synthesize_browser_action_handler.cc |
diff --git a/chrome/common/extensions/manifest_handlers/synthesize_browser_action_handler.cc b/chrome/common/extensions/manifest_handlers/synthesize_browser_action_handler.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c824c9fa81661871ab8616744d8dc964cc277bc8 |
--- /dev/null |
+++ b/chrome/common/extensions/manifest_handlers/synthesize_browser_action_handler.cc |
@@ -0,0 +1,49 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/common/extensions/manifest_handlers/synthesize_browser_action_handler.h" |
+ |
+#include "chrome/common/extensions/api/extension_action/action_info.h" |
+#include "extensions/common/feature_switch.h" |
+#include "extensions/common/manifest_constants.h" |
+ |
+namespace extensions { |
+ |
+SynthesizeBrowserActionHandler::SynthesizeBrowserActionHandler() { |
+} |
+ |
+SynthesizeBrowserActionHandler::~SynthesizeBrowserActionHandler() { |
+} |
+ |
+bool SynthesizeBrowserActionHandler::Parse(Extension* extension, |
+ base::string16* error) { |
+ if (!extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) |
+ return true; // Do nothing. |
+ |
+ if (extension->location() == Manifest::COMPONENT || |
+ extension->location() == Manifest::EXTERNAL_COMPONENT) |
+ return true; // Return no error (we're done). |
+ |
+ if (extension->manifest()->HasKey(manifest_keys::kSynthesizeBrowserAction)) |
+ return false; // This key is reserved, no extension should be using it. |
+ |
+ // TODO(devlin): Make sure we don't have two icons showing for page action |
+ // extensions if we show page action icons in the browser action |
+ // toolbar. |
+ if (!extension->manifest()->HasKey(manifest_keys::kBrowserAction)) |
+ ActionInfo::SetBrowserActionInfo(extension, new ActionInfo()); |
+ |
+ return true; |
+} |
+ |
+bool SynthesizeBrowserActionHandler::AlwaysParseForType( |
+ Manifest::Type type) const { |
+ return type == Manifest::TYPE_EXTENSION; |
+} |
+ |
+const std::vector<std::string> SynthesizeBrowserActionHandler::Keys() const { |
+ return SingleKey(manifest_keys::kSynthesizeBrowserAction); |
+} |
+ |
+} // namespace extensions |