Chromium Code Reviews| Index: content/browser/tab_contents/referrer.h |
| diff --git a/content/browser/tab_contents/referrer.h b/content/browser/tab_contents/referrer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3f3f7d4644d6aa98aa03d539b45ed589590dacaa |
| --- /dev/null |
| +++ b/content/browser/tab_contents/referrer.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_TAB_CONTENTS_REFERRER_H_ |
| +#define CONTENT_BROWSER_TAB_CONTENTS_REFERRER_H_ |
| +#pragma once |
| + |
| +#include <iosfwd> |
| + |
| +#include "base/basictypes.h" |
| +#include "content/common/content_export.h" |
| +#include "googleurl/src/gurl.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" |
| + |
| +namespace content { |
| + |
| +// This class holds a referrer URL, as well as the referrer policy to be |
| +// applied to this URL. When passing around referrers in the browser process, |
| +// that will eventually end up being used for URL requests, always use this |
| +// class. |
| +class CONTENT_EXPORT Referrer { |
| + public: |
| + Referrer(const GURL& referrer, WebKit::WebReferrerPolicy referrer_policy); |
| + Referrer(); |
| + |
| + const GURL& referrer() const { return referrer_; } |
|
darin (slow to review)
2011/11/22 19:20:59
nit: since the class is named Referrer, how about
jochen (gone - plz use gerrit)
2011/11/22 19:54:47
Done.
|
| + WebKit::WebReferrerPolicy referrer_policy() const { return referrer_policy_; } |
| + |
| + bool operator!=(const Referrer& other) const { |
|
darin (slow to review)
2011/11/22 19:20:59
nit: we usually don't provide operator overloads.
jochen (gone - plz use gerrit)
2011/11/22 19:54:47
I'll drop this, since I'm not sure it's really nee
|
| + return referrer_ != other.referrer_ || |
| + referrer_policy_ != other.referrer_policy_; |
| + } |
| + bool operator==(const Referrer& other) const { |
| + return referrer_ == other.referrer_ && |
| + referrer_policy_ == other.referrer_policy_; |
| + } |
| + |
| + private: |
| + GURL referrer_; |
| + WebKit::WebReferrerPolicy referrer_policy_; |
| +}; |
| + |
| +// Stream operator so Referrer can be used in assertion statements. |
| +CONTENT_EXPORT std::ostream& operator<<(std::ostream& out, |
| + const Referrer& referrer); |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_TAB_CONTENTS_REFERRER_H_ |