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

Side by Side Diff: chrome/browser/extensions/api/commands/command_service_new.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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return true; 166 return true;
167 } 167 }
168 168
169 void CommandService::Observe( 169 void CommandService::Observe(
170 int type, 170 int type,
171 const content::NotificationSource& source, 171 const content::NotificationSource& source,
172 const content::NotificationDetails& details) { 172 const content::NotificationDetails& details) {
173 switch (type) { 173 switch (type) {
174 case chrome::NOTIFICATION_EXTENSION_INSTALLED: 174 case chrome::NOTIFICATION_EXTENSION_INSTALLED:
175 AssignInitialKeybindings( 175 AssignInitialKeybindings(
176 content::Details<const Extension>(details).ptr()); 176 content::Details<const InstalledExtensionInfo>(details)->extension);
177 break; 177 break;
178 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: 178 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED:
179 RemoveKeybindingPrefs( 179 RemoveKeybindingPrefs(
180 content::Details<const Extension>(details).ptr()->id(), 180 content::Details<const Extension>(details)->id(),
181 std::string()); 181 std::string());
182 break; 182 break;
183 default: 183 default:
184 NOTREACHED(); 184 NOTREACHED();
185 break; 185 break;
186 } 186 }
187 } 187 }
188 188
189 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id, 189 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id,
190 const std::string& command_name, 190 const std::string& command_name,
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 return false; 353 return false;
354 354
355 *command = *requested_command; 355 *command = *requested_command;
356 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) 356 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN)
357 command->set_accelerator(shortcut_assigned); 357 command->set_accelerator(shortcut_assigned);
358 358
359 return true; 359 return true;
360 } 360 }
361 361
362 } // namespace extensions 362 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/commands/command_service.cc ('k') | chrome/browser/extensions/api/management/management_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698