| 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/gtk/gtk_chrome_cookie_view.h" | 5 #include "chrome/browser/gtk/gtk_chrome_cookie_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/gtk/gtk_util.h" | 10 #include "chrome/browser/gtk/gtk_util.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // GTK_NO_WINDOW widgets like GtkLabel don't draw their own background, so we | 21 // GTK_NO_WINDOW widgets like GtkLabel don't draw their own background, so we |
| 22 // combine the normal or insensitive foreground of the label style with the | 22 // combine the normal or insensitive foreground of the label style with the |
| 23 // normal background of the window style to achieve the "normal label" and | 23 // normal background of the window style to achieve the "normal label" and |
| 24 // "insensitive label" colors. | 24 // "insensitive label" colors. |
| 25 gtk_widget_modify_base(entry, GTK_STATE_NORMAL, | 25 gtk_widget_modify_base(entry, GTK_STATE_NORMAL, |
| 26 &dialog_style->bg[GTK_STATE_NORMAL]); | 26 &dialog_style->bg[GTK_STATE_NORMAL]); |
| 27 gtk_widget_modify_base(entry, GTK_STATE_INSENSITIVE, | 27 gtk_widget_modify_base(entry, GTK_STATE_INSENSITIVE, |
| 28 &dialog_style->bg[GTK_STATE_NORMAL]); | 28 &dialog_style->bg[GTK_STATE_NORMAL]); |
| 29 } | 29 } |
| 30 | 30 |
| 31 GtkWidget* InitDetailRow(int row, int label_id, | 31 GtkWidget* InitRowLabel(int row, int label_id, GtkWidget* details_table) { |
| 32 GtkWidget* details_table, GtkWidget** entry) { | |
| 33 GtkWidget* name_label = gtk_label_new( | 32 GtkWidget* name_label = gtk_label_new( |
| 34 l10n_util::GetStringUTF8(label_id).c_str()); | 33 l10n_util::GetStringUTF8(label_id).c_str()); |
| 35 gtk_misc_set_alignment(GTK_MISC(name_label), 1, 0.5); | 34 gtk_misc_set_alignment(GTK_MISC(name_label), 1, 0.5); |
| 36 gtk_table_attach(GTK_TABLE(details_table), name_label, | 35 gtk_table_attach(GTK_TABLE(details_table), name_label, |
| 37 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); | 36 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); |
| 38 | 37 |
| 38 return name_label; |
| 39 } |
| 40 |
| 41 GtkWidget* InitDetailRow(int row, int label_id, |
| 42 GtkWidget* details_table, GtkWidget** entry) { |
| 43 GtkWidget* name_label = InitRowLabel(row, label_id, details_table); |
| 44 |
| 39 *entry = gtk_entry_new(); | 45 *entry = gtk_entry_new(); |
| 40 | |
| 41 gtk_entry_set_editable(GTK_ENTRY(*entry), FALSE); | 46 gtk_entry_set_editable(GTK_ENTRY(*entry), FALSE); |
| 42 gtk_entry_set_has_frame(GTK_ENTRY(*entry), FALSE); | 47 gtk_entry_set_has_frame(GTK_ENTRY(*entry), FALSE); |
| 43 gtk_table_attach_defaults(GTK_TABLE(details_table), *entry, | 48 gtk_table_attach_defaults(GTK_TABLE(details_table), *entry, |
| 44 1, 2, row, row + 1); | 49 1, 2, row, row + 1); |
| 45 | 50 |
| 46 return name_label; | 51 return name_label; |
| 47 } | 52 } |
| 48 | 53 |
| 54 GtkWidget* InitComboboxRow(int row, int label_id, |
| 55 GtkWidget* details_table, |
| 56 GtkWidget** combobox, |
| 57 GtkListStore** store) { |
| 58 GtkWidget* name_label = InitRowLabel(row, label_id, details_table); |
| 59 |
| 60 *store = gtk_list_store_new(1, G_TYPE_STRING); |
| 61 *combobox = gtk_combo_box_new_with_model(GTK_TREE_MODEL(*store)); |
| 62 g_object_unref(*store); |
| 63 |
| 64 GtkCellRenderer* cell = gtk_cell_renderer_text_new(); |
| 65 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(*combobox), cell, TRUE); |
| 66 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(*combobox), cell, |
| 67 "text", 0, NULL); |
| 68 |
| 69 GtkWidget* hbox = gtk_hbox_new(FALSE, 0); |
| 70 gtk_box_pack_start(GTK_BOX(hbox), *combobox, FALSE, FALSE, 0); |
| 71 |
| 72 gtk_table_attach_defaults(GTK_TABLE(details_table), hbox, |
| 73 1, 2, row, row + 1); |
| 74 |
| 75 return name_label; |
| 76 } |
| 77 |
| 49 void InitStyles(GtkChromeCookieView *self) { | 78 void InitStyles(GtkChromeCookieView *self) { |
| 50 GtkStyle* label_style = gtk_widget_get_style(self->first_label_); | 79 GtkStyle* label_style = gtk_widget_get_style(self->first_label_); |
| 51 GtkStyle* dialog_style = gtk_widget_get_style(GTK_WIDGET(self)); | 80 GtkStyle* dialog_style = gtk_widget_get_style(GTK_WIDGET(self)); |
| 52 | 81 |
| 53 // Cookie details. | 82 // Cookie details. |
| 54 InitBrowserDetailStyle(self->cookie_name_entry_, label_style, dialog_style); | 83 InitBrowserDetailStyle(self->cookie_name_entry_, label_style, dialog_style); |
| 55 InitBrowserDetailStyle(self->cookie_content_entry_, label_style, | 84 InitBrowserDetailStyle(self->cookie_content_entry_, label_style, |
| 56 dialog_style); | 85 dialog_style); |
| 57 InitBrowserDetailStyle(self->cookie_domain_entry_, label_style, dialog_style); | 86 InitBrowserDetailStyle(self->cookie_domain_entry_, label_style, dialog_style); |
| 58 InitBrowserDetailStyle(self->cookie_path_entry_, label_style, dialog_style); | 87 InitBrowserDetailStyle(self->cookie_path_entry_, label_style, dialog_style); |
| 59 InitBrowserDetailStyle(self->cookie_send_for_entry_, label_style, | 88 InitBrowserDetailStyle(self->cookie_send_for_entry_, label_style, |
| 60 dialog_style); | 89 dialog_style); |
| 61 InitBrowserDetailStyle(self->cookie_created_entry_, label_style, | 90 InitBrowserDetailStyle(self->cookie_created_entry_, label_style, |
| 62 dialog_style); | 91 dialog_style); |
| 63 InitBrowserDetailStyle(self->cookie_expires_entry_, label_style, | 92 if (self->cookie_expires_entry_) { |
| 64 dialog_style); | 93 InitBrowserDetailStyle(self->cookie_expires_entry_, label_style, |
| 94 dialog_style); |
| 95 } |
| 65 | 96 |
| 66 // Database details. | 97 // Database details. |
| 67 InitBrowserDetailStyle(self->database_name_entry_, label_style, dialog_style); | 98 InitBrowserDetailStyle(self->database_name_entry_, label_style, dialog_style); |
| 68 InitBrowserDetailStyle(self->database_description_entry_, label_style, | 99 InitBrowserDetailStyle(self->database_description_entry_, label_style, |
| 69 dialog_style); | 100 dialog_style); |
| 70 InitBrowserDetailStyle(self->database_size_entry_, label_style, dialog_style); | 101 InitBrowserDetailStyle(self->database_size_entry_, label_style, dialog_style); |
| 71 InitBrowserDetailStyle(self->database_last_modified_entry_, label_style, | 102 InitBrowserDetailStyle(self->database_last_modified_entry_, label_style, |
| 72 dialog_style); | 103 dialog_style); |
| 73 | 104 |
| 74 // Local storage details. | 105 // Local storage details. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 143 } |
| 113 | 144 |
| 114 void SetCookieDetailsSensitivity(GtkChromeCookieView *self, | 145 void SetCookieDetailsSensitivity(GtkChromeCookieView *self, |
| 115 gboolean enabled) { | 146 gboolean enabled) { |
| 116 gtk_widget_set_sensitive(self->cookie_name_entry_, enabled); | 147 gtk_widget_set_sensitive(self->cookie_name_entry_, enabled); |
| 117 gtk_widget_set_sensitive(self->cookie_content_entry_, enabled); | 148 gtk_widget_set_sensitive(self->cookie_content_entry_, enabled); |
| 118 gtk_widget_set_sensitive(self->cookie_domain_entry_, enabled); | 149 gtk_widget_set_sensitive(self->cookie_domain_entry_, enabled); |
| 119 gtk_widget_set_sensitive(self->cookie_path_entry_, enabled); | 150 gtk_widget_set_sensitive(self->cookie_path_entry_, enabled); |
| 120 gtk_widget_set_sensitive(self->cookie_send_for_entry_, enabled); | 151 gtk_widget_set_sensitive(self->cookie_send_for_entry_, enabled); |
| 121 gtk_widget_set_sensitive(self->cookie_created_entry_, enabled); | 152 gtk_widget_set_sensitive(self->cookie_created_entry_, enabled); |
| 122 gtk_widget_set_sensitive(self->cookie_expires_entry_, enabled); | 153 if (self->cookie_expires_entry_) |
| 154 gtk_widget_set_sensitive(self->cookie_expires_entry_, enabled); |
| 155 else |
| 156 gtk_widget_set_sensitive(self->cookie_expires_combobox_, enabled); |
| 123 } | 157 } |
| 124 | 158 |
| 125 void SetDatabaseDetailsSensitivity(GtkChromeCookieView *self, | 159 void SetDatabaseDetailsSensitivity(GtkChromeCookieView *self, |
| 126 gboolean enabled) { | 160 gboolean enabled) { |
| 127 gtk_widget_set_sensitive(self->database_name_entry_, enabled); | 161 gtk_widget_set_sensitive(self->database_name_entry_, enabled); |
| 128 gtk_widget_set_sensitive(self->database_description_entry_, enabled); | 162 gtk_widget_set_sensitive(self->database_description_entry_, enabled); |
| 129 gtk_widget_set_sensitive(self->database_size_entry_, enabled); | 163 gtk_widget_set_sensitive(self->database_size_entry_, enabled); |
| 130 gtk_widget_set_sensitive(self->database_last_modified_entry_, enabled); | 164 gtk_widget_set_sensitive(self->database_last_modified_entry_, enabled); |
| 131 } | 165 } |
| 132 | 166 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 gtk_entry_set_text(GTK_ENTRY(self->cookie_name_entry_), | 205 gtk_entry_set_text(GTK_ENTRY(self->cookie_name_entry_), |
| 172 no_cookie.c_str()); | 206 no_cookie.c_str()); |
| 173 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_), | 207 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_), |
| 174 no_cookie.c_str()); | 208 no_cookie.c_str()); |
| 175 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_), | 209 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_), |
| 176 no_cookie.c_str()); | 210 no_cookie.c_str()); |
| 177 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_), | 211 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_), |
| 178 no_cookie.c_str()); | 212 no_cookie.c_str()); |
| 179 gtk_entry_set_text(GTK_ENTRY(self->cookie_created_entry_), | 213 gtk_entry_set_text(GTK_ENTRY(self->cookie_created_entry_), |
| 180 no_cookie.c_str()); | 214 no_cookie.c_str()); |
| 181 gtk_entry_set_text(GTK_ENTRY(self->cookie_expires_entry_), | 215 if (self->cookie_expires_entry_) { |
| 182 no_cookie.c_str()); | 216 gtk_entry_set_text(GTK_ENTRY(self->cookie_expires_entry_), |
| 217 no_cookie.c_str()); |
| 218 } else { |
| 219 GtkListStore* store = self->cookie_expires_combobox_store_; |
| 220 GtkTreeIter iter; |
| 221 gtk_list_store_clear(store); |
| 222 |
| 223 gtk_list_store_append(store, &iter); |
| 224 gtk_list_store_set(store, &iter, 0, no_cookie.c_str(), -1); |
| 225 |
| 226 gtk_combo_box_set_active(GTK_COMBO_BOX(self->cookie_expires_combobox_), |
| 227 0); |
| 228 } |
| 183 gtk_entry_set_text(GTK_ENTRY(self->cookie_send_for_entry_), | 229 gtk_entry_set_text(GTK_ENTRY(self->cookie_send_for_entry_), |
| 184 no_cookie.c_str()); | 230 no_cookie.c_str()); |
| 185 SetCookieDetailsSensitivity(self, FALSE); | 231 SetCookieDetailsSensitivity(self, FALSE); |
| 186 } | 232 } |
| 187 | 233 |
| 188 void UpdateVisibleDetailedInfo(GtkChromeCookieView *self, GtkWidget* table) { | 234 void UpdateVisibleDetailedInfo(GtkChromeCookieView *self, GtkWidget* table) { |
| 189 SetCookieDetailsSensitivity(self, table == self->cookie_details_table_); | 235 SetCookieDetailsSensitivity(self, table == self->cookie_details_table_); |
| 190 SetDatabaseDetailsSensitivity(self, table == self->database_details_table_); | 236 SetDatabaseDetailsSensitivity(self, table == self->database_details_table_); |
| 191 SetLocalStorageDetailsSensitivity(self, | 237 SetLocalStorageDetailsSensitivity(self, |
| 192 table == self->local_storage_details_table_); | 238 table == self->local_storage_details_table_); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 219 } | 265 } |
| 220 | 266 |
| 221 } // namespace | 267 } // namespace |
| 222 | 268 |
| 223 G_DEFINE_TYPE(GtkChromeCookieView, gtk_chrome_cookie_view, GTK_TYPE_FRAME) | 269 G_DEFINE_TYPE(GtkChromeCookieView, gtk_chrome_cookie_view, GTK_TYPE_FRAME) |
| 224 | 270 |
| 225 static void gtk_chrome_cookie_view_class_init(GtkChromeCookieViewClass *klass) { | 271 static void gtk_chrome_cookie_view_class_init(GtkChromeCookieViewClass *klass) { |
| 226 } | 272 } |
| 227 | 273 |
| 228 static void gtk_chrome_cookie_view_init(GtkChromeCookieView *self) { | 274 static void gtk_chrome_cookie_view_init(GtkChromeCookieView *self) { |
| 275 } |
| 276 |
| 277 void BuildWidgets(GtkChromeCookieView *self, gboolean editable_expiration) { |
| 229 self->table_box_ = gtk_vbox_new(FALSE, 0); | 278 self->table_box_ = gtk_vbox_new(FALSE, 0); |
| 230 gtk_widget_set_no_show_all(self->table_box_, TRUE); | 279 gtk_widget_set_no_show_all(self->table_box_, TRUE); |
| 231 | 280 |
| 232 // Cookie details. | 281 // Cookie details. |
| 233 self->cookie_details_table_ = gtk_table_new(7, 2, FALSE); | 282 self->cookie_details_table_ = gtk_table_new(7, 2, FALSE); |
| 234 gtk_container_add(GTK_CONTAINER(self->table_box_), | 283 gtk_container_add(GTK_CONTAINER(self->table_box_), |
| 235 self->cookie_details_table_); | 284 self->cookie_details_table_); |
| 236 gtk_table_set_col_spacing(GTK_TABLE(self->cookie_details_table_), 0, | 285 gtk_table_set_col_spacing(GTK_TABLE(self->cookie_details_table_), 0, |
| 237 gtk_util::kLabelSpacing); | 286 gtk_util::kLabelSpacing); |
| 238 | 287 |
| 239 int row = 0; | 288 int row = 0; |
| 240 self->first_label_ = InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, | 289 self->first_label_ = InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, |
| 241 self->cookie_details_table_, &self->cookie_name_entry_); | 290 self->cookie_details_table_, &self->cookie_name_entry_); |
| 242 InitDetailRow(row++, IDS_COOKIES_COOKIE_CONTENT_LABEL, | 291 InitDetailRow(row++, IDS_COOKIES_COOKIE_CONTENT_LABEL, |
| 243 self->cookie_details_table_, &self->cookie_content_entry_); | 292 self->cookie_details_table_, &self->cookie_content_entry_); |
| 244 InitDetailRow(row++, IDS_COOKIES_COOKIE_DOMAIN_LABEL, | 293 InitDetailRow(row++, IDS_COOKIES_COOKIE_DOMAIN_LABEL, |
| 245 self->cookie_details_table_, &self->cookie_domain_entry_); | 294 self->cookie_details_table_, &self->cookie_domain_entry_); |
| 246 InitDetailRow(row++, IDS_COOKIES_COOKIE_PATH_LABEL, | 295 InitDetailRow(row++, IDS_COOKIES_COOKIE_PATH_LABEL, |
| 247 self->cookie_details_table_, &self->cookie_path_entry_); | 296 self->cookie_details_table_, &self->cookie_path_entry_); |
| 248 InitDetailRow(row++, IDS_COOKIES_COOKIE_SENDFOR_LABEL, | 297 InitDetailRow(row++, IDS_COOKIES_COOKIE_SENDFOR_LABEL, |
| 249 self->cookie_details_table_, &self->cookie_send_for_entry_); | 298 self->cookie_details_table_, &self->cookie_send_for_entry_); |
| 250 InitDetailRow(row++, IDS_COOKIES_COOKIE_CREATED_LABEL, | 299 InitDetailRow(row++, IDS_COOKIES_COOKIE_CREATED_LABEL, |
| 251 self->cookie_details_table_, &self->cookie_created_entry_); | 300 self->cookie_details_table_, &self->cookie_created_entry_); |
| 252 InitDetailRow(row++, IDS_COOKIES_COOKIE_EXPIRES_LABEL, | 301 if (editable_expiration) { |
| 253 self->cookie_details_table_, &self->cookie_expires_entry_); | 302 InitComboboxRow(row++, IDS_COOKIES_COOKIE_EXPIRES_LABEL, |
| 303 self->cookie_details_table_, |
| 304 &self->cookie_expires_combobox_, |
| 305 &self->cookie_expires_combobox_store_); |
| 306 } else { |
| 307 InitDetailRow(row++, IDS_COOKIES_COOKIE_EXPIRES_LABEL, |
| 308 self->cookie_details_table_, &self->cookie_expires_entry_); |
| 309 } |
| 254 | 310 |
| 255 // Database details. | 311 // Database details. |
| 256 self->database_details_table_ = gtk_table_new(4, 2, FALSE); | 312 self->database_details_table_ = gtk_table_new(4, 2, FALSE); |
| 257 gtk_container_add(GTK_CONTAINER(self->table_box_), | 313 gtk_container_add(GTK_CONTAINER(self->table_box_), |
| 258 self->database_details_table_); | 314 self->database_details_table_); |
| 259 gtk_table_set_col_spacing(GTK_TABLE(self->database_details_table_), 0, | 315 gtk_table_set_col_spacing(GTK_TABLE(self->database_details_table_), 0, |
| 260 gtk_util::kLabelSpacing); | 316 gtk_util::kLabelSpacing); |
| 261 | 317 |
| 262 InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, | 318 InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, |
| 263 self->database_details_table_, &self->database_name_entry_); | 319 self->database_details_table_, &self->database_name_entry_); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 gtk_util::kLabelSpacing); | 410 gtk_util::kLabelSpacing); |
| 355 row = 0; | 411 row = 0; |
| 356 InitDetailRow(row++, IDS_COOKIES_APPLICATION_CACHE_MANIFEST_LABEL, | 412 InitDetailRow(row++, IDS_COOKIES_APPLICATION_CACHE_MANIFEST_LABEL, |
| 357 self->appcache_created_table_, | 413 self->appcache_created_table_, |
| 358 &self->appcache_created_manifest_entry_); | 414 &self->appcache_created_manifest_entry_); |
| 359 | 415 |
| 360 gtk_frame_set_shadow_type(GTK_FRAME(self), GTK_SHADOW_ETCHED_IN); | 416 gtk_frame_set_shadow_type(GTK_FRAME(self), GTK_SHADOW_ETCHED_IN); |
| 361 gtk_container_add(GTK_CONTAINER(self), self->table_box_); | 417 gtk_container_add(GTK_CONTAINER(self), self->table_box_); |
| 362 } | 418 } |
| 363 | 419 |
| 364 GtkChromeCookieView* gtk_chrome_cookie_view_new() { | 420 GtkWidget* gtk_chrome_cookie_view_new(gboolean editable_expiration) { |
| 365 GtkChromeCookieView* view = GTK_CHROME_COOKIE_VIEW( | 421 GtkChromeCookieView* view = GTK_CHROME_COOKIE_VIEW( |
| 366 g_object_new(GTK_TYPE_CHROME_COOKIE_VIEW, NULL)); | 422 g_object_new(GTK_TYPE_CHROME_COOKIE_VIEW, NULL)); |
| 423 BuildWidgets(view, editable_expiration); |
| 367 g_signal_connect(view, "realize", G_CALLBACK(InitStyles), NULL); | 424 g_signal_connect(view, "realize", G_CALLBACK(InitStyles), NULL); |
| 368 return view; | 425 return GTK_WIDGET(view); |
| 369 } | 426 } |
| 370 | 427 |
| 371 void gtk_chrome_cookie_view_clear(GtkChromeCookieView* self) { | 428 void gtk_chrome_cookie_view_clear(GtkChromeCookieView* self) { |
| 372 UpdateVisibleDetailedInfo(self, self->cookie_details_table_); | 429 UpdateVisibleDetailedInfo(self, self->cookie_details_table_); |
| 373 ClearCookieDetails(self); | 430 ClearCookieDetails(self); |
| 374 } | 431 } |
| 375 | 432 |
| 376 // Switches the display to showing the passed in cookie. | 433 // Switches the display to showing the passed in cookie. |
| 377 void gtk_chrome_cookie_view_display_cookie( | 434 void gtk_chrome_cookie_view_display_cookie( |
| 378 GtkChromeCookieView* self, | 435 GtkChromeCookieView* self, |
| 379 const std::string& domain, | 436 const std::string& domain, |
| 380 const net::CookieMonster::CanonicalCookie& cookie) { | 437 const net::CookieMonster::CanonicalCookie& cookie) { |
| 381 UpdateVisibleDetailedInfo(self, self->cookie_details_table_); | 438 UpdateVisibleDetailedInfo(self, self->cookie_details_table_); |
| 382 | 439 |
| 383 gtk_entry_set_text(GTK_ENTRY(self->cookie_name_entry_), | 440 gtk_entry_set_text(GTK_ENTRY(self->cookie_name_entry_), |
| 384 cookie.Name().c_str()); | 441 cookie.Name().c_str()); |
| 385 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_), | 442 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_), |
| 386 cookie.Value().c_str()); | 443 cookie.Value().c_str()); |
| 387 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_), | 444 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_), |
| 388 domain.c_str()); | 445 domain.c_str()); |
| 389 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_), | 446 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_), |
| 390 cookie.Path().c_str()); | 447 cookie.Path().c_str()); |
| 391 gtk_entry_set_text(GTK_ENTRY(self->cookie_created_entry_), | 448 gtk_entry_set_text(GTK_ENTRY(self->cookie_created_entry_), |
| 392 WideToUTF8(base::TimeFormatFriendlyDateAndTime( | 449 WideToUTF8(base::TimeFormatFriendlyDateAndTime( |
| 393 cookie.CreationDate())).c_str()); | 450 cookie.CreationDate())).c_str()); |
| 394 if (cookie.DoesExpire()) { | 451 |
| 452 std::string expire_text = cookie.DoesExpire() ? |
| 453 WideToUTF8(base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate())) : |
| 454 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION); |
| 455 |
| 456 if (self->cookie_expires_entry_) { |
| 395 gtk_entry_set_text(GTK_ENTRY(self->cookie_expires_entry_), | 457 gtk_entry_set_text(GTK_ENTRY(self->cookie_expires_entry_), |
| 396 WideToUTF8(base::TimeFormatFriendlyDateAndTime( | 458 expire_text.c_str()); |
| 397 cookie.ExpiryDate())).c_str()); | |
| 398 } else { | 459 } else { |
| 399 gtk_entry_set_text(GTK_ENTRY(self->cookie_expires_entry_), | 460 GtkListStore* store = self->cookie_expires_combobox_store_; |
| 400 l10n_util::GetStringUTF8( | 461 GtkTreeIter iter; |
| 401 IDS_COOKIES_COOKIE_EXPIRES_SESSION).c_str()); | 462 gtk_list_store_clear(store); |
| 463 |
| 464 if (cookie.DoesExpire()) { |
| 465 gtk_list_store_append(store, &iter); |
| 466 gtk_list_store_set(store, &iter, 0, expire_text.c_str(), -1); |
| 467 } |
| 468 |
| 469 gtk_list_store_append(store, &iter); |
| 470 gtk_list_store_set( |
| 471 store, &iter, 0, |
| 472 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION).c_str(), |
| 473 -1); |
| 474 |
| 475 gtk_combo_box_set_active(GTK_COMBO_BOX(self->cookie_expires_combobox_), |
| 476 0); |
| 402 } | 477 } |
| 478 |
| 403 gtk_entry_set_text( | 479 gtk_entry_set_text( |
| 404 GTK_ENTRY(self->cookie_send_for_entry_), | 480 GTK_ENTRY(self->cookie_send_for_entry_), |
| 405 l10n_util::GetStringUTF8(cookie.IsSecure() ? | 481 l10n_util::GetStringUTF8(cookie.IsSecure() ? |
| 406 IDS_COOKIES_COOKIE_SENDFOR_SECURE : | 482 IDS_COOKIES_COOKIE_SENDFOR_SECURE : |
| 407 IDS_COOKIES_COOKIE_SENDFOR_ANY).c_str()); | 483 IDS_COOKIES_COOKIE_SENDFOR_ANY).c_str()); |
| 408 SetCookieDetailsSensitivity(self, TRUE); | 484 SetCookieDetailsSensitivity(self, TRUE); |
| 409 } | 485 } |
| 410 | 486 |
| 411 void gtk_chrome_cookie_view_display_cookie_string( | 487 void gtk_chrome_cookie_view_display_cookie_string( |
| 412 GtkChromeCookieView* self, | 488 GtkChromeCookieView* self, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 } | 603 } |
| 528 | 604 |
| 529 void gtk_chrome_cookie_view_display_appcache_created( | 605 void gtk_chrome_cookie_view_display_appcache_created( |
| 530 GtkChromeCookieView* self, | 606 GtkChromeCookieView* self, |
| 531 const GURL& manifest_url) { | 607 const GURL& manifest_url) { |
| 532 UpdateVisibleDetailedInfo(self, self->appcache_created_table_); | 608 UpdateVisibleDetailedInfo(self, self->appcache_created_table_); |
| 533 gtk_entry_set_text(GTK_ENTRY(self->appcache_created_manifest_entry_), | 609 gtk_entry_set_text(GTK_ENTRY(self->appcache_created_manifest_entry_), |
| 534 manifest_url.spec().c_str()); | 610 manifest_url.spec().c_str()); |
| 535 SetAppCacheCreatedSensitivity(self, TRUE); | 611 SetAppCacheCreatedSensitivity(self, TRUE); |
| 536 } | 612 } |
| 613 |
| 614 bool gtk_chrome_cookie_view_session_expires(GtkChromeCookieView* self) { |
| 615 if (self->cookie_expires_entry_) |
| 616 return false; |
| 617 |
| 618 GtkListStore* store = self->cookie_expires_combobox_store_; |
| 619 int store_size = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
| 620 if (store_size == 1) |
| 621 return false; |
| 622 |
| 623 DCHECK_EQ(2, store_size); |
| 624 |
| 625 int selected = gtk_combo_box_get_active(GTK_COMBO_BOX( |
| 626 self->cookie_expires_combobox_)); |
| 627 return selected == 1; |
| 628 } |
| OLD | NEW |