OLD | NEW |
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/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 10 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // the extension process is unloaded. | 307 // the extension process is unloaded. |
308 if (!extension) | 308 if (!extension) |
309 return; | 309 return; |
310 | 310 |
311 Profile* listener_profile = Profile::FromBrowserContext( | 311 Profile* listener_profile = Profile::FromBrowserContext( |
312 listener.process->GetBrowserContext()); | 312 listener.process->GetBrowserContext()); |
313 extensions::ProcessMap* process_map = | 313 extensions::ProcessMap* process_map = |
314 listener_profile->GetExtensionService()->process_map(); | 314 listener_profile->GetExtensionService()->process_map(); |
315 // If the event is privileged, only send to extension processes. Otherwise, | 315 // If the event is privileged, only send to extension processes. Otherwise, |
316 // it's OK to send to normal renderers (e.g., for content scripts). | 316 // it's OK to send to normal renderers (e.g., for content scripts). |
317 if (ExtensionAPI::GetInstance()->IsPrivileged(event->event_name) && | 317 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(event->event_name) && |
318 !process_map->Contains(extension->id(), listener.process->GetID())) { | 318 !process_map->Contains(extension->id(), listener.process->GetID())) { |
319 return; | 319 return; |
320 } | 320 } |
321 | 321 |
322 const std::string* event_args; | 322 const std::string* event_args; |
323 if (!CanDispatchEventToProfile(listener_profile, extension, | 323 if (!CanDispatchEventToProfile(listener_profile, extension, |
324 event, &event_args)) | 324 event, &event_args)) |
325 return; | 325 return; |
326 | 326 |
327 DispatchEvent(listener.process, listener.extension_id, | 327 DispatchEvent(listener.process, listener.extension_id, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 ExtensionModuleEventRouter::DispatchOnInstalledEvent(profile_, extension); | 498 ExtensionModuleEventRouter::DispatchOnInstalledEvent(profile_, extension); |
499 break; | 499 break; |
500 } | 500 } |
501 | 501 |
502 // TODO(tessamac): if background page crashed/failed clear queue. | 502 // TODO(tessamac): if background page crashed/failed clear queue. |
503 default: | 503 default: |
504 NOTREACHED(); | 504 NOTREACHED(); |
505 return; | 505 return; |
506 } | 506 } |
507 } | 507 } |
OLD | NEW |