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

Side by Side Diff: extensions/browser/event_router.cc

Issue 2494653005: Support API aliases (Closed)
Patch Set: . Created 4 years 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 "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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 process_map->GetMostLikelyContextType(extension, process->GetID()); 581 process_map->GetMostLikelyContextType(extension, process->GetID());
582 582
583 // We shouldn't be dispatching an event to a webpage, since all such events 583 // We shouldn't be dispatching an event to a webpage, since all such events
584 // (e.g. messaging) don't go through EventRouter. 584 // (e.g. messaging) don't go through EventRouter.
585 DCHECK_NE(Feature::WEB_PAGE_CONTEXT, target_context) 585 DCHECK_NE(Feature::WEB_PAGE_CONTEXT, target_context)
586 << "Trying to dispatch event " << event->event_name << " to a webpage," 586 << "Trying to dispatch event " << event->event_name << " to a webpage,"
587 << " but this shouldn't be possible"; 587 << " but this shouldn't be possible";
588 588
589 Feature::Availability availability = 589 Feature::Availability availability =
590 ExtensionAPI::GetSharedInstance()->IsAvailable( 590 ExtensionAPI::GetSharedInstance()->IsAvailable(
591 event->event_name, extension, target_context, listener_url); 591 event->event_name, extension, target_context, listener_url,
592 CheckAliasStatus::ALLOWED);
592 if (!availability.is_available()) { 593 if (!availability.is_available()) {
593 // It shouldn't be possible to reach here, because access is checked on 594 // It shouldn't be possible to reach here, because access is checked on
594 // registration. However, for paranoia, check on dispatch as well. 595 // registration. However, for paranoia, check on dispatch as well.
595 NOTREACHED() << "Trying to dispatch event " << event->event_name 596 NOTREACHED() << "Trying to dispatch event " << event->event_name
596 << " which the target does not have access to: " 597 << " which the target does not have access to: "
597 << availability.message(); 598 << availability.message();
598 return; 599 return;
599 } 600 }
600 601
601 if (!event->will_dispatch_callback.is_null() && 602 if (!event->will_dispatch_callback.is_null() &&
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 const std::string& extension_id, 883 const std::string& extension_id,
883 const GURL& listener_url, 884 const GURL& listener_url,
884 content::BrowserContext* browser_context) 885 content::BrowserContext* browser_context)
885 : event_name(event_name), 886 : event_name(event_name),
886 extension_id(extension_id), 887 extension_id(extension_id),
887 listener_url(listener_url), 888 listener_url(listener_url),
888 browser_context(browser_context) { 889 browser_context(browser_context) {
889 } 890 }
890 891
891 } // namespace extensions 892 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/extension_api_unittest/api_features.json ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698