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

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

Issue 10598006: Browser tag shim (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 8 years, 6 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 22f0ed22d1f81724be7da91523aa4c758ba8306c..1e4f2b8e47dcca983244e8b45aac5dd99b02466b 100644
--- a/chrome/common/extensions/extension_set.cc
+++ b/chrome/common/extensions/extension_set.cc
@@ -7,8 +7,11 @@
#include "base/logging.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/url_constants.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
using WebKit::WebSecurityOrigin;
+using WebKit::WebString;
using extensions::Extension;
ExtensionURLInfo::ExtensionURLInfo(WebSecurityOrigin origin, const GURL& url)
@@ -76,13 +79,21 @@ std::string ExtensionSet::GetExtensionOrAppIDByURL(
const Extension* ExtensionSet::GetExtensionOrAppByURL(
const ExtensionURLInfo& info) const {
- // In the common case, the document's origin will correspond to its URL,
- // but in some rare cases involving sandboxing, the two will be different.
- // We catch those cases by checking whether the document's origin is unique.
- // If that's not the case, then we conclude that the document's security
- // context is well-described by its URL and proceed to use only the URL.
- if (!info.origin().isNull() && info.origin().isUnique())
- return NULL;
+ if (!info.origin().isNull()) {
+ // In the common case, the document's origin will correspond to its URL,
+ // but in some rare cases involving sandboxing, the two will be different.
+ // We catch those cases by checking whether the document's origin is unique.
+ if (info.origin().isUnique())
+ return NULL;
+
+ // Additionally, the url will initialy be null during a window.open call
Mihai Parparita -not on Chrome 2012/06/21 01:30:11 Adam, you expressed a wish to always use the origi
+ // with an extension URL, but the origin will be set correctly. If we have
+ // an extension host origin, then that should be enough to determine which
+ // extension we need.
+ if (info.origin().protocol() ==
+ WebString::fromUTF8(chrome::kExtensionScheme))
+ return GetByID(info.origin().host().utf8().data());
+ }
if (info.url().SchemeIs(chrome::kExtensionScheme))
return GetByID(info.url().host());

Powered by Google App Engine
This is Rietveld 408576698