summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/views/cookie_info_view.cc20
-rw-r--r--chrome/browser/views/cookie_info_view.h3
-rw-r--r--chrome/browser/views/cookie_prompt_view.cc10
-rw-r--r--chrome/browser/views/cookie_prompt_view.h2
-rw-r--r--net/base/cookie_monster.cc14
-rw-r--r--net/base/cookie_monster.h3
6 files changed, 26 insertions, 26 deletions
diff --git a/chrome/browser/views/cookie_info_view.cc b/chrome/browser/views/cookie_info_view.cc
index 2f7970b..8929335 100644
--- a/chrome/browser/views/cookie_info_view.cc
+++ b/chrome/browser/views/cookie_info_view.cc
@@ -88,23 +88,11 @@ void CookieInfoView::SetCookie(
Layout();
}
-void CookieInfoView::SetCookieString(
- const std::string& host,
- const std::string& cookie_line) {
+void CookieInfoView::SetCookieString(const GURL& url,
+ const std::string& cookie_line) {
net::CookieMonster::ParsedCookie pc(cookie_line);
- net::CookieMonster::CanonicalCookie cookie(
- pc.Name(),
- pc.Value(),
- pc.Path(),
- pc.IsSecure(),
- pc.IsHttpOnly(),
- base::Time::Now(), // creation time
- base::Time(), // last access time is unused
- pc.HasExpires(),
- pc.HasExpires() ?
- net::CookieMonster::ParseCookieTime(pc.Expires()) :
- base::Time());
- SetCookie(pc.HasDomain() ? pc.Domain() : host, cookie);
+ net::CookieMonster::CanonicalCookie cookie(url, pc);
+ SetCookie(pc.HasDomain() ? pc.Domain() : url.host(), cookie);
}
diff --git a/chrome/browser/views/cookie_info_view.h b/chrome/browser/views/cookie_info_view.h
index f793d95..8db996e 100644
--- a/chrome/browser/views/cookie_info_view.h
+++ b/chrome/browser/views/cookie_info_view.h
@@ -48,8 +48,7 @@ class CookieInfoView : public views::View,
const net::CookieMonster::CanonicalCookie& cookie_node);
// Update the display from the specified cookie string.
- void SetCookieString(const std::string& host,
- const std::string& cookie_line);
+ void SetCookieString(const GURL& url, const std::string& cookie_line);
// Clears the cookie display to indicate that no or multiple cookies are
// selected.
diff --git a/chrome/browser/views/cookie_prompt_view.cc b/chrome/browser/views/cookie_prompt_view.cc
index dd2425e..0851114 100644
--- a/chrome/browser/views/cookie_prompt_view.cc
+++ b/chrome/browser/views/cookie_prompt_view.cc
@@ -52,7 +52,7 @@ CookiePromptView::CookiePromptView(
signaled_(false),
parent_(parent),
root_window_(root_window) {
- InitializeViewResources(parent_->origin().host());
+ InitializeViewResources();
expanded_view_ = g_browser_process->local_state()->
GetBoolean(prefs::kCookiePromptExpanded);
}
@@ -235,7 +235,7 @@ void CookiePromptView::Init() {
layout->AddView(cookie_info_view, 1, 1, GridLayout::FILL,
GridLayout::CENTER);
- cookie_info_view->SetCookieString(parent_->origin().host(), parent_->cookie_line());
+ cookie_info_view->SetCookieString(parent_->origin(), parent_->cookie_line());
info_view_ = cookie_info_view;
} else if (type == CookiePromptModalDialog::DIALOG_TYPE_LOCAL_STORAGE) {
LocalStorageSetItemInfoView* view = new LocalStorageSetItemInfoView();
@@ -278,10 +278,8 @@ void CookiePromptView::ToggleDetailsViewExpand() {
window->SetBounds(bounds, NULL);
}
-void CookiePromptView::InitializeViewResources(const std::string& host) {
- DCHECK(host.empty() || host[0] != '.');
- DCHECK(host == parent_->origin().host());
- CookiePromptModalDialog::DialogType type = parent_->dialog_type();
+void CookiePromptView::InitializeViewResources() {
+ CookiePromptModalDialog::DialogType type = parent_->dialog_type();
title_ = l10n_util::GetStringF(
type == CookiePromptModalDialog::DIALOG_TYPE_COOKIE ?
IDS_COOKIE_ALERT_TITLE : IDS_DATA_ALERT_TITLE,
diff --git a/chrome/browser/views/cookie_prompt_view.h b/chrome/browser/views/cookie_prompt_view.h
index daeb2b4..933ec0c 100644
--- a/chrome/browser/views/cookie_prompt_view.h
+++ b/chrome/browser/views/cookie_prompt_view.h
@@ -86,7 +86,7 @@ class CookiePromptView : public views::View,
int GetExtendedViewHeight();
// Initializes text resources needed to display this view.
- void InitializeViewResources(const std::string& domain);
+ void InitializeViewResources();
views::RadioButton* remember_radio_;
views::RadioButton* ask_radio_;
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc
index 1b37f48..50ffcac 100644
--- a/net/base/cookie_monster.cc
+++ b/net/base/cookie_monster.cc
@@ -1254,6 +1254,20 @@ std::string CookieMonster::ParsedCookie::DebugString() const {
return out;
}
+CookieMonster::CanonicalCookie::CanonicalCookie(const GURL& url,
+ const ParsedCookie& pc)
+ : name_(pc.Name()),
+ value_(pc.Value()),
+ path_(CanonPath(url, pc)),
+ creation_date_(Time::Now()),
+ last_access_date_(Time()),
+ has_expires_(pc.HasExpires()),
+ secure_(pc.IsSecure()),
+ httponly_(pc.IsHttpOnly()) {
+ if (has_expires_)
+ expiry_date_ = CanonExpiration(pc, creation_date_, CookieOptions());
+}
+
bool CookieMonster::CanonicalCookie::IsOnPath(
const std::string& url_path) const {
diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h
index f944842..ccdae0b 100644
--- a/net/base/cookie_monster.h
+++ b/net/base/cookie_monster.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -329,6 +329,7 @@ class CookieMonster::CanonicalCookie {
secure_(secure),
httponly_(httponly) {
}
+ CanonicalCookie(const GURL& url, const ParsedCookie& pc);
// Supports the default copy constructor.