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

Unified Diff: chrome/common/extensions/extension_set.cc

Issue 22944002: Implementation of the "Redirect URLs to Packaged Apps" feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months 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 side-by-side diff with in-line comments
Download patch
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)) ==

Powered by Google App Engine
This is Rietveld 408576698