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

Side by Side Diff: chrome/common/extensions/manifest_handlers/extension_action_handler.cc

Issue 2921473002: [Extensions] Remove the extension_action_redesign switch (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | extensions/common/feature_switch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/extensions/manifest_handlers/extension_action_handler.h" 5 #include "chrome/common/extensions/manifest_handlers/extension_action_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/common/extensions/api/extension_action/action_info.h" 12 #include "chrome/common/extensions/api/extension_action/action_info.h"
13 #include "chrome/common/extensions/extension_constants.h" 13 #include "chrome/common/extensions/extension_constants.h"
14 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
15 #include "extensions/common/extension.h" 15 #include "extensions/common/extension.h"
16 #include "extensions/common/feature_switch.h"
17 #include "extensions/common/file_util.h" 16 #include "extensions/common/file_util.h"
18 #include "extensions/common/manifest_constants.h" 17 #include "extensions/common/manifest_constants.h"
19 18
20 namespace extensions { 19 namespace extensions {
21 20
22 ExtensionActionHandler::ExtensionActionHandler() { 21 ExtensionActionHandler::ExtensionActionHandler() {
23 } 22 }
24 23
25 ExtensionActionHandler::~ExtensionActionHandler() { 24 ExtensionActionHandler::~ExtensionActionHandler() {
26 } 25 }
(...skipping 27 matching lines...) Expand all
54 std::unique_ptr<ActionInfo> action_info = 53 std::unique_ptr<ActionInfo> action_info =
55 ActionInfo::Load(extension, dict, error); 54 ActionInfo::Load(extension, dict, error);
56 if (!action_info) 55 if (!action_info)
57 return false; // Failed to parse extension action definition. 56 return false; // Failed to parse extension action definition.
58 57
59 if (key == manifest_keys::kPageAction) 58 if (key == manifest_keys::kPageAction)
60 ActionInfo::SetPageActionInfo(extension, action_info.release()); 59 ActionInfo::SetPageActionInfo(extension, action_info.release());
61 else 60 else
62 ActionInfo::SetBrowserActionInfo(extension, action_info.release()); 61 ActionInfo::SetBrowserActionInfo(extension, action_info.release());
63 } else { // No key, used for synthesizing an action for extensions with none. 62 } else { // No key, used for synthesizing an action for extensions with none.
64 if (!FeatureSwitch::extension_action_redesign()->IsEnabled())
65 return true; // Do nothing if the switch is off.
66 if (Manifest::IsComponentLocation(extension->location())) 63 if (Manifest::IsComponentLocation(extension->location()))
67 return true; // Don't synthesize actions for component extensions. 64 return true; // Don't synthesize actions for component extensions.
68 if (extension->was_installed_by_default()) 65 if (extension->was_installed_by_default())
69 return true; // Don't synthesize actions for default extensions. 66 return true; // Don't synthesize actions for default extensions.
70 if (extension->manifest()->HasKey( 67 if (extension->manifest()->HasKey(
71 manifest_keys::kSynthesizeExtensionAction)) { 68 manifest_keys::kSynthesizeExtensionAction)) {
72 *error = base::ASCIIToUTF16(base::StringPrintf( 69 *error = base::ASCIIToUTF16(base::StringPrintf(
73 "Key %s is reserved.", manifest_keys::kSynthesizeExtensionAction)); 70 "Key %s is reserved.", manifest_keys::kSynthesizeExtensionAction));
74 return false; // No one should use this key. 71 return false; // No one should use this key.
75 } 72 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 108
112 const std::vector<std::string> ExtensionActionHandler::Keys() const { 109 const std::vector<std::string> ExtensionActionHandler::Keys() const {
113 std::vector<std::string> keys; 110 std::vector<std::string> keys;
114 keys.push_back(manifest_keys::kPageAction); 111 keys.push_back(manifest_keys::kPageAction);
115 keys.push_back(manifest_keys::kBrowserAction); 112 keys.push_back(manifest_keys::kBrowserAction);
116 keys.push_back(manifest_keys::kSynthesizeExtensionAction); 113 keys.push_back(manifest_keys::kSynthesizeExtensionAction);
117 return keys; 114 return keys;
118 } 115 }
119 116
120 } // namespace extensions 117 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/common/feature_switch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698