Commit c7ce5855 authored by jochen@chromium.org's avatar jochen@chromium.org

Add a referrer class to be used in the browser process whenever passing around referrers

BUG=10502
TEST=content_unittest:ReferrerTest.*


Review URL: http://codereview.chromium.org/8635017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111566 0039d316-1c4b-4281-b951-d872f2087c98
parent f40a235a
// 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.
#include "testing/gtest/include/gtest/gtest.h"
#include "content/public/common/referrer.h"
namespace {
const char* kTestURL = "http://google.com/";
// Check that copying Referrer objects works.
TEST(ReferrerTest, Copy) {
content::Referrer r1(GURL(kTestURL), WebKit::WebReferrerPolicyAlways);
content::Referrer r2;
r2 = r1;
EXPECT_EQ(GURL(kTestURL), r2.url);
EXPECT_EQ(WebKit::WebReferrerPolicyAlways, r2.policy);
}
} // namespace
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
'public/common/page_zoom.h', 'public/common/page_zoom.h',
'public/common/pepper_plugin_info.cc', 'public/common/pepper_plugin_info.cc',
'public/common/pepper_plugin_info.h', 'public/common/pepper_plugin_info.h',
'public/common/referrer.h',
'public/common/renderer_preferences.cc', 'public/common/renderer_preferences.cc',
'public/common/renderer_preferences.h', 'public/common/renderer_preferences.h',
'public/common/resource_dispatcher_delegate.h', 'public/common/resource_dispatcher_delegate.h',
......
...@@ -228,6 +228,7 @@ ...@@ -228,6 +228,7 @@
'common/hi_res_timer_manager_unittest.cc', 'common/hi_res_timer_manager_unittest.cc',
'common/net/url_fetcher_impl_unittest.cc', 'common/net/url_fetcher_impl_unittest.cc',
'common/page_zoom_unittest.cc', 'common/page_zoom_unittest.cc',
'common/referrer_unittest.cc',
'common/resource_dispatcher_unittest.cc', 'common/resource_dispatcher_unittest.cc',
'gpu/gpu_info_collector_unittest.cc', 'gpu/gpu_info_collector_unittest.cc',
'gpu/gpu_info_collector_unittest_win.cc', 'gpu/gpu_info_collector_unittest_win.cc',
......
// 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_PUBLIC_COMMON_REFERRER_H_
#define CONTENT_PUBLIC_COMMON_REFERRER_H_
#pragma once
#include "content/common/content_export.h"
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h"
namespace content {
// This struct holds a referrer URL, as well as the referrer policy to be
// applied to this URL. When passing around referrers that will eventually end
// up being used for URL requests, always use this struct.
struct CONTENT_EXPORT Referrer {
Referrer(const GURL& url, WebKit::WebReferrerPolicy policy)
: url(url),
policy(policy) {
}
Referrer()
: policy(WebKit::WebReferrerPolicyDefault) {
}
GURL url;
WebKit::WebReferrerPolicy policy;
};
} // namespace content
#endif // CONTENT_PUBLIC_COMMON_REFERRER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment