diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-10 22:56:58 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-10 22:56:58 +0000 |
commit | c277dd9a41daefd40f5a33b2dae154d6c554618d (patch) | |
tree | 28790acce758008b1d38b1147eb9ea8f9dd87d9b | |
parent | 06a11cab7c6c726ac97606dc70d6012e4455ecfd (diff) | |
download | chromium_src-c277dd9a41daefd40f5a33b2dae154d6c554618d.zip chromium_src-c277dd9a41daefd40f5a33b2dae154d6c554618d.tar.gz chromium_src-c277dd9a41daefd40f5a33b2dae154d6c554618d.tar.bz2 |
More ChromiumBridge action to eliminate glue dependencies from port.
I also cleaned up Resource{Request,Response} a tad.
R=eseidel
Review URL: http://codereview.chromium.org/10248
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5135 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed, 54 insertions, 61 deletions
diff --git a/webkit/glue/chromium_bridge_impl.cc b/webkit/glue/chromium_bridge_impl.cc index ff977ef..010e7e3 100644 --- a/webkit/glue/chromium_bridge_impl.cc +++ b/webkit/glue/chromium_bridge_impl.cc @@ -45,6 +45,28 @@ static ChromeClientImpl* ToChromeClient(Widget* widget) { return static_cast<ChromeClientImpl*>(page->chrome()->client()); } +// Cookies -------------------------------------------------------------------- + +void ChromiumBridge::setCookies( + const KURL& url, const KURL& policy_url, const String& cookie) { + webkit_glue::SetCookie( + webkit_glue::KURLToGURL(url), + webkit_glue::KURLToGURL(policy_url), + webkit_glue::StringToStdString(cookie)); +} + +String ChromiumBridge::cookies(const KURL& url, const KURL& policy_url) { + return webkit_glue::StdStringToString(webkit_glue::GetCookies( + webkit_glue::KURLToGURL(url), + webkit_glue::KURLToGURL(policy_url))); +} + +// DNS ------------------------------------------------------------------------ + +void ChromiumBridge::prefetchDNS(const String& hostname) { + webkit_glue::PrefetchDns(webkit_glue::StringToStdString(hostname)); +} + // Screen --------------------------------------------------------------------- int ChromiumBridge::screenDepth(Widget* widget) { diff --git a/webkit/port/platform/chromium/ChromiumBridge.h b/webkit/port/platform/chromium/ChromiumBridge.h index e0a461f5..d83db48 100644 --- a/webkit/port/platform/chromium/ChromiumBridge.h +++ b/webkit/port/platform/chromium/ChromiumBridge.h @@ -32,7 +32,9 @@ namespace WebCore { class Cursor; + class KURL; class IntRect; + class String; class Widget; // An interface to the embedding layer, which has the ability to answer @@ -40,6 +42,13 @@ namespace WebCore { class ChromiumBridge { public: + // Cookies ------------------------------------------------------------ + static void setCookies(const KURL& url, const KURL& policyURL, const String& value); + static String cookies(const KURL& url, const KURL& policyURL); + + // DNS ---------------------------------------------------------------- + static void prefetchDNS(const String& hostname); + // Screen ------------------------------------------------------------- static int screenDepth(Widget*); static int screenDepthPerComponent(Widget*); diff --git a/webkit/port/platform/network/chromium/CookieJarChromium.cpp b/webkit/port/platform/network/chromium/CookieJarChromium.cpp index 9d2ec62..ac5b622 100644 --- a/webkit/port/platform/network/chromium/CookieJarChromium.cpp +++ b/webkit/port/platform/network/chromium/CookieJarChromium.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Google, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,40 +24,23 @@ */ #include "config.h" +#include "CookieJar.h" -#pragma warning(push, 0) +#include "ChromiumBridge.h" #include "Document.h" -#include "KURL.h" -#include "PlatformString.h" -#include "CString.h" -#include "Vector.h" -#pragma warning(pop) -#include "webkit/glue/webkit_glue.h" -#include "webkit/glue/glue_util.h" - -namespace WebCore -{ +namespace WebCore { void setCookies(Document* document, const KURL& url, const KURL& policyURL, const String& value) { // We ignore the policyURL and compute it directly ourselves to ensure // consistency with the cookies() method below. - KURL policyBaseURL = document->policyBaseURL(); - WebCore::CString utf8value = value.utf8(); - webkit_glue::SetCookie( - webkit_glue::KURLToGURL(url), - webkit_glue::KURLToGURL(policyBaseURL), - std::string(utf8value.data(), utf8value.length())); + ChromiumBridge::setCookies(url, document->policyBaseURL(), value); } String cookies(const Document* document, const KURL& url) { - KURL policyBaseURL = document->policyBaseURL(); - std::string result = - webkit_glue::GetCookies(webkit_glue::KURLToGURL(url), - webkit_glue::KURLToGURL(policyBaseURL)); - return String(result.data(), result.size()); + return ChromiumBridge::cookies(url, document->policyBaseURL()); } bool cookiesEnabled(const Document*) diff --git a/webkit/port/platform/network/chromium/DNSChromium.cpp b/webkit/port/platform/network/chromium/DNSChromium.cpp index 2044742..d28a155 100644 --- a/webkit/port/platform/network/chromium/DNSChromium.cpp +++ b/webkit/port/platform/network/chromium/DNSChromium.cpp @@ -26,14 +26,13 @@ #include "config.h" #include "DNS.h" -#include "webkit/glue/glue_util.h" -#include "webkit/glue/webkit_glue.h" +#include "ChromiumBridge.h" namespace WebCore { void prefetchDNS(const String& hostname) { - webkit_glue::PrefetchDns(webkit_glue::StringToStdString(hostname)); + ChromiumBridge::prefetchDNS(hostname); } } diff --git a/webkit/port/platform/network/chromium/ResourceRequest.h b/webkit/port/platform/network/chromium/ResourceRequest.h index b6119db..7fe8bab 100644 --- a/webkit/port/platform/network/chromium/ResourceRequest.h +++ b/webkit/port/platform/network/chromium/ResourceRequest.h @@ -31,6 +31,7 @@ #include "CString.h" #include "ResourceRequestBase.h" +// TODO(darin): Eliminate this dependency on glue! #include "webkit/glue/resource_type.h" namespace WebCore { @@ -81,46 +82,29 @@ namespace WebCore { { } - // provides context for the resource request + // Provides context for the resource request. Frame* frame() const { return m_frame; } void setFrame(Frame* frame) { m_frame = frame; } // What this request is for. - void setResourceType(ResourceType::Type type) { - m_resourceType = type; - } - ResourceType::Type resourceType() const { - return m_resourceType; - } + void setResourceType(ResourceType::Type type) { m_resourceType = type; } + ResourceType::Type resourceType() const { return m_resourceType; } // The origin pid is the process id of the process from which this // request originated. In the case of out-of-process plugins, this // allows to link back the request to the plugin process (as it is // processed through a render view process). int originPid() const { return m_originPid; } - void setOriginPid(int originPid) { - m_originPid = originPid; - } - - // Opaque state that describes the security state (including SSL - // connection state) for that resource that should be reported when the - // resource has been loaded. This is used to simulate secure connection - // for request (typically when showing error page, so the error page has - // the errors of the page that actually failed). - // Empty string if not a secure connection. - CString securityInfo() const { - return m_securityInfo; - } - void setSecurityInfo(const CString& value) { - m_securityInfo = value; - } - -#if PLATFORM(MAC) - // WebCore/loader/FrameLoader.cpp calls this on PLATFORM_MAC. - // TODO(mmentovai): Remove this when Chromium on the Mac no longer - // uses PLATFORM_MAC. - void applyWebArchiveHackForMail() {} -#endif + void setOriginPid(int originPid) { m_originPid = originPid; } + + // Opaque buffer that describes the security state (including SSL + // connection state) for the resource that should be reported when the + // resource has been loaded. This is used to simulate secure + // connection for request (typically when showing error page, so the + // error page has the errors of the page that actually failed). Empty + // string if not a secure connection. + CString securityInfo() const { return m_securityInfo; } + void setSecurityInfo(const CString& value) { m_securityInfo = value; } private: friend class ResourceRequestBase; diff --git a/webkit/port/platform/network/chromium/ResourceResponse.h b/webkit/port/platform/network/chromium/ResourceResponse.h index cf498bd..c35e048 100644 --- a/webkit/port/platform/network/chromium/ResourceResponse.h +++ b/webkit/port/platform/network/chromium/ResourceResponse.h @@ -40,16 +40,12 @@ public: : ResourceResponseBase(), m_isContentFiltered(false) { - // TODO(ericroman): move this into ResourceResponseBase - m_lastModifiedDate = 0; } ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename) : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename), m_isContentFiltered(false) { - // TODO(ericroman): move this into ResourceResponseBase - m_lastModifiedDate = 0; } const CString& getSecurityInfo() const { return m_securityInfo; } @@ -59,7 +55,7 @@ public: bool isContentFiltered() const { return m_isContentFiltered; } void setIsContentFiltered(bool isContentFiltered) { - m_isContentFiltered = isContentFiltered; + m_isContentFiltered = isContentFiltered; } private: |