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

Unified Diff: url/origin.h

Issue 2405483002: Make the request initiator Optional (Closed)
Patch Set: Introduce NullableOrigin to use for request initiator Created 4 years, 2 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: url/origin.h
diff --git a/url/origin.h b/url/origin.h
index 273622edc8a0624901af12e2a8eac3d6e5a96b8c..fc14f633afb2b0dd4d53a25c6686976bd143b003 100644
--- a/url/origin.h
+++ b/url/origin.h
@@ -9,6 +9,7 @@
#include <string>
+#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
#include "base/strings/string_piece.h"
#include "url/scheme_host_port.h"
@@ -102,7 +103,7 @@ class URL_EXPORT Origin {
base::StringPiece host,
uint16_t port);
- ~Origin();
+ virtual ~Origin();
// For unique origins, these return ("", "", 0).
const std::string& scheme() const { return tuple_.scheme(); }
@@ -144,6 +145,20 @@ class URL_EXPORT Origin {
bool unique_;
};
+// A version of Origin that supports ref count and can be passed in a
+// scoped_refptr. This allows to specify a null Origin (as opposed to a unique
+// origin).
+class URL_EXPORT NullableOrigin : public Origin,
Mike West 2016/10/11 08:50:31 This feels like a stopgap that we're doing just be
+ public base::RefCounted<NullableOrigin> {
+ public:
+ explicit NullableOrigin(const GURL& url);
+ NullableOrigin(const Origin& origin);
+
+ private:
+ friend base::RefCounted<NullableOrigin>;
+ ~NullableOrigin() override;
+};
+
URL_EXPORT std::ostream& operator<<(std::ostream& out, const Origin& origin);
URL_EXPORT bool IsSameOriginWith(const GURL& a, const GURL& b);

Powered by Google App Engine
This is Rietveld 408576698