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

Side by Side Diff: chrome/browser/extensions/api/commands/command_service.cc

Issue 14238037: Made it possible to tell whether an extension is being installed or updated. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added extra check. Created 7 years, 7 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/browser/extensions/api/commands/command_service.h" 5 #include "chrome/browser/extensions/api/commands/command_service.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/api/commands/commands.h" 10 #include "chrome/browser/extensions/api/commands/commands.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return true; 167 return true;
168 } 168 }
169 169
170 void CommandService::Observe( 170 void CommandService::Observe(
171 int type, 171 int type,
172 const content::NotificationSource& source, 172 const content::NotificationSource& source,
173 const content::NotificationDetails& details) { 173 const content::NotificationDetails& details) {
174 switch (type) { 174 switch (type) {
175 case chrome::NOTIFICATION_EXTENSION_INSTALLED: 175 case chrome::NOTIFICATION_EXTENSION_INSTALLED:
176 AssignInitialKeybindings( 176 AssignInitialKeybindings(
177 content::Details<const Extension>(details).ptr()); 177 content::Details<const InstalledExtensionInfo>(details)->extension);
178 break; 178 break;
179 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: 179 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED:
180 RemoveKeybindingPrefs( 180 RemoveKeybindingPrefs(
181 content::Details<const Extension>(details).ptr()->id(), 181 content::Details<const Extension>(details)->id(),
182 std::string()); 182 std::string());
183 break; 183 break;
184 default: 184 default:
185 NOTREACHED(); 185 NOTREACHED();
186 break; 186 break;
187 } 187 }
188 } 188 }
189 189
190 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id, 190 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id,
191 const std::string& command_name, 191 const std::string& command_name,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 return false; 366 return false;
367 367
368 *command = *requested_command; 368 *command = *requested_command;
369 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) 369 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN)
370 command->set_accelerator(shortcut_assigned); 370 command->set_accelerator(shortcut_assigned);
371 371
372 return true; 372 return true;
373 } 373 }
374 374
375 } // namespace extensions 375 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698