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

Side by Side Diff: chrome/common/extensions/command.cc

Issue 1878083002: Implement IsAsciiUpper and IsAsciiLower in base/strings/string_util.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git sync Created 4 years, 8 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
OLDNEW
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"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 key = ui::VKEY_MEDIA_NEXT_TRACK; 187 key = ui::VKEY_MEDIA_NEXT_TRACK;
188 } else if (tokens[i] == values::kKeyMediaPlayPause && 188 } else if (tokens[i] == values::kKeyMediaPlayPause &&
189 should_parse_media_keys) { 189 should_parse_media_keys) {
190 key = ui::VKEY_MEDIA_PLAY_PAUSE; 190 key = ui::VKEY_MEDIA_PLAY_PAUSE;
191 } else if (tokens[i] == values::kKeyMediaPrevTrack && 191 } else if (tokens[i] == values::kKeyMediaPrevTrack &&
192 should_parse_media_keys) { 192 should_parse_media_keys) {
193 key = ui::VKEY_MEDIA_PREV_TRACK; 193 key = ui::VKEY_MEDIA_PREV_TRACK;
194 } else if (tokens[i] == values::kKeyMediaStop && 194 } else if (tokens[i] == values::kKeyMediaStop &&
195 should_parse_media_keys) { 195 should_parse_media_keys) {
196 key = ui::VKEY_MEDIA_STOP; 196 key = ui::VKEY_MEDIA_STOP;
197 } else if (tokens[i].size() == 1 && 197 } else if (tokens[i].size() == 1 && base::IsAsciiUpper(tokens[i][0])) {
198 tokens[i][0] >= 'A' && tokens[i][0] <= 'Z') {
199 key = static_cast<ui::KeyboardCode>(ui::VKEY_A + (tokens[i][0] - 'A')); 198 key = static_cast<ui::KeyboardCode>(ui::VKEY_A + (tokens[i][0] - 'A'));
200 } else if (tokens[i].size() == 1 && 199 } else if (tokens[i].size() == 1 && base::IsAsciiDigit(tokens[i][0])) {
201 tokens[i][0] >= '0' && tokens[i][0] <= '9') {
202 key = static_cast<ui::KeyboardCode>(ui::VKEY_0 + (tokens[i][0] - '0')); 200 key = static_cast<ui::KeyboardCode>(ui::VKEY_0 + (tokens[i][0] - '0'));
203 } else { 201 } else {
204 key = ui::VKEY_UNKNOWN; 202 key = ui::VKEY_UNKNOWN;
205 break; 203 break;
206 } 204 }
207 } else { 205 } else {
208 *error = ErrorUtils::FormatErrorMessageUTF16( 206 *error = ErrorUtils::FormatErrorMessageUTF16(
209 errors::kInvalidKeyBinding, 207 errors::kInvalidKeyBinding,
210 base::IntToString(index), 208 base::IntToString(index),
211 platform_key, 209 platform_key,
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 accelerator_ = accelerator; 549 accelerator_ = accelerator;
552 command_name_ = command_name; 550 command_name_ = command_name;
553 description_ = description; 551 description_ = description;
554 global_ = global; 552 global_ = global;
555 } 553 }
556 } 554 }
557 return true; 555 return true;
558 } 556 }
559 557
560 } // namespace extensions 558 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698