| 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 |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 14 #include "chrome/browser/plugins/plugin_finder.h" |
| 15 #include "chrome/browser/plugins/plugin_metadata.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 17 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 18 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 19 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 18 #include "chrome/browser/ui/gtk/gtk_util.h" | 20 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 19 #include "chrome/common/content_settings.h" | 21 #include "chrome/common/content_settings.h" |
| 20 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 21 #include "content/public/browser/notification_types.h" | 23 #include "content/public/browser/notification_types.h" |
| 22 #include "content/public/browser/plugin_service.h" | 24 #include "content/public/browser/plugin_service.h" |
| 23 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 GtkWidget* label = theme_provider->BuildLabel(content.title.c_str(), | 103 GtkWidget* label = theme_provider->BuildLabel(content.title.c_str(), |
| 102 ui::kGdkBlack); | 104 ui::kGdkBlack); |
| 103 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 105 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| 104 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); | 106 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); |
| 105 } | 107 } |
| 106 | 108 |
| 107 const std::set<std::string>& plugins = content.resource_identifiers; | 109 const std::set<std::string>& plugins = content.resource_identifiers; |
| 108 if (!plugins.empty()) { | 110 if (!plugins.empty()) { |
| 109 GtkWidget* list_content = gtk_vbox_new(FALSE, ui::kControlSpacing); | 111 GtkWidget* list_content = gtk_vbox_new(FALSE, ui::kControlSpacing); |
| 110 | 112 |
| 113 PluginFinder* finder = PluginFinder::GetInstance(); |
| 111 for (std::set<std::string>::const_iterator it = plugins.begin(); | 114 for (std::set<std::string>::const_iterator it = plugins.begin(); |
| 112 it != plugins.end(); ++it) { | 115 it != plugins.end(); ++it) { |
| 113 std::string name = UTF16ToUTF8( | 116 std::string name = UTF16ToUTF8(finder->FindPluginNameWithIdentifier(*it)); |
| 114 PluginService::GetInstance()->GetPluginGroupName(*it)); | |
| 115 if (name.empty()) | |
| 116 name = *it; | |
| 117 | |
| 118 GtkWidget* label = theme_provider->BuildLabel( | 117 GtkWidget* label = theme_provider->BuildLabel( |
| 119 BuildElidedText(name).c_str(), ui::kGdkBlack); | 118 BuildElidedText(name).c_str(), ui::kGdkBlack); |
| 120 GtkWidget* label_box = gtk_hbox_new(FALSE, 0); | 119 GtkWidget* label_box = gtk_hbox_new(FALSE, 0); |
| 121 gtk_box_pack_start(GTK_BOX(label_box), label, FALSE, FALSE, 0); | 120 gtk_box_pack_start(GTK_BOX(label_box), label, FALSE, FALSE, 0); |
| 122 | 121 |
| 123 gtk_box_pack_start(GTK_BOX(list_content), | 122 gtk_box_pack_start(GTK_BOX(list_content), |
| 124 label_box, | 123 label_box, |
| 125 FALSE, FALSE, 0); | 124 FALSE, FALSE, 0); |
| 126 } | 125 } |
| 127 gtk_box_pack_start(GTK_BOX(bubble_content), list_content, FALSE, FALSE, | 126 gtk_box_pack_start(GTK_BOX(bubble_content), list_content, FALSE, FALSE, |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 314 |
| 316 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { | 315 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { |
| 317 content_setting_bubble_model_->OnCustomLinkClicked(); | 316 content_setting_bubble_model_->OnCustomLinkClicked(); |
| 318 Close(); | 317 Close(); |
| 319 } | 318 } |
| 320 | 319 |
| 321 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { | 320 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { |
| 322 content_setting_bubble_model_->OnManageLinkClicked(); | 321 content_setting_bubble_model_->OnManageLinkClicked(); |
| 323 Close(); | 322 Close(); |
| 324 } | 323 } |
| OLD | NEW |