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

Side by Side Diff: chrome/browser/cookie_modal_dialog_gtk.cc

Issue 1774005: GTK: The cookie prompt should allow the user to set expire date for HTML cookies (Closed) Base URL: git://codf21.jail.google.com/chromium.git
Patch Set: Fix tests Created 10 years, 7 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
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/cookie_modal_dialog.h" 5 #include "chrome/browser/cookie_modal_dialog.h"
6 6
7 #include "app/gtk_util.h" 7 #include "app/gtk_util.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 gtk_box_pack_start(GTK_BOX(content_area), radio_box, FALSE, FALSE, 0); 103 gtk_box_pack_start(GTK_BOX(content_area), radio_box, FALSE, FALSE, 0);
104 104
105 GtkWidget* expander = gtk_expander_new( 105 GtkWidget* expander = gtk_expander_new(
106 l10n_util::GetStringUTF8(IDS_COOKIE_SHOW_DETAILS_LABEL).c_str()); 106 l10n_util::GetStringUTF8(IDS_COOKIE_SHOW_DETAILS_LABEL).c_str());
107 gtk_expander_set_expanded(GTK_EXPANDER(expander), 107 gtk_expander_set_expanded(GTK_EXPANDER(expander),
108 g_browser_process->local_state()-> 108 g_browser_process->local_state()->
109 GetBoolean(prefs::kCookiePromptExpanded)); 109 GetBoolean(prefs::kCookiePromptExpanded));
110 g_signal_connect(expander, "notify::expanded", 110 g_signal_connect(expander, "notify::expanded",
111 G_CALLBACK(OnExpanderActivate), NULL); 111 G_CALLBACK(OnExpanderActivate), NULL);
112 112
113 GtkChromeCookieView* cookie_view = gtk_chrome_cookie_view_new(); 113 cookie_view_ = gtk_chrome_cookie_view_new(TRUE);
114 gtk_chrome_cookie_view_clear(cookie_view); 114 gtk_chrome_cookie_view_clear(GTK_CHROME_COOKIE_VIEW(cookie_view_));
115 if (type == CookiePromptModalDialog::DIALOG_TYPE_COOKIE) { 115 if (type == CookiePromptModalDialog::DIALOG_TYPE_COOKIE) {
116 gtk_chrome_cookie_view_display_cookie_string(cookie_view, 116 gtk_chrome_cookie_view_display_cookie_string(
117 origin(), cookie_line()); 117 GTK_CHROME_COOKIE_VIEW(cookie_view_),
118 origin(), cookie_line());
118 } else if (type == CookiePromptModalDialog::DIALOG_TYPE_LOCAL_STORAGE) { 119 } else if (type == CookiePromptModalDialog::DIALOG_TYPE_LOCAL_STORAGE) {
119 gtk_chrome_cookie_view_display_local_storage_item( 120 gtk_chrome_cookie_view_display_local_storage_item(
120 cookie_view, 121 GTK_CHROME_COOKIE_VIEW(cookie_view_),
121 origin().host(), 122 origin().host(),
122 local_storage_key(), 123 local_storage_key(),
123 local_storage_value()); 124 local_storage_value());
124 } else if (type == CookiePromptModalDialog::DIALOG_TYPE_DATABASE) { 125 } else if (type == CookiePromptModalDialog::DIALOG_TYPE_DATABASE) {
125 gtk_chrome_cookie_view_display_database_accessed( 126 gtk_chrome_cookie_view_display_database_accessed(
126 cookie_view, 127 GTK_CHROME_COOKIE_VIEW(cookie_view_),
127 origin().host(), 128 origin().host(),
128 database_name(), 129 database_name(),
129 display_name(), 130 display_name(),
130 estimated_size()); 131 estimated_size());
131 } else if (type == CookiePromptModalDialog::DIALOG_TYPE_APPCACHE) { 132 } else if (type == CookiePromptModalDialog::DIALOG_TYPE_APPCACHE) {
132 gtk_chrome_cookie_view_display_appcache_created( 133 gtk_chrome_cookie_view_display_appcache_created(
133 cookie_view, 134 GTK_CHROME_COOKIE_VIEW(cookie_view_),
134 appcache_manifest_url()); 135 appcache_manifest_url());
135 } else { 136 } else {
136 NOTIMPLEMENTED(); 137 NOTIMPLEMENTED();
137 } 138 }
138 gtk_container_add(GTK_CONTAINER(expander), GTK_WIDGET(cookie_view)); 139 gtk_container_add(GTK_CONTAINER(expander), cookie_view_);
139 140
140 gtk_box_pack_end(GTK_BOX(content_area), GTK_WIDGET(expander), 141 gtk_box_pack_end(GTK_BOX(content_area), GTK_WIDGET(expander),
141 FALSE, FALSE, 0); 142 FALSE, FALSE, 0);
142 143
143 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); 144 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
144 g_signal_connect(dialog, "response", 145 g_signal_connect(dialog, "response",
145 G_CALLBACK(AppModalDialog::OnDialogResponse), 146 G_CALLBACK(AppModalDialog::OnDialogResponse),
146 reinterpret_cast<AppModalDialog*>(this)); 147 reinterpret_cast<AppModalDialog*>(this));
147 148
148 return dialog; 149 return dialog;
149 } 150 }
150 151
151 void CookiePromptModalDialog::HandleDialogResponse(GtkDialog* dialog, 152 void CookiePromptModalDialog::HandleDialogResponse(GtkDialog* dialog,
152 gint response_id) { 153 gint response_id) {
153 bool remember_radio = gtk_toggle_button_get_active( 154 bool remember_radio = gtk_toggle_button_get_active(
154 GTK_TOGGLE_BUTTON(remember_radio_)); 155 GTK_TOGGLE_BUTTON(remember_radio_));
155 if (response_id == GTK_RESPONSE_REJECT) { 156 if (response_id == GTK_RESPONSE_REJECT) {
156 BlockSiteData(remember_radio); 157 BlockSiteData(remember_radio);
157 } else if (response_id == GTK_RESPONSE_ACCEPT) { 158 } else if (response_id == GTK_RESPONSE_ACCEPT) {
158 // TODO(erg): Needs to use |session_expire_| instead of true. 159 bool expires = gtk_chrome_cookie_view_session_expires(
159 AllowSiteData(remember_radio, true); 160 GTK_CHROME_COOKIE_VIEW(cookie_view_));
161 AllowSiteData(remember_radio, expires);
160 } else { 162 } else {
161 BlockSiteData(false); 163 BlockSiteData(false);
162 } 164 }
163 gtk_widget_destroy(GTK_WIDGET(dialog)); 165 gtk_widget_destroy(GTK_WIDGET(dialog));
164 166
165 CompleteDialog(); 167 CompleteDialog();
166 168
167 gtk_util::AppModalDismissedUngroupWindows(); 169 gtk_util::AppModalDismissedUngroupWindows();
168 delete this; 170 delete this;
169 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698