| OLD | NEW |
| 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/strings/string_number_conversions.h" | 7 #include "base/strings/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" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 MaybeSetBrowserActionDefault(extension, commands_info.get()); | 120 MaybeSetBrowserActionDefault(extension, commands_info.get()); |
| 121 | 121 |
| 122 extension->SetManifestData(keys::kCommands, | 122 extension->SetManifestData(keys::kCommands, |
| 123 commands_info.release()); | 123 commands_info.release()); |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool CommandsHandler::AlwaysParseForType(Manifest::Type type) { | 127 bool CommandsHandler::AlwaysParseForType(Manifest::Type type) const { |
| 128 return type == Manifest::TYPE_EXTENSION || | 128 return type == Manifest::TYPE_EXTENSION || |
| 129 type == Manifest::TYPE_LEGACY_PACKAGED_APP || | 129 type == Manifest::TYPE_LEGACY_PACKAGED_APP || |
| 130 type == Manifest::TYPE_PLATFORM_APP; | 130 type == Manifest::TYPE_PLATFORM_APP; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void CommandsHandler::MaybeSetBrowserActionDefault(const Extension* extension, | 133 void CommandsHandler::MaybeSetBrowserActionDefault(const Extension* extension, |
| 134 CommandsInfo* info) { | 134 CommandsInfo* info) { |
| 135 if (extension->manifest()->HasKey(keys::kBrowserAction) && | 135 if (extension->manifest()->HasKey(keys::kBrowserAction) && |
| 136 !info->browser_action_command.get()) { | 136 !info->browser_action_command.get()) { |
| 137 info->browser_action_command.reset(new Command( | 137 info->browser_action_command.reset(new Command( |
| 138 extension_manifest_values::kBrowserActionCommandEvent, string16(), "")); | 138 extension_manifest_values::kBrowserActionCommandEvent, string16(), "")); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 const std::vector<std::string> CommandsHandler::Keys() const { |
| 143 return SingleKey(keys::kCommands); |
| 144 } |
| 145 |
| 142 } // namespace extensions | 146 } // namespace extensions |
| OLD | NEW |