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

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: Created 7 years, 8 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 std::set<std::string> registered_events = 635 std::set<std::string> registered_events =
636 prefs->GetRegisteredEvents(extension->id()); 636 prefs->GetRegisteredEvents(extension->id());
637 listeners_.LoadUnfilteredLazyListeners(extension->id(), 637 listeners_.LoadUnfilteredLazyListeners(extension->id(),
638 registered_events); 638 registered_events);
639 const DictionaryValue* filtered_events = 639 const DictionaryValue* filtered_events =
640 prefs->GetFilteredEvents(extension->id()); 640 prefs->GetFilteredEvents(extension->id());
641 if (filtered_events) 641 if (filtered_events)
642 listeners_.LoadFilteredLazyListeners(extension->id(), *filtered_events); 642 listeners_.LoadFilteredLazyListeners(extension->id(), *filtered_events);
643 643
644 if (dispatch_chrome_updated_event_) { 644 if (dispatch_chrome_updated_event_) {
645 MessageLoop::current()->PostTask(FROM_HERE, 645 base::MessageLoop::current()->PostTask(
646 base::Bind(&DispatchOnInstalledEvent, profile_, extension->id(), 646 FROM_HERE,
647 Version(), true)); 647 base::Bind(&DispatchOnInstalledEvent,
brettw 2013/04/28 04:26:27 I'd keep the old way, same below.
648 profile_,
649 extension->id(),
650 Version(),
651 true));
648 } 652 }
649 break; 653 break;
650 } 654 }
651 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 655 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
652 // Remove all registered lazy listeners from our cache. 656 // Remove all registered lazy listeners from our cache.
653 UnloadedExtensionInfo* unloaded = 657 UnloadedExtensionInfo* unloaded =
654 content::Details<UnloadedExtensionInfo>(details).ptr(); 658 content::Details<UnloadedExtensionInfo>(details).ptr();
655 listeners_.RemoveLazyListenersForExtension(unloaded->extension->id()); 659 listeners_.RemoveLazyListenersForExtension(unloaded->extension->id());
656 break; 660 break;
657 } 661 }
658 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { 662 case chrome::NOTIFICATION_EXTENSION_INSTALLED: {
659 // Dispatch the onInstalled event. 663 // Dispatch the onInstalled event.
660 const Extension* extension = 664 const Extension* extension =
661 content::Details<const Extension>(details).ptr(); 665 content::Details<const Extension>(details).ptr();
662 666
663 // Get the previous version, if this is an upgrade. 667 // Get the previous version, if this is an upgrade.
664 ExtensionService* service = 668 ExtensionService* service =
665 ExtensionSystem::Get(profile_)->extension_service(); 669 ExtensionSystem::Get(profile_)->extension_service();
666 const Extension* old = service->GetExtensionById(extension->id(), true); 670 const Extension* old = service->GetExtensionById(extension->id(), true);
667 Version old_version; 671 Version old_version;
668 if (old) 672 if (old)
669 old_version = *old->version(); 673 old_version = *old->version();
670 674
671 MessageLoop::current()->PostTask(FROM_HERE, 675 base::MessageLoop::current()->PostTask(
672 base::Bind(&DispatchOnInstalledEvent, profile_, extension->id(), 676 FROM_HERE,
673 old_version, false)); 677 base::Bind(&DispatchOnInstalledEvent,
678 profile_,
679 extension->id(),
680 old_version,
681 false));
674 break; 682 break;
675 } 683 }
676 default: 684 default:
677 NOTREACHED(); 685 NOTREACHED();
678 return; 686 return;
679 } 687 }
680 } 688 }
681 689
682 Event::Event(const std::string& event_name, 690 Event::Event(const std::string& event_name,
683 scoped_ptr<base::ListValue> event_args) 691 scoped_ptr<base::ListValue> event_args)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 copy->will_dispatch_callback = will_dispatch_callback; 733 copy->will_dispatch_callback = will_dispatch_callback;
726 return copy; 734 return copy;
727 } 735 }
728 736
729 EventListenerInfo::EventListenerInfo(const std::string& event_name, 737 EventListenerInfo::EventListenerInfo(const std::string& event_name,
730 const std::string& extension_id) 738 const std::string& extension_id)
731 : event_name(event_name), 739 : event_name(event_name),
732 extension_id(extension_id) {} 740 extension_id(extension_id) {}
733 741
734 } // namespace extensions 742 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698