OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_REFERRER_H_ | |
6 #define CONTENT_BROWSER_TAB_CONTENTS_REFERRER_H_ | |
7 #pragma once | |
8 | |
9 #include <iosfwd> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "content/common/content_export.h" | |
13 #include "googleurl/src/gurl.h" | |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" | |
15 | |
16 namespace content { | |
17 | |
18 // This class holds a referrer URL, as well as the referrer policy to be | |
19 // applied to this URL. When passing around referrers in the browser process, | |
20 // that will eventually end up being used for URL requests, always use this | |
21 // class. | |
22 class CONTENT_EXPORT Referrer { | |
23 public: | |
24 Referrer(const GURL& referrer, WebKit::WebReferrerPolicy referrer_policy); | |
25 Referrer(); | |
26 | |
27 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.
| |
28 WebKit::WebReferrerPolicy referrer_policy() const { return referrer_policy_; } | |
29 | |
30 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
| |
31 return referrer_ != other.referrer_ || | |
32 referrer_policy_ != other.referrer_policy_; | |
33 } | |
34 bool operator==(const Referrer& other) const { | |
35 return referrer_ == other.referrer_ && | |
36 referrer_policy_ == other.referrer_policy_; | |
37 } | |
38 | |
39 private: | |
40 GURL referrer_; | |
41 WebKit::WebReferrerPolicy referrer_policy_; | |
42 }; | |
43 | |
44 // Stream operator so Referrer can be used in assertion statements. | |
45 CONTENT_EXPORT std::ostream& operator<<(std::ostream& out, | |
46 const Referrer& referrer); | |
47 | |
48 } // namespace content | |
49 | |
50 #endif // CONTENT_BROWSER_TAB_CONTENTS_REFERRER_H_ | |
OLD | NEW |