| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const ContentSettingBubbleModel::BubbleContent& content = | 107 const ContentSettingBubbleModel::BubbleContent& content = |
| 108 content_setting_bubble_model_->bubble_content(); | 108 content_setting_bubble_model_->bubble_content(); |
| 109 if (!content.title.empty()) { | 109 if (!content.title.empty()) { |
| 110 // Add the content label. | 110 // Add the content label. |
| 111 GtkWidget* label = theme_provider->BuildLabel(content.title.c_str(), | 111 GtkWidget* label = theme_provider->BuildLabel(content.title.c_str(), |
| 112 ui::kGdkBlack); | 112 ui::kGdkBlack); |
| 113 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 113 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 114 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); | 114 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); |
| 115 } | 115 } |
| 116 | 116 |
| 117 const std::set<std::string>& plugins = content.resource_identifiers; | |
| 118 if (!plugins.empty()) { | |
| 119 GtkWidget* list_content = gtk_vbox_new(FALSE, ui::kControlSpacing); | |
| 120 | |
| 121 PluginFinder* finder = PluginFinder::GetInstance(); | |
| 122 for (std::set<std::string>::const_iterator it = plugins.begin(); | |
| 123 it != plugins.end(); ++it) { | |
| 124 std::string name = UTF16ToUTF8(finder->FindPluginNameWithIdentifier(*it)); | |
| 125 GtkWidget* label = theme_provider->BuildLabel( | |
| 126 BuildElidedText(name).c_str(), ui::kGdkBlack); | |
| 127 GtkWidget* label_box = gtk_hbox_new(FALSE, 0); | |
| 128 gtk_box_pack_start(GTK_BOX(label_box), label, FALSE, FALSE, 0); | |
| 129 | |
| 130 gtk_box_pack_start(GTK_BOX(list_content), | |
| 131 label_box, | |
| 132 FALSE, FALSE, 0); | |
| 133 } | |
| 134 gtk_box_pack_start(GTK_BOX(bubble_content), list_content, FALSE, FALSE, | |
| 135 ui::kControlSpacing); | |
| 136 } | |
| 137 | |
| 138 if (content_setting_bubble_model_->content_type() == | 117 if (content_setting_bubble_model_->content_type() == |
| 139 CONTENT_SETTINGS_TYPE_POPUPS) { | 118 CONTENT_SETTINGS_TYPE_POPUPS) { |
| 140 const std::vector<ContentSettingBubbleModel::PopupItem>& popup_items = | 119 const std::vector<ContentSettingBubbleModel::PopupItem>& popup_items = |
| 141 content.popup_items; | 120 content.popup_items; |
| 142 GtkWidget* table = gtk_table_new(popup_items.size(), 2, FALSE); | 121 GtkWidget* table = gtk_table_new(popup_items.size(), 2, FALSE); |
| 143 int row = 0; | 122 int row = 0; |
| 144 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator | 123 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator |
| 145 i(popup_items.begin()); i != popup_items.end(); ++i, ++row) { | 124 i(popup_items.begin()); i != popup_items.end(); ++i, ++row) { |
| 146 GtkWidget* image = gtk_image_new(); | 125 GtkWidget* image = gtk_image_new(); |
| 147 if (!i->image.IsEmpty()) { | 126 if (!i->image.IsEmpty()) { |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 GtkMediaMenuMap::iterator i(media_menus_.find(button)); | 383 GtkMediaMenuMap::iterator i(media_menus_.find(button)); |
| 405 DCHECK(i != media_menus_.end()); | 384 DCHECK(i != media_menus_.end()); |
| 406 i->second->menu->PopupForWidget(button, 1, gtk_get_current_event_time()); | 385 i->second->menu->PopupForWidget(button, 1, gtk_get_current_event_time()); |
| 407 } | 386 } |
| 408 | 387 |
| 409 ContentSettingBubbleGtk::MediaMenuGtk::MediaMenuGtk( | 388 ContentSettingBubbleGtk::MediaMenuGtk::MediaMenuGtk( |
| 410 content::MediaStreamType type) | 389 content::MediaStreamType type) |
| 411 : type(type) {} | 390 : type(type) {} |
| 412 | 391 |
| 413 ContentSettingBubbleGtk::MediaMenuGtk::~MediaMenuGtk() {} | 392 ContentSettingBubbleGtk::MediaMenuGtk::~MediaMenuGtk() {} |
| OLD | NEW |