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

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

Issue 10785017: Move CanonicalCookie into separate files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing include Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/views/cookie_info_view.h" 5 #include "chrome/browser/ui/views/cookie_info_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/time_formatting.h" 9 #include "base/i18n/time_formatting.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/cookies_tree_model.h" 14 #include "chrome/browser/cookies_tree_model.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "grit/locale_settings.h" 16 #include "grit/locale_settings.h"
17 #include "net/cookies/canonical_cookie.h"
17 #include "net/cookies/parsed_cookie.h" 18 #include "net/cookies/parsed_cookie.h"
18 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
20 #include "ui/gfx/color_utils.h" 21 #include "ui/gfx/color_utils.h"
21 #include "ui/views/border.h" 22 #include "ui/views/border.h"
22 #include "ui/views/controls/combobox/combobox.h" 23 #include "ui/views/controls/combobox/combobox.h"
23 #include "ui/views/controls/label.h" 24 #include "ui/views/controls/label.h"
24 #include "ui/views/controls/textfield/textfield.h" 25 #include "ui/views/controls/textfield/textfield.h"
25 #include "ui/views/layout/grid_layout.h" 26 #include "ui/views/layout/grid_layout.h"
26 #include "ui/views/layout/layout_constants.h" 27 #include "ui/views/layout/layout_constants.h"
(...skipping 25 matching lines...) Expand all
52 expires_value_field_(NULL), 53 expires_value_field_(NULL),
53 expires_value_combobox_(NULL), 54 expires_value_combobox_(NULL),
54 expire_view_(NULL), 55 expire_view_(NULL),
55 editable_expiration_date_(editable_expiration_date), 56 editable_expiration_date_(editable_expiration_date),
56 delegate_(NULL) { 57 delegate_(NULL) {
57 } 58 }
58 59
59 CookieInfoView::~CookieInfoView() { 60 CookieInfoView::~CookieInfoView() {
60 } 61 }
61 62
62 void CookieInfoView::SetCookie( 63 void CookieInfoView::SetCookie(const std::string& domain,
63 const std::string& domain, 64 const net::CanonicalCookie& cookie) {
64 const net::CookieMonster::CanonicalCookie& cookie) {
65 name_value_field_->SetText(UTF8ToUTF16(cookie.Name())); 65 name_value_field_->SetText(UTF8ToUTF16(cookie.Name()));
66 content_value_field_->SetText(UTF8ToUTF16(cookie.Value())); 66 content_value_field_->SetText(UTF8ToUTF16(cookie.Value()));
67 domain_value_field_->SetText(UTF8ToUTF16(domain)); 67 domain_value_field_->SetText(UTF8ToUTF16(domain));
68 path_value_field_->SetText(UTF8ToUTF16(cookie.Path())); 68 path_value_field_->SetText(UTF8ToUTF16(cookie.Path()));
69 created_value_field_->SetText( 69 created_value_field_->SetText(
70 base::TimeFormatFriendlyDateAndTime(cookie.CreationDate())); 70 base::TimeFormatFriendlyDateAndTime(cookie.CreationDate()));
71 71
72 string16 expire_text = cookie.IsPersistent() ? 72 string16 expire_text = cookie.IsPersistent() ?
73 base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate()) : 73 base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate()) :
74 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_SESSION); 74 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_SESSION);
(...skipping 15 matching lines...) Expand all
90 send_for_value_field_->SetText(cookie.IsSecure() ? 90 send_for_value_field_->SetText(cookie.IsSecure() ?
91 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_SECURE) : 91 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_SECURE) :
92 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_ANY)); 92 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_ANY));
93 EnableCookieDisplay(true); 93 EnableCookieDisplay(true);
94 Layout(); 94 Layout();
95 } 95 }
96 96
97 void CookieInfoView::SetCookieString(const GURL& url, 97 void CookieInfoView::SetCookieString(const GURL& url,
98 const std::string& cookie_line) { 98 const std::string& cookie_line) {
99 net::ParsedCookie pc(cookie_line); 99 net::ParsedCookie pc(cookie_line);
100 net::CookieMonster::CanonicalCookie cookie(url, pc); 100 net::CanonicalCookie cookie(url, pc);
101 SetCookie(pc.HasDomain() ? pc.Domain() : url.host(), cookie); 101 SetCookie(pc.HasDomain() ? pc.Domain() : url.host(), cookie);
102 } 102 }
103 103
104 104
105 void CookieInfoView::ClearCookieDisplay() { 105 void CookieInfoView::ClearCookieDisplay() {
106 string16 no_cookie_string = 106 string16 no_cookie_string =
107 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NONESELECTED); 107 l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NONESELECTED);
108 name_value_field_->SetText(no_cookie_string); 108 name_value_field_->SetText(no_cookie_string);
109 content_value_field_->SetText(no_cookie_string); 109 content_value_field_->SetText(no_cookie_string);
110 domain_value_field_->SetText(no_cookie_string); 110 domain_value_field_->SetText(no_cookie_string);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 send_for_value_field_->SetBackgroundColor(text_area_background); 277 send_for_value_field_->SetBackgroundColor(text_area_background);
278 created_value_field_->SetReadOnly(true); 278 created_value_field_->SetReadOnly(true);
279 created_value_field_->RemoveBorder(); 279 created_value_field_->RemoveBorder();
280 created_value_field_->SetBackgroundColor(text_area_background); 280 created_value_field_->SetBackgroundColor(text_area_background);
281 if (expires_value_field_) { 281 if (expires_value_field_) {
282 expires_value_field_->SetReadOnly(true); 282 expires_value_field_->SetReadOnly(true);
283 expires_value_field_->RemoveBorder(); 283 expires_value_field_->RemoveBorder();
284 expires_value_field_->SetBackgroundColor(text_area_background); 284 expires_value_field_->SetBackgroundColor(text_area_background);
285 } 285 }
286 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698