Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: chrome/browser/views/cookie_info_view.cc

Issue 597031: Avoid showing the user a garbage path attribute when the cookie doesn't have ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/cookie_info_view.h ('k') | chrome/browser/views/cookie_prompt_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/views/cookie_info_view.h" 5 #include "chrome/browser/views/cookie_info_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/gfx/canvas.h" 9 #include "app/gfx/canvas.h"
10 #include "app/gfx/color_utils.h" 10 #include "app/gfx/color_utils.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 expires_value_field_->SetText(expire_text); 81 expires_value_field_->SetText(expire_text);
82 } 82 }
83 83
84 send_for_value_field_->SetText(cookie.IsSecure() ? 84 send_for_value_field_->SetText(cookie.IsSecure() ?
85 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_SECURE) : 85 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_SECURE) :
86 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_ANY)); 86 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_ANY));
87 EnableCookieDisplay(true); 87 EnableCookieDisplay(true);
88 Layout(); 88 Layout();
89 } 89 }
90 90
91 void CookieInfoView::SetCookieString( 91 void CookieInfoView::SetCookieString(const GURL& url,
92 const std::string& host, 92 const std::string& cookie_line) {
93 const std::string& cookie_line) {
94 net::CookieMonster::ParsedCookie pc(cookie_line); 93 net::CookieMonster::ParsedCookie pc(cookie_line);
95 net::CookieMonster::CanonicalCookie cookie( 94 net::CookieMonster::CanonicalCookie cookie(url, pc);
96 pc.Name(), 95 SetCookie(pc.HasDomain() ? pc.Domain() : url.host(), cookie);
97 pc.Value(),
98 pc.Path(),
99 pc.IsSecure(),
100 pc.IsHttpOnly(),
101 base::Time::Now(), // creation time
102 base::Time(), // last access time is unused
103 pc.HasExpires(),
104 pc.HasExpires() ?
105 net::CookieMonster::ParseCookieTime(pc.Expires()) :
106 base::Time());
107 SetCookie(pc.HasDomain() ? pc.Domain() : host, cookie);
108 } 96 }
109 97
110 98
111 void CookieInfoView::ClearCookieDisplay() { 99 void CookieInfoView::ClearCookieDisplay() {
112 std::wstring no_cookie_string = 100 std::wstring no_cookie_string =
113 l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED); 101 l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED);
114 name_value_field_->SetText(no_cookie_string); 102 name_value_field_->SetText(no_cookie_string);
115 content_value_field_->SetText(no_cookie_string); 103 content_value_field_->SetText(no_cookie_string);
116 domain_value_field_->SetText(no_cookie_string); 104 domain_value_field_->SetText(no_cookie_string);
117 path_value_field_->SetText(no_cookie_string); 105 path_value_field_->SetText(no_cookie_string);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 created_value_field_->SetReadOnly(true); 266 created_value_field_->SetReadOnly(true);
279 created_value_field_->RemoveBorder(); 267 created_value_field_->RemoveBorder();
280 created_value_field_->SetBackgroundColor(text_area_background); 268 created_value_field_->SetBackgroundColor(text_area_background);
281 if (expires_value_field_) { 269 if (expires_value_field_) {
282 expires_value_field_->SetReadOnly(true); 270 expires_value_field_->SetReadOnly(true);
283 expires_value_field_->RemoveBorder(); 271 expires_value_field_->RemoveBorder();
284 expires_value_field_->SetBackgroundColor(text_area_background); 272 expires_value_field_->SetBackgroundColor(text_area_background);
285 } 273 }
286 } 274 }
287 275
OLDNEW
« no previous file with comments | « chrome/browser/views/cookie_info_view.h ('k') | chrome/browser/views/cookie_prompt_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698