diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 21:25:25 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 21:25:25 +0000 |
commit | 11b9a3b34801022a851e230088ecb4a9070982c7 (patch) | |
tree | 2a66e896bcc0f6c909aa3a8bce4fcf977be16e90 | |
parent | e9a779fdf629d6b0370da06bbb6614c59147d158 (diff) | |
download | chromium_src-11b9a3b34801022a851e230088ecb4a9070982c7.zip chromium_src-11b9a3b34801022a851e230088ecb4a9070982c7.tar.gz chromium_src-11b9a3b34801022a851e230088ecb4a9070982c7.tar.bz2 |
Move webkit/glue/webcookie.{h,cc} to content/common/cookie_data.{h,cc}.
R=cevans@chromium.org, michaeln@chromium.org
Review URL: https://codereview.chromium.org/17484002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207570 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/render_message_filter.cc | 6 | ||||
-rw-r--r-- | content/common/cookie_data.cc | 32 | ||||
-rw-r--r-- | content/common/cookie_data.h | 50 | ||||
-rw-r--r-- | content/common/view_messages.h | 6 | ||||
-rw-r--r-- | content/content_common.gypi | 2 | ||||
-rw-r--r-- | content/renderer/renderer_webcookiejar_impl.cc | 25 | ||||
-rw-r--r-- | webkit/glue/webcookie.cc | 45 | ||||
-rw-r--r-- | webkit/glue/webcookie.h | 57 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 2 |
9 files changed, 102 insertions, 123 deletions
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 58b53ae..aa1b145 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -31,6 +31,7 @@ #include "content/browser/renderer_host/render_widget_helper.h" #include "content/common/child_process_host_impl.h" #include "content/common/child_process_messages.h" +#include "content/common/cookie_data.h" #include "content/common/desktop_notification_messages.h" #include "content/common/media/media_param_traits.h" #include "content/common/view_messages.h" @@ -62,7 +63,6 @@ #include "net/url_request/url_request_context_getter.h" #include "third_party/WebKit/public/web/WebNotificationPresenter.h" #include "ui/gfx/color_profile.h" -#include "webkit/glue/webcookie.h" #include "webkit/glue/webkit_glue.h" #include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/plugin_constants.h" @@ -1058,9 +1058,9 @@ void RenderMessageFilter::SendGetCookiesResponse(IPC::Message* reply_msg, void RenderMessageFilter::SendGetRawCookiesResponse( IPC::Message* reply_msg, const net::CookieList& cookie_list) { - std::vector<webkit_glue::WebCookie> cookies; + std::vector<CookieData> cookies; for (size_t i = 0; i < cookie_list.size(); ++i) - cookies.push_back(webkit_glue::WebCookie(cookie_list[i])); + cookies.push_back(CookieData(cookie_list[i])); ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg, cookies); Send(reply_msg); } diff --git a/content/common/cookie_data.cc b/content/common/cookie_data.cc new file mode 100644 index 0000000..3a6980bb --- /dev/null +++ b/content/common/cookie_data.cc @@ -0,0 +1,32 @@ +// Copyright (c) 2013 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 "content/common/cookie_data.h" + +#include "net/cookies/canonical_cookie.h" + +namespace content { + +CookieData::CookieData() + : expires(0), + http_only(false), + secure(false), + session(false) { +} + +CookieData::CookieData(const net::CanonicalCookie& c) + : name(c.Name()), + value(c.Value()), + domain(c.Domain()), + path(c.Path()), + expires(c.ExpiryDate().ToDoubleT() * 1000), + http_only(c.IsHttpOnly()), + secure(c.IsSecure()), + session(!c.IsPersistent()) { +} + +CookieData::~CookieData() { +} + +} // namespace content diff --git a/content/common/cookie_data.h b/content/common/cookie_data.h new file mode 100644 index 0000000..21dd022 --- /dev/null +++ b/content/common/cookie_data.h @@ -0,0 +1,50 @@ +// Copyright (c) 2013 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_COMMON_COOKIE_DATA_H_ +#define CONTENT_COMMON_COOKIE_DATA_H_ + +#include <string> + +#include "content/common/content_export.h" + +namespace net { +class CanonicalCookie; +} + +namespace content { + +struct CONTENT_EXPORT CookieData { + CookieData(); + explicit CookieData(const net::CanonicalCookie& c); + ~CookieData(); + + // Cookie name. + std::string name; + + // Cookie value. + std::string value; + + // Cookie domain. + std::string domain; + + // Cookie path. + std::string path; + + // Cookie expires param if any. + double expires; + + // Cookie HTTPOnly param. + bool http_only; + + // Cookie secure param. + bool secure; + + // Session cookie flag. + bool session; +}; + +} // namespace content + +#endif // CONTENT_COMMON_COOKIE_DATA_H_ diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 1bcfb67..1a7508b 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -14,6 +14,7 @@ #include "content/common/browser_rendering_stats.h" #include "content/common/content_export.h" #include "content/common/content_param_traits.h" +#include "content/common/cookie_data.h" #include "content/common/navigation_gesture.h" #include "content/common/pepper_renderer_instance_data.h" #include "content/common/view_message_enums.h" @@ -57,7 +58,6 @@ #include "ui/gfx/vector2d_f.h" #include "ui/shell_dialogs/selected_file_info.h" #include "webkit/common/webmenuitem.h" -#include "webkit/glue/webcookie.h" #include "webkit/plugins/npapi/webplugin.h" #if defined(OS_MACOSX) @@ -267,7 +267,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::RendererPreferences) IPC_STRUCT_TRAITS_MEMBER(touchscreen_fling_profile) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebCookie) +IPC_STRUCT_TRAITS_BEGIN(content::CookieData) IPC_STRUCT_TRAITS_MEMBER(name) IPC_STRUCT_TRAITS_MEMBER(value) IPC_STRUCT_TRAITS_MEMBER(domain) @@ -1650,7 +1650,7 @@ IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_GetCookies, IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_GetRawCookies, GURL /* url */, GURL /* first_party_for_cookies */, - std::vector<webkit_glue::WebCookie> + std::vector<content::CookieData> /* raw_cookies */) // Used to delete cookie for the given URL and name diff --git a/content/content_common.gypi b/content/content_common.gypi index 4ec69ab..aed28a4 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -147,6 +147,8 @@ 'common/content_param_traits.h', 'common/content_param_traits_macros.h', 'common/content_paths.cc', + 'common/cookie_data.cc', + 'common/cookie_data.h', 'common/database_messages.h', 'common/db_message_filter.cc', 'common/db_message_filter.h', diff --git a/content/renderer/renderer_webcookiejar_impl.cc b/content/renderer/renderer_webcookiejar_impl.cc index d2444ec..c9e6934 100644 --- a/content/renderer/renderer_webcookiejar_impl.cc +++ b/content/renderer/renderer_webcookiejar_impl.cc @@ -5,11 +5,11 @@ #include "content/renderer/renderer_webcookiejar_impl.h" #include "base/strings/utf_string_conversions.h" +#include "content/common/cookie_data.h" #include "content/common/view_messages.h" #include "content/public/renderer/content_renderer_client.h" #include "content/renderer/render_view_impl.h" #include "third_party/WebKit/public/platform/WebCookie.h" -#include "webkit/glue/webcookie.h" using WebKit::WebCookie; using WebKit::WebString; @@ -50,23 +50,22 @@ WebString RendererWebCookieJarImpl::cookieRequestHeaderFieldValue( void RendererWebCookieJarImpl::rawCookies( const WebURL& url, const WebURL& first_party_for_cookies, WebVector<WebCookie>& raw_cookies) { - std::vector<webkit_glue::WebCookie> cookies; + std::vector<CookieData> cookies; // NOTE: This may pump events (see RenderThread::Send). sender_->Send(new ViewHostMsg_GetRawCookies( url, first_party_for_cookies, &cookies)); WebVector<WebCookie> result(cookies.size()); - int i = 0; - for (std::vector<webkit_glue::WebCookie>::iterator it = cookies.begin(); - it != cookies.end(); ++it) { - result[i++] = WebCookie(WebString::fromUTF8(it->name), - WebString::fromUTF8(it->value), - WebString::fromUTF8(it->domain), - WebString::fromUTF8(it->path), - it->expires, - it->http_only, - it->secure, - it->session); + for (size_t i = 0; i < cookies.size(); ++i) { + const CookieData& c = cookies[i]; + result[i] = WebCookie(WebString::fromUTF8(c.name), + WebString::fromUTF8(c.value), + WebString::fromUTF8(c.domain), + WebString::fromUTF8(c.path), + c.expires, + c.http_only, + c.secure, + c.session); } raw_cookies.swap(result); } diff --git a/webkit/glue/webcookie.cc b/webkit/glue/webcookie.cc deleted file mode 100644 index e5af921..0000000 --- a/webkit/glue/webcookie.cc +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2012 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 "webkit/glue/webcookie.h" - -#include "net/cookies/canonical_cookie.h" - -namespace webkit_glue { - -WebCookie::WebCookie() - : expires(0), - http_only(false), - secure(false), - session(false) { -} - -WebCookie::WebCookie(const net::CanonicalCookie& c) - : name(c.Name()), - value(c.Value()), - domain(c.Domain()), - path(c.Path()), - expires(c.ExpiryDate().ToDoubleT() * 1000), - http_only(c.IsHttpOnly()), - secure(c.IsSecure()), - session(!c.IsPersistent()) { -} - -WebCookie::WebCookie(const std::string& name, const std::string& value, - const std::string& domain, const std::string& path, - double expires, bool http_only, bool secure, bool session) - : name(name), - value(value), - domain(domain), - path(path), - expires(expires), - http_only(http_only), - secure(secure), - session(session) { -} - -WebCookie::~WebCookie() { -} - -} // namespace webkit_glue diff --git a/webkit/glue/webcookie.h b/webkit/glue/webcookie.h deleted file mode 100644 index 4d3d244..0000000 --- a/webkit/glue/webcookie.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2012 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. -// -// A struct for managing data being dropped on a webview. This represents a -// union of all the types of data that can be dropped in a platform neutral -// way. - -#ifndef WEBKIT_GLUE_WEBCOOKIE_H_ -#define WEBKIT_GLUE_WEBCOOKIE_H_ - -#include <string> - -#include "webkit/glue/webkit_glue_export.h" - -namespace net { -class CanonicalCookie; -} - -namespace webkit_glue { - -struct WEBKIT_GLUE_EXPORT WebCookie { - WebCookie(); - explicit WebCookie(const net::CanonicalCookie& c); - WebCookie(const std::string& name, const std::string& value, - const std::string& domain, const std::string& path, double expires, - bool http_only, bool secure, bool session); - ~WebCookie(); - - // Cookie name. - std::string name; - - // Cookie value. - std::string value; - - // Cookie domain. - std::string domain; - - // Cookie path. - std::string path; - - // Cookie expires param if any. - double expires; - - // Cookie HTTPOnly param. - bool http_only; - - // Cookie secure param. - bool secure; - - // Session cookie flag. - bool session; -}; - -} // namespace webkit_glue - -#endif // WEBKIT_GLUE_WEBCOOKIE_H_ diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index f37c469..bcfc8cd 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -291,8 +291,6 @@ 'simple_webmimeregistry_impl.h', 'webclipboard_impl.cc', 'webclipboard_impl.h', - 'webcookie.cc', - 'webcookie.h', 'webfileutilities_impl.cc', 'webfileutilities_impl.h', 'webkit_glue.cc', |