OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gtk/collected_cookies_gtk.h" | 5 #include "chrome/browser/ui/gtk/collected_cookies_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
| 9 #include "chrome/browser/content_settings/cookie_settings.h" |
9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
11 #include "chrome/browser/cookies_tree_model.h" | 12 #include "chrome/browser/cookies_tree_model.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 14 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
14 #include "chrome/browser/ui/gtk/gtk_chrome_cookie_view.h" | 15 #include "chrome/browser/ui/gtk/gtk_chrome_cookie_view.h" |
15 #include "chrome/browser/ui/gtk/gtk_util.h" | 16 #include "chrome/browser/ui/gtk/gtk_util.h" |
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
17 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
18 #include "content/common/notification_source.h" | 19 #include "content/common/notification_source.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // horizontal axis. | 234 // horizontal axis. |
234 GtkWidget* box = gtk_hbox_new(FALSE, 0); | 235 GtkWidget* box = gtk_hbox_new(FALSE, 0); |
235 gtk_box_pack_start(GTK_BOX(box), cookie_list_vbox, TRUE, TRUE, | 236 gtk_box_pack_start(GTK_BOX(box), cookie_list_vbox, TRUE, TRUE, |
236 gtk_util::kControlSpacing); | 237 gtk_util::kControlSpacing); |
237 return box; | 238 return box; |
238 } | 239 } |
239 | 240 |
240 GtkWidget* CollectedCookiesGtk::CreateBlockedPane() { | 241 GtkWidget* CollectedCookiesGtk::CreateBlockedPane() { |
241 TabContentsWrapper* wrapper = | 242 TabContentsWrapper* wrapper = |
242 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); | 243 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); |
243 HostContentSettingsMap* host_content_settings_map = | 244 CookieSettings* cookie_settings = |
244 wrapper->profile()->GetHostContentSettingsMap(); | 245 wrapper->profile()->GetHostContentSettingsMap()->GetCookieSettings(); |
245 | 246 |
246 GtkWidget* cookie_list_vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 247 GtkWidget* cookie_list_vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
247 | 248 |
248 GtkWidget* label = gtk_label_new( | 249 GtkWidget* label = gtk_label_new( |
249 l10n_util::GetStringUTF8( | 250 l10n_util::GetStringUTF8( |
250 host_content_settings_map->BlockThirdPartyCookies() ? | 251 cookie_settings->BlockThirdPartyCookies() ? |
251 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : | 252 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : |
252 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL).c_str()); | 253 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL).c_str()); |
253 gtk_widget_set_size_request(label, kTreeViewWidth, -1); | 254 gtk_widget_set_size_request(label, kTreeViewWidth, -1); |
254 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | 255 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
255 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 256 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
256 gtk_box_pack_start(GTK_BOX(cookie_list_vbox), label, TRUE, TRUE, | 257 gtk_box_pack_start(GTK_BOX(cookie_list_vbox), label, TRUE, TRUE, |
257 gtk_util::kControlSpacing); | 258 gtk_util::kControlSpacing); |
258 | 259 |
259 GtkWidget* scroll_window = gtk_scrolled_window_new(NULL, NULL); | 260 GtkWidget* scroll_window = gtk_scrolled_window_new(NULL, NULL); |
260 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_window), | 261 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_window), |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this); | 509 tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this); |
509 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_view), path, TRUE); | 510 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_view), path, TRUE); |
510 g_signal_handlers_unblock_by_func( | 511 g_signal_handlers_unblock_by_func( |
511 tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this); | 512 tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this); |
512 } | 513 } |
513 | 514 |
514 void CollectedCookiesGtk::OnTreeViewSelectionChange(GtkWidget* selection) { | 515 void CollectedCookiesGtk::OnTreeViewSelectionChange(GtkWidget* selection) { |
515 EnableControls(); | 516 EnableControls(); |
516 ShowCookieInfo(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook_))); | 517 ShowCookieInfo(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook_))); |
517 } | 518 } |
OLD | NEW |