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

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

Issue 667833004: Fix extension command service to check if user has modified key before overwrite on update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/commands/command_service.cc
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index 3fd21e6a724e087da8265b2c2ab77eeead9164f5..241d2379a4c9ef0bc0d3d67e85d21269c51d6322 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -351,6 +351,7 @@ Command CommandService::FindCommandByName(const std::string& extension_id,
std::string extension;
item->GetString(kExtension, &extension);
+
Finnur 2014/10/22 09:43:03 nit: This line break seems to be breaking up code
if (extension != extension_id)
continue;
std::string command_name;
@@ -550,9 +551,14 @@ void CommandService::AssignKeybindings(const Extension* extension) {
bool CommandService::CanAutoAssign(const Command &command,
const Extension* extension) {
- // Media Keys are non-exclusive, so allow auto-assigning them.
- if (Command::IsMediaKey(command.accelerator()))
+
Finnur 2014/10/22 09:43:03 Don't add line breaks at the start of a function.
+ // Media Keys are non-exclusive, so allow auto-assigning them if the user
+ // has not changed them for the current extension.
+ if (Command::IsMediaKey(command.accelerator())) {
+ if (IsCommandShortcutUserModified(extension, command.command_name()))
+ return false;
return true;
Finnur 2014/10/22 09:43:03 nit: Prefer: return !foo(); over if (foo())
+ }
// Extensions are allowed to auto-assign updated keys if the user has not
// changed from the previous value.

Powered by Google App Engine
This is Rietveld 408576698