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

Side by Side Diff: chrome/common/extensions/api/commands/commands_handler.cc

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/api/commands/commands_handler.h" 5 #include "chrome/common/extensions/api/commands/commands_handler.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/extensions/extension_manifest_constants.h" 10 #include "chrome/common/extensions/extension_manifest_constants.h"
11 #include "chrome/common/extensions/manifest.h"
12 #include "extensions/common/error_utils.h" 11 #include "extensions/common/error_utils.h"
13 12
14 namespace keys = extension_manifest_keys; 13 namespace keys = extension_manifest_keys;
15 14
16 namespace extensions { 15 namespace extensions {
17 16
18 namespace { 17 namespace {
19 // The maximum number of commands (including page action/browser actions) an 18 // The maximum number of commands (including page action/browser actions) an
20 // extension can have. 19 // extension can have.
21 const size_t kMaxCommandsPerExtension = 4; 20 const size_t kMaxCommandsPerExtension = 4;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 117 }
119 } 118 }
120 119
121 MaybeSetBrowserActionDefault(extension, commands_info.get()); 120 MaybeSetBrowserActionDefault(extension, commands_info.get());
122 121
123 extension->SetManifestData(keys::kCommands, 122 extension->SetManifestData(keys::kCommands,
124 commands_info.release()); 123 commands_info.release());
125 return true; 124 return true;
126 } 125 }
127 126
128 bool CommandsHandler::AlwaysParseForType(Extension::Type type) { 127 bool CommandsHandler::AlwaysParseForType(Manifest::Type type) {
129 return type == Extension::TYPE_EXTENSION || 128 return type == Manifest::TYPE_EXTENSION ||
130 type == Extension::TYPE_LEGACY_PACKAGED_APP || 129 type == Manifest::TYPE_LEGACY_PACKAGED_APP ||
131 type == Extension::TYPE_PLATFORM_APP; 130 type == Manifest::TYPE_PLATFORM_APP;
132 } 131 }
133 132
134 void CommandsHandler::MaybeSetBrowserActionDefault(const Extension* extension, 133 void CommandsHandler::MaybeSetBrowserActionDefault(const Extension* extension,
135 CommandsInfo* info) { 134 CommandsInfo* info) {
136 if (extension->manifest()->HasKey(keys::kBrowserAction) && 135 if (extension->manifest()->HasKey(keys::kBrowserAction) &&
137 !info->browser_action_command.get()) { 136 !info->browser_action_command.get()) {
138 info->browser_action_command.reset(new Command( 137 info->browser_action_command.reset(new Command(
139 extension_manifest_values::kBrowserActionCommandEvent, string16(), "")); 138 extension_manifest_values::kBrowserActionCommandEvent, string16(), ""));
140 } 139 }
141 } 140 }
142 141
143 } // namespace extensions 142 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698