OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command.h" | 5 #include "chrome/common/extensions/command.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/string_piece.h" |
11 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
15 #include "extensions/common/error_utils.h" | 16 #include "extensions/common/error_utils.h" |
16 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
17 #include "extensions/common/manifest_constants.h" | 18 #include "extensions/common/manifest_constants.h" |
18 | 19 |
19 namespace extensions { | 20 namespace extensions { |
20 | 21 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 normalize = true; | 257 normalize = true; |
257 } else if (platform == values::kKeybindingPlatformDefault) { | 258 } else if (platform == values::kKeybindingPlatformDefault) { |
258 #if defined(OS_MACOSX) | 259 #if defined(OS_MACOSX) |
259 normalize = true; | 260 normalize = true; |
260 #endif | 261 #endif |
261 } | 262 } |
262 | 263 |
263 if (!normalize) | 264 if (!normalize) |
264 return suggestion; | 265 return suggestion; |
265 | 266 |
266 std::vector<std::string> tokens = base::SplitString( | 267 std::vector<base::StringPiece> tokens = base::SplitStringPiece( |
267 suggestion, "+", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 268 suggestion, "+", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
268 for (size_t i = 0; i < tokens.size(); i++) { | 269 for (size_t i = 0; i < tokens.size(); i++) { |
269 if (tokens[i] == values::kKeyCtrl) | 270 if (tokens[i] == values::kKeyCtrl) |
270 tokens[i] = values::kKeyCommand; | 271 tokens[i] = values::kKeyCommand; |
271 else if (tokens[i] == values::kKeyMacCtrl) | 272 else if (tokens[i] == values::kKeyMacCtrl) |
272 tokens[i] = values::kKeyCtrl; | 273 tokens[i] = values::kKeyCtrl; |
273 } | 274 } |
274 return base::JoinString(tokens, "+"); | 275 return base::JoinString(tokens, "+"); |
275 } | 276 } |
276 | 277 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 accelerator_ = accelerator; | 548 accelerator_ = accelerator; |
548 command_name_ = command_name; | 549 command_name_ = command_name; |
549 description_ = description; | 550 description_ = description; |
550 global_ = global; | 551 global_ = global; |
551 } | 552 } |
552 } | 553 } |
553 return true; | 554 return true; |
554 } | 555 } |
555 | 556 |
556 } // namespace extensions | 557 } // namespace extensions |
OLD | NEW |