| 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/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
| 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 11 #include "chrome/browser/cookies_tree_model.h" | 11 #include "chrome/browser/cookies_tree_model.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 13 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
| 14 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 14 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
| 15 #include "chrome/browser/ui/gtk/gtk_chrome_cookie_view.h" | 15 #include "chrome/browser/ui/gtk/gtk_chrome_cookie_view.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_util.h" | 16 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "content/common/notification_source.h" | 19 #include "content/common/notification_source.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // horizontal axis. | 235 // horizontal axis. |
| 236 GtkWidget* box = gtk_hbox_new(FALSE, 0); | 236 GtkWidget* box = gtk_hbox_new(FALSE, 0); |
| 237 gtk_box_pack_start(GTK_BOX(box), cookie_list_vbox, TRUE, TRUE, | 237 gtk_box_pack_start(GTK_BOX(box), cookie_list_vbox, TRUE, TRUE, |
| 238 ui::kControlSpacing); | 238 ui::kControlSpacing); |
| 239 return box; | 239 return box; |
| 240 } | 240 } |
| 241 | 241 |
| 242 GtkWidget* CollectedCookiesGtk::CreateBlockedPane() { | 242 GtkWidget* CollectedCookiesGtk::CreateBlockedPane() { |
| 243 TabContentsWrapper* wrapper = | 243 TabContentsWrapper* wrapper = |
| 244 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); | 244 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); |
| 245 HostContentSettingsMap* host_content_settings_map = | 245 CookieSettings* cookie_settings = |
| 246 wrapper->profile()->GetHostContentSettingsMap(); | 246 CookieSettings::GetForProfile(wrapper->profile()); |
| 247 | 247 |
| 248 GtkWidget* cookie_list_vbox = gtk_vbox_new(FALSE, ui::kControlSpacing); | 248 GtkWidget* cookie_list_vbox = gtk_vbox_new(FALSE, ui::kControlSpacing); |
| 249 | 249 |
| 250 GtkWidget* label = gtk_label_new( | 250 GtkWidget* label = gtk_label_new( |
| 251 l10n_util::GetStringUTF8( | 251 l10n_util::GetStringUTF8( |
| 252 host_content_settings_map->BlockThirdPartyCookies() ? | 252 cookie_settings->ShouldBlockThirdPartyCookies() ? |
| 253 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : | 253 IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED : |
| 254 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL).c_str()); | 254 IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL).c_str()); |
| 255 gtk_widget_set_size_request(label, kTreeViewWidth, -1); | 255 gtk_widget_set_size_request(label, kTreeViewWidth, -1); |
| 256 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | 256 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
| 257 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 257 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 258 gtk_box_pack_start(GTK_BOX(cookie_list_vbox), label, TRUE, TRUE, | 258 gtk_box_pack_start(GTK_BOX(cookie_list_vbox), label, TRUE, TRUE, |
| 259 ui::kControlSpacing); | 259 ui::kControlSpacing); |
| 260 | 260 |
| 261 GtkWidget* scroll_window = gtk_scrolled_window_new(NULL, NULL); | 261 GtkWidget* scroll_window = gtk_scrolled_window_new(NULL, NULL); |
| 262 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_window), | 262 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_window), |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 continue; | 457 continue; |
| 458 CookieTreeOriginNode* origin_node = static_cast<CookieTreeOriginNode*>( | 458 CookieTreeOriginNode* origin_node = static_cast<CookieTreeOriginNode*>( |
| 459 node); | 459 node); |
| 460 if (origin_node->CanCreateContentException()) { | 460 if (origin_node->CanCreateContentException()) { |
| 461 if (!last_domain_name.empty()) | 461 if (!last_domain_name.empty()) |
| 462 multiple_domains_added = true; | 462 multiple_domains_added = true; |
| 463 last_domain_name = origin_node->GetTitle(); | 463 last_domain_name = origin_node->GetTitle(); |
| 464 Profile* profile = | 464 Profile* profile = |
| 465 Profile::FromBrowserContext(tab_contents_->browser_context()); | 465 Profile::FromBrowserContext(tab_contents_->browser_context()); |
| 466 origin_node->CreateContentException( | 466 origin_node->CreateContentException( |
| 467 profile->GetHostContentSettingsMap(), setting); | 467 CookieSettings::GetForProfile(profile), setting); |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 g_list_foreach(paths, reinterpret_cast<GFunc>(gtk_tree_path_free), NULL); | 470 g_list_foreach(paths, reinterpret_cast<GFunc>(gtk_tree_path_free), NULL); |
| 471 g_list_free(paths); | 471 g_list_free(paths); |
| 472 if (last_domain_name.empty()) { | 472 if (last_domain_name.empty()) { |
| 473 gtk_widget_hide(infobar_); | 473 gtk_widget_hide(infobar_); |
| 474 } else { | 474 } else { |
| 475 gtk_label_set_text( | 475 gtk_label_set_text( |
| 476 GTK_LABEL(infobar_label_), GetInfobarLabel( | 476 GTK_LABEL(infobar_label_), GetInfobarLabel( |
| 477 setting, multiple_domains_added, last_domain_name).c_str()); | 477 setting, multiple_domains_added, last_domain_name).c_str()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this); | 510 tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this); |
| 511 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_view), path, TRUE); | 511 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_view), path, TRUE); |
| 512 g_signal_handlers_unblock_by_func( | 512 g_signal_handlers_unblock_by_func( |
| 513 tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this); | 513 tree_view, reinterpret_cast<gpointer>(OnTreeViewRowExpandedThunk), this); |
| 514 } | 514 } |
| 515 | 515 |
| 516 void CollectedCookiesGtk::OnTreeViewSelectionChange(GtkWidget* selection) { | 516 void CollectedCookiesGtk::OnTreeViewSelectionChange(GtkWidget* selection) { |
| 517 EnableControls(); | 517 EnableControls(); |
| 518 ShowCookieInfo(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook_))); | 518 ShowCookieInfo(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook_))); |
| 519 } | 519 } |
| OLD | NEW |