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

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

Issue 44553002: Enabling Commands API for Apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 7 years, 1 month 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 | Annotate | Revision Log
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 "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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 !suggested_key_string.empty()) { 431 !suggested_key_string.empty()) {
432 // If only a single string is provided, it must be default for all. 432 // If only a single string is provided, it must be default for all.
433 suggestions[values::kKeybindingPlatformDefault] = suggested_key_string; 433 suggestions[values::kKeybindingPlatformDefault] = suggested_key_string;
434 } else { 434 } else {
435 suggestions[values::kKeybindingPlatformDefault] = ""; 435 suggestions[values::kKeybindingPlatformDefault] = "";
436 } 436 }
437 } 437 }
438 438
439 // Check if this is a global or a regular shortcut. 439 // Check if this is a global or a regular shortcut.
440 bool global = false; 440 bool global = false;
441 command->GetBoolean(keys::kGlobal, &global); 441 if (FeatureSwitch::global_commands()->IsEnabled() &&
442 chrome::VersionInfo::GetChannel() <= chrome::VersionInfo::CHANNEL_DEV)
Yoyo Zhou 2013/10/30 17:02:48 This channel check should not be necessary. It loo
443 command->GetBoolean(keys::kGlobal, &global);
442 444
443 // Normalize the suggestions. 445 // Normalize the suggestions.
444 for (SuggestionMap::iterator iter = suggestions.begin(); 446 for (SuggestionMap::iterator iter = suggestions.begin();
445 iter != suggestions.end(); ++iter) { 447 iter != suggestions.end(); ++iter) {
446 // Before we normalize Ctrl to Command we must detect when the developer 448 // Before we normalize Ctrl to Command we must detect when the developer
447 // specified Command in the Default section, which will work on Mac after 449 // specified Command in the Default section, which will work on Mac after
448 // normalization but only fail on other platforms when they try it out on 450 // normalization but only fail on other platforms when they try it out on
449 // other platforms, which is not what we want. 451 // other platforms, which is not what we want.
450 if (iter->first == values::kKeybindingPlatformDefault && 452 if (iter->first == values::kKeybindingPlatformDefault &&
451 iter->second.find("Command+") != std::string::npos) { 453 iter->second.find("Command+") != std::string::npos) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 // dev and will be removed when we launch. 538 // dev and will be removed when we launch.
537 static bool stable_or_beta = 539 static bool stable_or_beta =
538 chrome::VersionInfo::GetChannel() >= chrome::VersionInfo::CHANNEL_BETA; 540 chrome::VersionInfo::GetChannel() >= chrome::VersionInfo::CHANNEL_BETA;
539 extension_data->SetBoolean("scope_ui_visible", !stable_or_beta); 541 extension_data->SetBoolean("scope_ui_visible", !stable_or_beta);
540 } 542 }
541 543
542 return extension_data; 544 return extension_data;
543 } 545 }
544 546
545 } // namespace extensions 547 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698