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

Side by Side Diff: chrome/browser/extensions/event_router.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/event_router.h" 5 #include "chrome/browser/extensions/event_router.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 651 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
652 // Remove all registered lazy listeners from our cache. 652 // Remove all registered lazy listeners from our cache.
653 UnloadedExtensionInfo* unloaded = 653 UnloadedExtensionInfo* unloaded =
654 content::Details<UnloadedExtensionInfo>(details).ptr(); 654 content::Details<UnloadedExtensionInfo>(details).ptr();
655 listeners_.RemoveLazyListenersForExtension(unloaded->extension->id()); 655 listeners_.RemoveLazyListenersForExtension(unloaded->extension->id());
656 break; 656 break;
657 } 657 }
658 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { 658 case chrome::NOTIFICATION_EXTENSION_INSTALLED: {
659 // Dispatch the onInstalled event. 659 // Dispatch the onInstalled event.
660 const Extension* extension = 660 const Extension* extension =
661 content::Details<const Extension>(details).ptr(); 661 content::Details<const InstalledExtensionInfo>(details)->extension;
662 662
663 // Get the previous version, if this is an upgrade. 663 // Get the previous version, if this is an upgrade.
664 ExtensionService* service = 664 ExtensionService* service =
665 ExtensionSystem::Get(profile_)->extension_service(); 665 ExtensionSystem::Get(profile_)->extension_service();
666 const Extension* old = service->GetExtensionById(extension->id(), true); 666 const Extension* old = service->GetExtensionById(extension->id(), true);
667 Version old_version; 667 Version old_version;
668 if (old) 668 if (old)
669 old_version = *old->version(); 669 old_version = *old->version();
670 670
671 MessageLoop::current()->PostTask(FROM_HERE, 671 MessageLoop::current()->PostTask(FROM_HERE,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 copy->will_dispatch_callback = will_dispatch_callback; 725 copy->will_dispatch_callback = will_dispatch_callback;
726 return copy; 726 return copy;
727 } 727 }
728 728
729 EventListenerInfo::EventListenerInfo(const std::string& event_name, 729 EventListenerInfo::EventListenerInfo(const std::string& event_name,
730 const std::string& extension_id) 730 const std::string& extension_id)
731 : event_name(event_name), 731 : event_name(event_name),
732 extension_id(extension_id) {} 732 extension_id(extension_id) {}
733 733
734 } // namespace extensions 734 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/convert_web_app_browsertest.cc ('k') | chrome/browser/extensions/extension_blacklist_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698