| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 process_map->GetMostLikelyContextType(extension, process->GetID()); | 593 process_map->GetMostLikelyContextType(extension, process->GetID()); |
| 594 | 594 |
| 595 // We shouldn't be dispatching an event to a webpage, since all such events | 595 // We shouldn't be dispatching an event to a webpage, since all such events |
| 596 // (e.g. messaging) don't go through EventRouter. | 596 // (e.g. messaging) don't go through EventRouter. |
| 597 DCHECK_NE(Feature::WEB_PAGE_CONTEXT, target_context) | 597 DCHECK_NE(Feature::WEB_PAGE_CONTEXT, target_context) |
| 598 << "Trying to dispatch event " << event->event_name << " to a webpage," | 598 << "Trying to dispatch event " << event->event_name << " to a webpage," |
| 599 << " but this shouldn't be possible"; | 599 << " but this shouldn't be possible"; |
| 600 | 600 |
| 601 Feature::Availability availability = | 601 Feature::Availability availability = |
| 602 ExtensionAPI::GetSharedInstance()->IsAvailable( | 602 ExtensionAPI::GetSharedInstance()->IsAvailable( |
| 603 event->event_name, extension, target_context, listener_url); | 603 event->event_name, extension, target_context, listener_url, true); |
| 604 if (!availability.is_available()) { | 604 if (!availability.is_available()) { |
| 605 // It shouldn't be possible to reach here, because access is checked on | 605 // It shouldn't be possible to reach here, because access is checked on |
| 606 // registration. However, for paranoia, check on dispatch as well. | 606 // registration. However, for paranoia, check on dispatch as well. |
| 607 NOTREACHED() << "Trying to dispatch event " << event->event_name | 607 NOTREACHED() << "Trying to dispatch event " << event->event_name |
| 608 << " which the target does not have access to: " | 608 << " which the target does not have access to: " |
| 609 << availability.message(); | 609 << availability.message(); |
| 610 return; | 610 return; |
| 611 } | 611 } |
| 612 | 612 |
| 613 if (!event->will_dispatch_callback.is_null() && | 613 if (!event->will_dispatch_callback.is_null() && |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 const std::string& extension_id, | 894 const std::string& extension_id, |
| 895 const GURL& listener_url, | 895 const GURL& listener_url, |
| 896 content::BrowserContext* browser_context) | 896 content::BrowserContext* browser_context) |
| 897 : event_name(event_name), | 897 : event_name(event_name), |
| 898 extension_id(extension_id), | 898 extension_id(extension_id), |
| 899 listener_url(listener_url), | 899 listener_url(listener_url), |
| 900 browser_context(browser_context) { | 900 browser_context(browser_context) { |
| 901 } | 901 } |
| 902 | 902 |
| 903 } // namespace extensions | 903 } // namespace extensions |
| OLD | NEW |