OLD | NEW |
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 expires_value_field_->SetText(expire_text); | 82 expires_value_field_->SetText(expire_text); |
83 } | 83 } |
84 | 84 |
85 send_for_value_field_->SetText(cookie.IsSecure() ? | 85 send_for_value_field_->SetText(cookie.IsSecure() ? |
86 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_SECURE) : | 86 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_SECURE) : |
87 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_ANY)); | 87 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_ANY)); |
88 EnableCookieDisplay(true); | 88 EnableCookieDisplay(true); |
89 Layout(); | 89 Layout(); |
90 } | 90 } |
91 | 91 |
| 92 void CookieInfoView::SetCookieString( |
| 93 const std::string& domain, |
| 94 const net::CookieMonster::ParsedCookie& cookie) { |
| 95 name_value_field_->SetText(UTF8ToWide(cookie.Name())); |
| 96 content_value_field_->SetText(UTF8ToWide(cookie.Value())); |
| 97 domain_value_field_->SetText(UTF8ToWide(domain)); |
| 98 path_value_field_->SetText(UTF8ToWide(cookie.Path())); |
| 99 created_value_field_->SetText( |
| 100 base::TimeFormatFriendlyDateAndTime(base::Time::Now())); |
| 101 |
| 102 std::wstring expire_text = cookie.HasExpires() ? |
| 103 base::TimeFormatFriendlyDateAndTime( |
| 104 net::CookieMonster::ParseCookieTime(cookie.Expires())) : |
| 105 l10n_util::GetString(IDS_COOKIES_COOKIE_EXPIRES_SESSION); |
| 106 |
| 107 if (editable_expiration_date_) { |
| 108 expire_combo_values_.clear(); |
| 109 if (cookie.HasExpires()) |
| 110 expire_combo_values_.push_back(expire_text); |
| 111 expire_combo_values_.push_back( |
| 112 l10n_util::GetString(IDS_COOKIES_COOKIE_EXPIRES_SESSION)); |
| 113 expires_value_combobox_->ModelChanged(); |
| 114 expires_value_combobox_->SetSelectedItem(0); |
| 115 expires_value_combobox_->SetEnabled(true); |
| 116 } else { |
| 117 expires_value_field_->SetText(expire_text); |
| 118 } |
| 119 |
| 120 send_for_value_field_->SetText(cookie.IsSecure() ? |
| 121 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_SECURE) : |
| 122 l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_ANY)); |
| 123 EnableCookieDisplay(true); |
| 124 Layout(); |
| 125 } |
| 126 |
92 | 127 |
93 void CookieInfoView::ClearCookieDisplay() { | 128 void CookieInfoView::ClearCookieDisplay() { |
94 std::wstring no_cookie_string = | 129 std::wstring no_cookie_string = |
95 l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED); | 130 l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED); |
96 name_value_field_->SetText(no_cookie_string); | 131 name_value_field_->SetText(no_cookie_string); |
97 content_value_field_->SetText(no_cookie_string); | 132 content_value_field_->SetText(no_cookie_string); |
98 domain_value_field_->SetText(no_cookie_string); | 133 domain_value_field_->SetText(no_cookie_string); |
99 path_value_field_->SetText(no_cookie_string); | 134 path_value_field_->SetText(no_cookie_string); |
100 send_for_value_field_->SetText(no_cookie_string); | 135 send_for_value_field_->SetText(no_cookie_string); |
101 created_value_field_->SetText(no_cookie_string); | 136 created_value_field_->SetText(no_cookie_string); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 created_value_field_->SetReadOnly(true); | 295 created_value_field_->SetReadOnly(true); |
261 created_value_field_->RemoveBorder(); | 296 created_value_field_->RemoveBorder(); |
262 created_value_field_->SetBackgroundColor(text_area_background); | 297 created_value_field_->SetBackgroundColor(text_area_background); |
263 if (expires_value_field_) { | 298 if (expires_value_field_) { |
264 expires_value_field_->SetReadOnly(true); | 299 expires_value_field_->SetReadOnly(true); |
265 expires_value_field_->RemoveBorder(); | 300 expires_value_field_->RemoveBorder(); |
266 expires_value_field_->SetBackgroundColor(text_area_background); | 301 expires_value_field_->SetBackgroundColor(text_area_background); |
267 } | 302 } |
268 } | 303 } |
269 | 304 |
OLD | NEW |