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/content_blocked_bubble_gtk.h" | 5 #include "chrome/browser/gtk/content_blocked_bubble_gtk.h" |
6 | 6 |
7 #include "app/gfx/gtk_util.h" | 7 #include "app/gfx/gtk_util.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "chrome/browser/blocked_popup_container.h" | 9 #include "chrome/browser/blocked_popup_container.h" |
10 #include "chrome/browser/content_setting_bubble_model.h" | 10 #include "chrome/browser/content_setting_bubble_model.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 tab_contents_ = NULL; | 65 tab_contents_ = NULL; |
66 } | 66 } |
67 | 67 |
68 void ContentSettingBubbleGtk::BuildBubble() { | 68 void ContentSettingBubbleGtk::BuildBubble() { |
69 GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom(profile_); | 69 GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom(profile_); |
70 | 70 |
71 GtkWidget* bubble_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 71 GtkWidget* bubble_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
72 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); | 72 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); |
73 | 73 |
74 // Add the content label. | 74 // Add the content label. |
75 GtkWidget* label = gtk_label_new( | 75 if (!content_setting_bubble_model_->bubble_content().title.empty()) { |
76 content_setting_bubble_model_->bubble_content().title.c_str()); | 76 GtkWidget* label = gtk_label_new( |
77 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); | 77 content_setting_bubble_model_->bubble_content().title.c_str()); |
| 78 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); |
| 79 } |
78 | 80 |
79 if (content_setting_bubble_model_->content_type() == | 81 if (content_setting_bubble_model_->content_type() == |
80 CONTENT_SETTINGS_TYPE_POPUPS) { | 82 CONTENT_SETTINGS_TYPE_POPUPS) { |
81 const std::vector<ContentSettingBubbleModel::PopupItem>& popup_items = | 83 const std::vector<ContentSettingBubbleModel::PopupItem>& popup_items = |
82 content_setting_bubble_model_->bubble_content().popup_items; | 84 content_setting_bubble_model_->bubble_content().popup_items; |
83 GtkWidget* table = gtk_table_new(popup_items.size(), 2, FALSE); | 85 GtkWidget* table = gtk_table_new(popup_items.size(), 2, FALSE); |
84 int row = 0; | 86 int row = 0; |
85 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator | 87 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator |
86 i(popup_items.begin()); i != popup_items.end(); ++i, ++row) { | 88 i(popup_items.begin()); i != popup_items.end(); ++i, ++row) { |
87 GtkWidget* image = gtk_image_new(); | 89 GtkWidget* image = gtk_image_new(); |
(...skipping 26 matching lines...) Expand all Loading... |
114 | 116 |
115 gtk_box_pack_start(GTK_BOX(bubble_content), table, FALSE, FALSE, 0); | 117 gtk_box_pack_start(GTK_BOX(bubble_content), table, FALSE, FALSE, 0); |
116 } | 118 } |
117 | 119 |
118 if (content_setting_bubble_model_->content_type() != | 120 if (content_setting_bubble_model_->content_type() != |
119 CONTENT_SETTINGS_TYPE_COOKIES) { | 121 CONTENT_SETTINGS_TYPE_COOKIES) { |
120 const ContentSettingBubbleModel::RadioGroups& radio_groups = | 122 const ContentSettingBubbleModel::RadioGroups& radio_groups = |
121 content_setting_bubble_model_->bubble_content().radio_groups; | 123 content_setting_bubble_model_->bubble_content().radio_groups; |
122 for (ContentSettingBubbleModel::RadioGroups::const_iterator i = | 124 for (ContentSettingBubbleModel::RadioGroups::const_iterator i = |
123 radio_groups.begin(); i != radio_groups.end(); ++i) { | 125 radio_groups.begin(); i != radio_groups.end(); ++i) { |
| 126 if (!i->title.empty()) { |
| 127 GtkWidget* label = gtk_label_new(i->title.c_str()); |
| 128 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); |
| 129 } |
| 130 |
124 const ContentSettingBubbleModel::RadioItems& radio_items = i->radio_items; | 131 const ContentSettingBubbleModel::RadioItems& radio_items = i->radio_items; |
125 RadioGroupGtk radio_group_gtk; | 132 RadioGroupGtk radio_group_gtk; |
126 for (ContentSettingBubbleModel::RadioItems::const_iterator j = | 133 for (ContentSettingBubbleModel::RadioItems::const_iterator j = |
127 radio_items.begin(); j != radio_items.end(); ++j) { | 134 radio_items.begin(); j != radio_items.end(); ++j) { |
128 GtkWidget* radio = | 135 GtkWidget* radio = |
129 radio_group_gtk.empty() ? | 136 radio_group_gtk.empty() ? |
130 gtk_radio_button_new_with_label(NULL, j->c_str()) : | 137 gtk_radio_button_new_with_label(NULL, j->c_str()) : |
131 gtk_radio_button_new_with_label_from_widget( | 138 gtk_radio_button_new_with_label_from_widget( |
132 GTK_RADIO_BUTTON(radio_group_gtk[0]), | 139 GTK_RADIO_BUTTON(radio_group_gtk[0]), |
133 j->c_str()); | 140 j->c_str()); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 bubble->Close(); | 237 bubble->Close(); |
231 } | 238 } |
232 | 239 |
233 // static | 240 // static |
234 void ContentSettingBubbleGtk::OnManageLinkClicked( | 241 void ContentSettingBubbleGtk::OnManageLinkClicked( |
235 GtkButton* button, | 242 GtkButton* button, |
236 ContentSettingBubbleGtk* bubble) { | 243 ContentSettingBubbleGtk* bubble) { |
237 bubble->content_setting_bubble_model_->OnManageLinkClicked(); | 244 bubble->content_setting_bubble_model_->OnManageLinkClicked(); |
238 bubble->Close(); | 245 bubble->Close(); |
239 } | 246 } |
OLD | NEW |