diff options
author | michaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-11 22:47:57 +0000 |
---|---|---|
committer | michaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-11 22:47:57 +0000 |
commit | d2effadd83accd3df875694437ca766bb20cb6e1 (patch) | |
tree | 4ae89de7105c1850bdeac35d870fcc6e1d015e1b /net/base | |
parent | 734a36e98b8bb2dded95c0b7e4e35e82bb3f5507 (diff) | |
download | chromium_src-d2effadd83accd3df875694437ca766bb20cb6e1.zip chromium_src-d2effadd83accd3df875694437ca766bb20cb6e1.tar.gz chromium_src-d2effadd83accd3df875694437ca766bb20cb6e1.tar.bz2 |
Upstream android net related code (part3)
Moved from http://codereview.chromium.org/7277057/
BUG=
TEST=
Review URL: http://codereview.chromium.org/7328025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92069 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/cookie_monster.cc | 19 | ||||
-rw-r--r-- | net/base/cookie_monster.h | 3 | ||||
-rw-r--r-- | net/base/mime_util.cc | 6 |
3 files changed, 28 insertions, 0 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index 13878a3..8e0b60b 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -99,6 +99,10 @@ const int kVlogGarbageCollection = 5; const int kVlogSetCookies = 7; const int kVlogGetCookies = 9; +#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) +const int kPersistentSessionCookieExpiryInDays = 14; +#endif + // Mozilla sorts on the path length (longest first), and then it // sorts by creation time (oldest first). // The RFC says the sort order for the domain attribute is undefined. @@ -1956,6 +1960,7 @@ CookieMonster::CanonicalCookie::CanonicalCookie() : secure_(false), httponly_(false), has_expires_(false) { + SetSessionCookieExpiryTime(); } CookieMonster::CanonicalCookie::CanonicalCookie( @@ -1977,6 +1982,8 @@ CookieMonster::CanonicalCookie::CanonicalCookie( secure_(secure), httponly_(httponly), has_expires_(has_expires) { + if (!has_expires_) + SetSessionCookieExpiryTime(); } CookieMonster::CanonicalCookie::CanonicalCookie(const GURL& url, @@ -1994,6 +2001,8 @@ CookieMonster::CanonicalCookie::CanonicalCookie(const GURL& url, has_expires_(pc.HasExpires()) { if (has_expires_) expiry_date_ = CanonExpiration(pc, creation_date_, CookieOptions()); + else + SetSessionCookieExpiryTime(); // Do the best we can with the domain. std::string cookie_domain; @@ -2025,6 +2034,16 @@ std::string CookieMonster::CanonicalCookie::GetCookieSourceFromURL( return url.GetOrigin().ReplaceComponents(replacements).spec(); } +void CookieMonster::CanonicalCookie::SetSessionCookieExpiryTime() { +#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) + // Mobile apps can sometimes be shut down without any warning, so the session + // cookie has to be persistent and given a default expiration time. + expiry_date_ = base::Time::Now() + + base::TimeDelta::FromDays(kPersistentSessionCookieExpiryInDays); + has_expires_ = true; +#endif +} + CookieMonster::CanonicalCookie* CookieMonster::CanonicalCookie::Create( const GURL& url, const std::string& name, diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index c3943ac..edc40a9 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -629,6 +629,9 @@ class NET_API CookieMonster::CanonicalCookie { static std::string GetCookieSourceFromURL(const GURL& url); private: + // Gives the session cookie an expiration time if needed + void SetSessionCookieExpiryTime(); + // The source member of a canonical cookie is the origin of the URL that tried // to set this cookie, minus the port number if any. This field is not // persistent though; its only used in the in-tab cookies dialog to show the diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index 75572a9..4dad7ad 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -227,10 +227,14 @@ static const char* const supported_image_types[] = { // A list of media types: http://en.wikipedia.org/wiki/Internet_media_type // A comprehensive mime type list: http://plugindoc.mozdev.org/winmime.php static const char* const supported_media_types[] = { +#if defined(ENABLE_MEDIA_TYPE_OGG) // Ogg. "video/ogg", "audio/ogg", "application/ogg", +#endif + + // WebM. "video/webm", "audio/webm", "audio/wav", @@ -259,7 +263,9 @@ static const char* const supported_media_codecs[] = { "avc1", "mp4a", #endif +#if defined(ENABLE_MEDIA_CODEC_THEORA) "theora", +#endif "vorbis", "vp8", "1" // PCM for WAV. |