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

Unified Diff: chrome/browser/extensions/api/commands/command_service.cc

Issue 60353008: Mac global keybindings (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/commands/command_service.cc
===================================================================
--- chrome/browser/extensions/api/commands/command_service.cc (revision 232310)
+++ chrome/browser/extensions/api/commands/command_service.cc (working copy)
@@ -155,6 +155,7 @@
if (!commands)
return false;
+ VLOG(0) << "Commands size: " << commands->size();
extensions::CommandMap::const_iterator iter = commands->begin();
for (; iter != commands->end(); ++iter) {
// Look up to see if the user has overridden how the command should work.
@@ -162,18 +163,34 @@
FindCommandByName(extension_id, iter->second.command_name());
ui::Accelerator shortcut_assigned = saved_command.accelerator();
- if (type == ACTIVE_ONLY && shortcut_assigned.key_code() == ui::VKEY_UNKNOWN)
+ VLOG(0) << "Processing command: " << iter->second.command_name()
+ << ", shortcut assigned: " << shortcut_assigned.key_code()
+ << ", saved command global: " << saved_command.global();
+
+ if (type == ACTIVE_ONLY && shortcut_assigned.key_code() ==
+ ui::VKEY_UNKNOWN) {
+ VLOG(0) << "Discarded due to missing key code";
continue;
+ }
extensions::Command command = iter->second;
- if (scope != ANY_SCOPE && ((scope == GLOBAL) != saved_command.global()))
+ if (scope != ANY_SCOPE &&
+ ((scope == GLOBAL) != saved_command.global())) {
+ VLOG(0) << "Discarded due to scope mismatch";
continue;
+ }
+ VLOG(0) << "HERE";
if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN)
command.set_accelerator(shortcut_assigned);
command.set_global(saved_command.global());
+ VLOG(0) << "Adding command " << iter->second.command_name()
+ << " to command map, scope is " << scope;
+
+ VLOG(0) << "Size before: " << (*command_map).size();
(*command_map)[iter->second.command_name()] = command;
+ VLOG(0) << "Size after: " << (*command_map).size();
}
return true;
@@ -188,6 +205,9 @@
if (accelerator.key_code() == ui::VKEY_UNKNOWN)
return false;
+ VLOG(0) << "AddKeybindingPref, "
+ << "Global: " << global
+ << "Command name: " << command_name;
DictionaryPrefUpdate updater(profile_->GetPrefs(),
prefs::kExtensionCommands);
base::DictionaryValue* bindings = updater.Get();
@@ -267,6 +287,7 @@
Command CommandService::FindCommandByName(
const std::string& extension_id, const std::string& command) {
+ VLOG(0) << "FindCommandByName called.";
const base::DictionaryValue* bindings =
profile_->GetPrefs()->GetDictionary(prefs::kExtensionCommands);
for (base::DictionaryValue::Iterator it(*bindings); !it.IsAtEnd();
@@ -276,15 +297,21 @@
std::string extension;
item->GetString(kExtension, &extension);
+ VLOG(0) << "Extension: " << extension;
if (extension != extension_id)
continue;
std::string command_name;
item->GetString(kCommandName, &command_name);
+ VLOG(0) << "Command name: " << command_name;
if (command != command_name)
continue;
bool global = false;
- if (FeatureSwitch::global_commands()->IsEnabled())
+ VLOG(0) << "--global-commands: "
+ << FeatureSwitch::global_commands()->IsEnabled();
+ if (FeatureSwitch::global_commands()->IsEnabled()) {
item->GetBoolean(kGlobal, &global);
+ VLOG(0) << "Global: " << global;
+ }
std::string shortcut = it.key();
if (StartsWithASCII(shortcut, Command::CommandPlatform() + ":", true))
@@ -319,6 +346,8 @@
iter->second.command_name(),
false, // Overwriting not allowed.
iter->second.global());
+ LOG(ERROR) << "CommandService::AssignInitialKeybindings. "
+ << "global: " << iter->second.global();
}
}

Powered by Google App Engine
This is Rietveld 408576698