diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 23:55:47 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 23:55:47 +0000 |
commit | a986cc3e3f196cb36b7b81d66924f8ad148f2517 (patch) | |
tree | 32e0d4484f1c470a6dce956446962471e3e0ba77 /chrome | |
parent | a9d0a80333a74df153dfd41dbbaff2e844b2d751 (diff) | |
download | chromium_src-a986cc3e3f196cb36b7b81d66924f8ad148f2517.zip chromium_src-a986cc3e3f196cb36b7b81d66924f8ad148f2517.tar.gz chromium_src-a986cc3e3f196cb36b7b81d66924f8ad148f2517.tar.bz2 |
Avoid showing the user a garbage path attribute when the cookie doesn't have an
explicit path set. This CL also ensures that we set the expiry info properly.
This means using CanonPath and CanonExpiration from cookie_monster.cc. Instead
of exposing those methods, I just expose a CanonicalCookie constructor that
takes a ParsedCookie.
R=pkasting
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/597031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38984 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/cookie_info_view.cc | 20 | ||||
-rw-r--r-- | chrome/browser/views/cookie_info_view.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/cookie_prompt_view.cc | 10 | ||||
-rw-r--r-- | chrome/browser/views/cookie_prompt_view.h | 2 |
4 files changed, 10 insertions, 25 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_; |