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 "extensions/browser/event_router.h" | 5 #include "extensions/browser/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 12 matching lines...) Expand all Loading... |
23 #include "extensions/browser/extensions_browser_client.h" | 23 #include "extensions/browser/extensions_browser_client.h" |
24 #include "extensions/browser/lazy_background_task_queue.h" | 24 #include "extensions/browser/lazy_background_task_queue.h" |
25 #include "extensions/browser/process_manager.h" | 25 #include "extensions/browser/process_manager.h" |
26 #include "extensions/browser/process_map.h" | 26 #include "extensions/browser/process_map.h" |
27 #include "extensions/common/extension.h" | 27 #include "extensions/common/extension.h" |
28 #include "extensions/common/extension_api.h" | 28 #include "extensions/common/extension_api.h" |
29 #include "extensions/common/extension_messages.h" | 29 #include "extensions/common/extension_messages.h" |
30 #include "extensions/common/extension_urls.h" | 30 #include "extensions/common/extension_urls.h" |
31 #include "extensions/common/manifest_handlers/background_info.h" | 31 #include "extensions/common/manifest_handlers/background_info.h" |
32 #include "extensions/common/manifest_handlers/incognito_info.h" | 32 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 33 #include "extensions/common/permissions/permissions_data.h" |
33 | 34 |
34 using base::DictionaryValue; | 35 using base::DictionaryValue; |
35 using base::ListValue; | 36 using base::ListValue; |
36 using content::BrowserContext; | 37 using content::BrowserContext; |
37 using content::BrowserThread; | 38 using content::BrowserThread; |
38 | 39 |
39 namespace extensions { | 40 namespace extensions { |
40 | 41 |
41 namespace { | 42 namespace { |
42 | 43 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 // it's OK to send to normal renderers (e.g., for content scripts). | 527 // it's OK to send to normal renderers (e.g., for content scripts). |
527 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(event->event_name) && | 528 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(event->event_name) && |
528 !process_map->Contains(extension->id(), process->GetID())) { | 529 !process_map->Contains(extension->id(), process->GetID())) { |
529 return; | 530 return; |
530 } | 531 } |
531 | 532 |
532 // If the event is restricted to a URL, only dispatch if the extension has | 533 // If the event is restricted to a URL, only dispatch if the extension has |
533 // permission for it (or if the event originated from itself). | 534 // permission for it (or if the event originated from itself). |
534 if (!event->event_url.is_empty() && | 535 if (!event->event_url.is_empty() && |
535 event->event_url.host() != extension->id() && | 536 event->event_url.host() != extension->id() && |
536 !extension->GetActivePermissions()->HasEffectiveAccessToURL( | 537 !extension->permissions_data() |
537 event->event_url)) { | 538 ->active_permissions() |
| 539 ->HasEffectiveAccessToURL(event->event_url)) { |
538 return; | 540 return; |
539 } | 541 } |
540 | 542 |
541 if (!CanDispatchEventToBrowserContext(listener_context, extension, event)) | 543 if (!CanDispatchEventToBrowserContext(listener_context, extension, event)) |
542 return; | 544 return; |
543 | 545 |
544 if (!event->will_dispatch_callback.is_null()) { | 546 if (!event->will_dispatch_callback.is_null()) { |
545 event->will_dispatch_callback.Run(listener_context, extension, | 547 event->will_dispatch_callback.Run(listener_context, extension, |
546 event->event_args.get()); | 548 event->event_args.get()); |
547 } | 549 } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 } | 770 } |
769 | 771 |
770 EventListenerInfo::EventListenerInfo(const std::string& event_name, | 772 EventListenerInfo::EventListenerInfo(const std::string& event_name, |
771 const std::string& extension_id, | 773 const std::string& extension_id, |
772 content::BrowserContext* browser_context) | 774 content::BrowserContext* browser_context) |
773 : event_name(event_name), | 775 : event_name(event_name), |
774 extension_id(extension_id), | 776 extension_id(extension_id), |
775 browser_context(browser_context) {} | 777 browser_context(browser_context) {} |
776 | 778 |
777 } // namespace extensions | 779 } // namespace extensions |
OLD | NEW |