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

Side by Side Diff: chrome/browser/extensions/event_router.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again 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 | Annotate | Revision Log
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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 std::set<std::string> registered_events = 738 std::set<std::string> registered_events =
739 GetRegisteredEvents(extension->id()); 739 GetRegisteredEvents(extension->id());
740 listeners_.LoadUnfilteredLazyListeners(extension->id(), 740 listeners_.LoadUnfilteredLazyListeners(extension->id(),
741 registered_events); 741 registered_events);
742 const DictionaryValue* filtered_events = 742 const DictionaryValue* filtered_events =
743 GetFilteredEvents(extension->id()); 743 GetFilteredEvents(extension->id());
744 if (filtered_events) 744 if (filtered_events)
745 listeners_.LoadFilteredLazyListeners(extension->id(), *filtered_events); 745 listeners_.LoadFilteredLazyListeners(extension->id(), *filtered_events);
746 746
747 if (dispatch_chrome_updated_event_) { 747 if (dispatch_chrome_updated_event_) {
748 MessageLoop::current()->PostTask(FROM_HERE, 748 base::MessageLoop::current()->PostTask(FROM_HERE,
749 base::Bind(&DispatchOnInstalledEvent, profile_, extension->id(), 749 base::Bind(&DispatchOnInstalledEvent, profile_, extension->id(),
750 Version(), true)); 750 Version(), true));
751 } 751 }
752 break; 752 break;
753 } 753 }
754 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 754 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
755 // Remove all registered lazy listeners from our cache. 755 // Remove all registered lazy listeners from our cache.
756 UnloadedExtensionInfo* unloaded = 756 UnloadedExtensionInfo* unloaded =
757 content::Details<UnloadedExtensionInfo>(details).ptr(); 757 content::Details<UnloadedExtensionInfo>(details).ptr();
758 listeners_.RemoveLazyListenersForExtension(unloaded->extension->id()); 758 listeners_.RemoveLazyListenersForExtension(unloaded->extension->id());
759 break; 759 break;
760 } 760 }
761 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { 761 case chrome::NOTIFICATION_EXTENSION_INSTALLED: {
762 // Dispatch the onInstalled event. 762 // Dispatch the onInstalled event.
763 const Extension* extension = 763 const Extension* extension =
764 content::Details<const InstalledExtensionInfo>(details)->extension; 764 content::Details<const InstalledExtensionInfo>(details)->extension;
765 765
766 // Get the previous version, if this is an upgrade. 766 // Get the previous version, if this is an upgrade.
767 ExtensionService* service = 767 ExtensionService* service =
768 ExtensionSystem::Get(profile_)->extension_service(); 768 ExtensionSystem::Get(profile_)->extension_service();
769 const Extension* old = service->GetExtensionById(extension->id(), true); 769 const Extension* old = service->GetExtensionById(extension->id(), true);
770 Version old_version; 770 Version old_version;
771 if (old) 771 if (old)
772 old_version = *old->version(); 772 old_version = *old->version();
773 773
774 MessageLoop::current()->PostTask(FROM_HERE, 774 base::MessageLoop::current()->PostTask(FROM_HERE,
775 base::Bind(&DispatchOnInstalledEvent, profile_, extension->id(), 775 base::Bind(&DispatchOnInstalledEvent, profile_, extension->id(),
776 old_version, false)); 776 old_version, false));
777 break; 777 break;
778 } 778 }
779 default: 779 default:
780 NOTREACHED(); 780 NOTREACHED();
781 return; 781 return;
782 } 782 }
783 } 783 }
784 784
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 copy->will_dispatch_callback = will_dispatch_callback; 828 copy->will_dispatch_callback = will_dispatch_callback;
829 return copy; 829 return copy;
830 } 830 }
831 831
832 EventListenerInfo::EventListenerInfo(const std::string& event_name, 832 EventListenerInfo::EventListenerInfo(const std::string& event_name,
833 const std::string& extension_id) 833 const std::string& extension_id)
834 : event_name(event_name), 834 : event_name(event_name),
835 extension_id(extension_id) {} 835 extension_id(extension_id) {}
836 836
837 } // namespace extensions 837 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698