Index: chrome/common/extensions/extension_set.cc |
diff --git a/chrome/common/extensions/extension_set.cc b/chrome/common/extensions/extension_set.cc |
index 8b68fb6aeef376d02e44e52b3fe5b281e61c87f9..896767cef05ecae11206588add379e99008c33d7 100644 |
--- a/chrome/common/extensions/extension_set.cc |
+++ b/chrome/common/extensions/extension_set.cc |
@@ -5,7 +5,9 @@ |
#include "chrome/common/extensions/extension_set.h" |
#include "base/logging.h" |
+#include "chrome/common/extensions/api/url_handlers/url_handlers_parser.h" |
#include "chrome/common/extensions/extension.h" |
+#include "chrome/common/extensions/extension_manifest_constants.h" |
#include "chrome/common/extensions/manifest_handlers/sandboxed_page_info.h" |
#include "chrome/common/url_constants.h" |
#include "extensions/common/constants.h" |
@@ -124,6 +126,24 @@ const Extension* ExtensionSet::GetHostedAppByOverlappingWebExtent( |
return NULL; |
} |
+const extensions::UrlHandlerInfo* |
+ExtensionSet::GetHandlingAppForURL(const GURL& url) const { |
+ for (const auto& ext: extensions_) { |
asargent_no_longer_on_chrome
2013/08/14 18:05:12
FYI, we can't use C++11 features, because some pla
sergeygs
2013/08/18 11:40:24
Makes sense. I wasn't sure myself, and consulted t
|
+ if (ext.second->is_app()) { |
+ const std::vector<extensions::UrlHandlerInfo>* handlers = |
+ extensions::UrlHandlers::GetUrlHandlers(ext.second); |
+ if (handlers) { |
+ for (const extensions::UrlHandlerInfo& handler: *handlers) { |
+ if (handler.patterns.MatchesURL(url)) |
+ return &handler; |
+ } |
+ } |
+ } |
+ } |
+ |
+ return NULL; |
+} |
+ |
bool ExtensionSet::InSameExtent(const GURL& old_url, |
const GURL& new_url) const { |
return GetExtensionOrAppByURL(ExtensionURLInfo(old_url)) == |