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

Unified Diff: chrome/common/extensions/manifest_handlers/synthesize_browser_action_handler.cc

Issue 324393002: Extension Toolbar redesign, part 1 (overflow) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing gypi change Created 6 years, 6 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
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
« no previous file with comments | « chrome/common/extensions/manifest_handlers/synthesize_browser_action_handler.h ('k') | extensions/common/feature_switch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698