| 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_setting_bubble_gtk.h" | 5 #include "chrome/browser/gtk/content_setting_bubble_gtk.h" |
| 6 | 6 |
| 7 #include <set> |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 7 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 8 #include "app/text_elider.h" | 12 #include "app/text_elider.h" |
| 9 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 10 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/blocked_content_container.h" | 15 #include "chrome/browser/blocked_content_container.h" |
| 12 #include "chrome/browser/content_settings/host_content_settings_map.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 13 #include "chrome/browser/content_setting_bubble_model.h" | 17 #include "chrome/browser/content_setting_bubble_model.h" |
| 14 #include "chrome/browser/gtk/gtk_chrome_link_button.h" | 18 #include "chrome/browser/gtk/gtk_chrome_link_button.h" |
| 15 #include "chrome/browser/gtk/gtk_theme_provider.h" | 19 #include "chrome/browser/gtk/gtk_theme_provider.h" |
| 16 #include "chrome/browser/gtk/gtk_util.h" | 20 #include "chrome/browser/gtk/gtk_util.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 101 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 98 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); | 102 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); |
| 99 } | 103 } |
| 100 | 104 |
| 101 const std::set<std::string>& plugins = content.resource_identifiers; | 105 const std::set<std::string>& plugins = content.resource_identifiers; |
| 102 if (!plugins.empty()) { | 106 if (!plugins.empty()) { |
| 103 GtkWidget* list_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 107 GtkWidget* list_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
| 104 | 108 |
| 105 for (std::set<std::string>::const_iterator it = plugins.begin(); | 109 for (std::set<std::string>::const_iterator it = plugins.begin(); |
| 106 it != plugins.end(); ++it) { | 110 it != plugins.end(); ++it) { |
| 107 std::string name; | 111 std::string name = UTF16ToUTF8( |
| 108 NPAPI::PluginList::PluginMap groups; | 112 NPAPI::PluginList::Singleton()->GetPluginGroupName(*it)); |
| 109 NPAPI::PluginList::Singleton()->GetPluginGroups(false, &groups); | 113 if (name.empty()) |
| 110 if (groups.find(*it) != groups.end()) | |
| 111 name = UTF16ToUTF8(groups[*it]->GetGroupName()); | |
| 112 else | |
| 113 name = *it; | 114 name = *it; |
| 114 | 115 |
| 115 GtkWidget* label = gtk_label_new(BuildElidedText(name).c_str()); | 116 GtkWidget* label = gtk_label_new(BuildElidedText(name).c_str()); |
| 116 GtkWidget* label_box = gtk_hbox_new(FALSE, 0); | 117 GtkWidget* label_box = gtk_hbox_new(FALSE, 0); |
| 117 gtk_box_pack_start(GTK_BOX(label_box), label, FALSE, FALSE, 0); | 118 gtk_box_pack_start(GTK_BOX(label_box), label, FALSE, FALSE, 0); |
| 118 | 119 |
| 119 gtk_box_pack_start(GTK_BOX(list_content), | 120 gtk_box_pack_start(GTK_BOX(list_content), |
| 120 label_box, | 121 label_box, |
| 121 FALSE, FALSE, 0); | 122 FALSE, FALSE, 0); |
| 122 } | 123 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 343 |
| 343 void ContentSettingBubbleGtk::OnInfoLinkClicked(GtkWidget* button) { | 344 void ContentSettingBubbleGtk::OnInfoLinkClicked(GtkWidget* button) { |
| 344 content_setting_bubble_model_->OnInfoLinkClicked(); | 345 content_setting_bubble_model_->OnInfoLinkClicked(); |
| 345 Close(); | 346 Close(); |
| 346 } | 347 } |
| 347 | 348 |
| 348 void ContentSettingBubbleGtk::OnLoadPluginsLinkClicked(GtkWidget* button) { | 349 void ContentSettingBubbleGtk::OnLoadPluginsLinkClicked(GtkWidget* button) { |
| 349 content_setting_bubble_model_->OnLoadPluginsLinkClicked(); | 350 content_setting_bubble_model_->OnLoadPluginsLinkClicked(); |
| 350 Close(); | 351 Close(); |
| 351 } | 352 } |
| OLD | NEW |