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