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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 std::string command_name = binding->command_name(); | 113 std::string command_name = binding->command_name(); |
114 if (command_name == manifest_values::kBrowserActionCommandEvent) { | 114 if (command_name == manifest_values::kBrowserActionCommandEvent) { |
115 commands_info->browser_action_command.reset(binding.release()); | 115 commands_info->browser_action_command.reset(binding.release()); |
116 } else if (command_name == | 116 } else if (command_name == |
117 manifest_values::kPageActionCommandEvent) { | 117 manifest_values::kPageActionCommandEvent) { |
118 commands_info->page_action_command.reset(binding.release()); | 118 commands_info->page_action_command.reset(binding.release()); |
119 } else { | 119 } else { |
120 if (command_name[0] != '_') // All commands w/underscore are reserved. | 120 if (command_name[0] != '_') // All commands w/underscore are reserved. |
121 commands_info->named_commands[command_name] = *binding.get(); | 121 commands_info->named_commands[command_name] = *binding; |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 MaybeSetBrowserActionDefault(extension, commands_info.get()); | 125 MaybeSetBrowserActionDefault(extension, commands_info.get()); |
126 | 126 |
127 extension->SetManifestData(keys::kCommands, | 127 extension->SetManifestData(keys::kCommands, |
128 commands_info.release()); | 128 commands_info.release()); |
129 return true; | 129 return true; |
130 } | 130 } |
131 | 131 |
(...skipping 13 matching lines...) Expand all Loading... |
145 std::string(), | 145 std::string(), |
146 false)); | 146 false)); |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 const std::vector<std::string> CommandsHandler::Keys() const { | 150 const std::vector<std::string> CommandsHandler::Keys() const { |
151 return SingleKey(keys::kCommands); | 151 return SingleKey(keys::kCommands); |
152 } | 152 } |
153 | 153 |
154 } // namespace extensions | 154 } // namespace extensions |
OLD | NEW |