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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 2 Created 8 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/extension_event_router.h" 5 #include "chrome/browser/extensions/extension_event_router.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/chrome_view_type.h" 26 #include "chrome/common/chrome_view_type.h"
27 #include "chrome/common/extensions/extension.h" 27 #include "chrome/common/extensions/extension.h"
28 #include "chrome/common/extensions/extension_messages.h" 28 #include "chrome/common/extensions/extension_messages.h"
29 #include "chrome/common/extensions/api/extension_api.h" 29 #include "chrome/common/extensions/api/extension_api.h"
30 #include "content/public/browser/notification_service.h" 30 #include "content/public/browser/notification_service.h"
31 #include "content/public/browser/render_process_host.h" 31 #include "content/public/browser/render_process_host.h"
32 32
33 using content::BrowserThread; 33 using content::BrowserThread;
34 using extensions::Extension;
34 using extensions::ExtensionAPI; 35 using extensions::ExtensionAPI;
35 36
36 namespace { 37 namespace {
37 38
38 const char kDispatchEvent[] = "Event.dispatchJSON"; 39 const char kDispatchEvent[] = "Event.dispatchJSON";
39 40
40 void NotifyEventListenerRemovedOnIOThread( 41 void NotifyEventListenerRemovedOnIOThread(
41 void* profile, 42 void* profile,
42 const std::string& extension_id, 43 const std::string& extension_id,
43 const std::string& sub_event_name) { 44 const std::string& sub_event_name) {
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 GetRegisteredEvents(extension->id()); 476 GetRegisteredEvents(extension->id());
476 ListenerProcess lazy_listener(NULL, extension->id()); 477 ListenerProcess lazy_listener(NULL, extension->id());
477 for (std::set<std::string>::iterator it = registered_events.begin(); 478 for (std::set<std::string>::iterator it = registered_events.begin();
478 it != registered_events.end(); ++it) { 479 it != registered_events.end(); ++it) {
479 lazy_listeners_[*it].insert(lazy_listener); 480 lazy_listeners_[*it].insert(lazy_listener);
480 } 481 }
481 break; 482 break;
482 } 483 }
483 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 484 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
484 // Remove all registered lazy listeners from our cache. 485 // Remove all registered lazy listeners from our cache.
485 UnloadedExtensionInfo* unloaded = 486 extensions::UnloadedExtensionInfo* unloaded =
486 content::Details<UnloadedExtensionInfo>(details).ptr(); 487 content::Details<extensions::UnloadedExtensionInfo>(details).ptr();
487 ListenerProcess lazy_listener(NULL, unloaded->extension->id()); 488 ListenerProcess lazy_listener(NULL, unloaded->extension->id());
488 for (ListenerMap::iterator it = lazy_listeners_.begin(); 489 for (ListenerMap::iterator it = lazy_listeners_.begin();
489 it != lazy_listeners_.end(); ++it) { 490 it != lazy_listeners_.end(); ++it) {
490 it->second.erase(lazy_listener); 491 it->second.erase(lazy_listener);
491 } 492 }
492 break; 493 break;
493 } 494 }
494 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { 495 case chrome::NOTIFICATION_EXTENSION_INSTALLED: {
495 // Dispatch the onInstalled event. 496 // Dispatch the onInstalled event.
496 const Extension* extension = 497 const Extension* extension =
497 content::Details<const Extension>(details).ptr(); 498 content::Details<const Extension>(details).ptr();
498 MessageLoop::current()->PostTask(FROM_HERE, 499 MessageLoop::current()->PostTask(FROM_HERE,
499 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent, 500 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent,
500 profile_, extension->id())); 501 profile_, extension->id()));
501 break; 502 break;
502 } 503 }
503 default: 504 default:
504 NOTREACHED(); 505 NOTREACHED();
505 return; 506 return;
506 } 507 }
507 } 508 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698