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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 case ui::VKEY_MEDIA_STOP: | 373 case ui::VKEY_MEDIA_STOP: |
374 shortcut += values::kKeyMediaStop; | 374 shortcut += values::kKeyMediaStop; |
375 break; | 375 break; |
376 default: | 376 default: |
377 return ""; | 377 return ""; |
378 } | 378 } |
379 } | 379 } |
380 return shortcut; | 380 return shortcut; |
381 } | 381 } |
382 | 382 |
| 383 // static |
| 384 bool Command::IsMediaKey(const ui::Accelerator& accelerator) { |
| 385 if (accelerator.modifiers() != 0) |
| 386 return false; |
| 387 |
| 388 return (accelerator.key_code() == ui::VKEY_MEDIA_NEXT_TRACK || |
| 389 accelerator.key_code() == ui::VKEY_MEDIA_PREV_TRACK || |
| 390 accelerator.key_code() == ui::VKEY_MEDIA_PLAY_PAUSE || |
| 391 accelerator.key_code() == ui::VKEY_MEDIA_STOP); |
| 392 } |
| 393 |
383 bool Command::Parse(const base::DictionaryValue* command, | 394 bool Command::Parse(const base::DictionaryValue* command, |
384 const std::string& command_name, | 395 const std::string& command_name, |
385 int index, | 396 int index, |
386 base::string16* error) { | 397 base::string16* error) { |
387 DCHECK(!command_name.empty()); | 398 DCHECK(!command_name.empty()); |
388 | 399 |
389 base::string16 description; | 400 base::string16 description; |
390 if (IsNamedCommand(command_name)) { | 401 if (IsNamedCommand(command_name)) { |
391 if (!command->GetString(keys::kDescription, &description) || | 402 if (!command->GetString(keys::kDescription, &description) || |
392 description.empty()) { | 403 description.empty()) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // dev and will be removed when we launch. | 547 // dev and will be removed when we launch. |
537 static bool stable_or_beta = | 548 static bool stable_or_beta = |
538 chrome::VersionInfo::GetChannel() >= chrome::VersionInfo::CHANNEL_BETA; | 549 chrome::VersionInfo::GetChannel() >= chrome::VersionInfo::CHANNEL_BETA; |
539 extension_data->SetBoolean("scope_ui_visible", !stable_or_beta); | 550 extension_data->SetBoolean("scope_ui_visible", !stable_or_beta); |
540 } | 551 } |
541 | 552 |
542 return extension_data; | 553 return extension_data; |
543 } | 554 } |
544 | 555 |
545 } // namespace extensions | 556 } // namespace extensions |
OLD | NEW |