OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/content_setting_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if (content_setting_bubble_model_->content_type() == | 131 if (content_setting_bubble_model_->content_type() == |
132 CONTENT_SETTINGS_TYPE_POPUPS) { | 132 CONTENT_SETTINGS_TYPE_POPUPS) { |
133 const std::vector<ContentSettingBubbleModel::PopupItem>& popup_items = | 133 const std::vector<ContentSettingBubbleModel::PopupItem>& popup_items = |
134 content.popup_items; | 134 content.popup_items; |
135 GtkWidget* table = gtk_table_new(popup_items.size(), 2, FALSE); | 135 GtkWidget* table = gtk_table_new(popup_items.size(), 2, FALSE); |
136 int row = 0; | 136 int row = 0; |
137 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator | 137 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator |
138 i(popup_items.begin()); i != popup_items.end(); ++i, ++row) { | 138 i(popup_items.begin()); i != popup_items.end(); ++i, ++row) { |
139 GtkWidget* image = gtk_image_new(); | 139 GtkWidget* image = gtk_image_new(); |
140 if (!i->bitmap.empty()) { | 140 if (!i->bitmap.empty()) { |
141 GdkPixbuf* icon_pixbuf = gfx::GdkPixbufFromSkBitmap(&i->bitmap); | 141 GdkPixbuf* icon_pixbuf = gfx::GdkPixbufFromSkBitmap(i->bitmap); |
142 gtk_image_set_from_pixbuf(GTK_IMAGE(image), icon_pixbuf); | 142 gtk_image_set_from_pixbuf(GTK_IMAGE(image), icon_pixbuf); |
143 g_object_unref(icon_pixbuf); | 143 g_object_unref(icon_pixbuf); |
144 | 144 |
145 // We stuff the image in an event box so we can trap mouse clicks on the | 145 // We stuff the image in an event box so we can trap mouse clicks on the |
146 // image (and launch the popup). | 146 // image (and launch the popup). |
147 GtkWidget* event_box = gtk_event_box_new(); | 147 GtkWidget* event_box = gtk_event_box_new(); |
148 gtk_container_add(GTK_CONTAINER(event_box), image); | 148 gtk_container_add(GTK_CONTAINER(event_box), image); |
149 | 149 |
150 popup_icons_[event_box] = i -popup_items.begin(); | 150 popup_icons_[event_box] = i -popup_items.begin(); |
151 g_signal_connect(event_box, "button_press_event", | 151 g_signal_connect(event_box, "button_press_event", |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 308 |
309 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { | 309 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { |
310 content_setting_bubble_model_->OnCustomLinkClicked(); | 310 content_setting_bubble_model_->OnCustomLinkClicked(); |
311 Close(); | 311 Close(); |
312 } | 312 } |
313 | 313 |
314 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { | 314 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { |
315 content_setting_bubble_model_->OnManageLinkClicked(); | 315 content_setting_bubble_model_->OnManageLinkClicked(); |
316 Close(); | 316 Close(); |
317 } | 317 } |
OLD | NEW |