| 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> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/text_elider.h" | 12 #include "app/text_elider.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/blocked_content_container.h" | 15 #include "chrome/browser/blocked_content_container.h" |
| 16 #include "chrome/browser/content_settings/host_content_settings_map.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 17 #include "chrome/browser/content_setting_bubble_model.h" | 17 #include "chrome/browser/content_setting_bubble_model.h" |
| 18 #include "chrome/browser/gtk/gtk_chrome_link_button.h" | 18 #include "chrome/browser/gtk/gtk_chrome_link_button.h" |
| 19 #include "chrome/browser/gtk/gtk_theme_provider.h" | 19 #include "chrome/browser/gtk/gtk_theme_provider.h" |
| 20 #include "chrome/browser/gtk/gtk_util.h" | 20 #include "chrome/browser/gtk/gtk_util.h" |
| 21 #include "chrome/browser/gtk/options/content_settings_window_gtk.h" | 21 #include "chrome/browser/gtk/options/content_settings_window_gtk.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/tab_contents/tab_contents.h" | 23 #include "chrome/browser/tab_contents/tab_contents.h" |
| 24 #include "chrome/common/content_settings.h" | 24 #include "chrome/common/content_settings.h" |
| 25 #include "chrome/common/notification_source.h" | 25 #include "chrome/common/notification_source.h" |
| 26 #include "chrome/common/notification_type.h" | 26 #include "chrome/common/notification_type.h" |
| 27 #include "gfx/gtk_util.h" | 27 #include "gfx/gtk_util.h" |
| 28 #include "grit/app_resources.h" | 28 #include "grit/app_resources.h" |
| 29 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
| 30 #include "webkit/plugins/npapi/plugin_list.h" | 30 #include "webkit/glue/plugins/plugin_list.h" |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 // Padding between content and edge of info bubble. | 34 // Padding between content and edge of info bubble. |
| 35 const int kContentBorder = 7; | 35 const int kContentBorder = 7; |
| 36 | 36 |
| 37 // The maximum width of a title entry in the content box. We elide anything | 37 // The maximum width of a title entry in the content box. We elide anything |
| 38 // longer than this. | 38 // longer than this. |
| 39 const int kMaxLinkPixelSize = 500; | 39 const int kMaxLinkPixelSize = 500; |
| 40 | 40 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 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); |
| 103 } | 103 } |
| 104 | 104 |
| 105 const std::set<std::string>& plugins = content.resource_identifiers; | 105 const std::set<std::string>& plugins = content.resource_identifiers; |
| 106 if (!plugins.empty()) { | 106 if (!plugins.empty()) { |
| 107 GtkWidget* list_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 107 GtkWidget* list_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
| 108 | 108 |
| 109 for (std::set<std::string>::const_iterator it = plugins.begin(); | 109 for (std::set<std::string>::const_iterator it = plugins.begin(); |
| 110 it != plugins.end(); ++it) { | 110 it != plugins.end(); ++it) { |
| 111 std::string name = UTF16ToUTF8( | 111 std::string name = UTF16ToUTF8( |
| 112 webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it)); | 112 NPAPI::PluginList::Singleton()->GetPluginGroupName(*it)); |
| 113 if (name.empty()) | 113 if (name.empty()) |
| 114 name = *it; | 114 name = *it; |
| 115 | 115 |
| 116 GtkWidget* label = gtk_label_new(BuildElidedText(name).c_str()); | 116 GtkWidget* label = gtk_label_new(BuildElidedText(name).c_str()); |
| 117 GtkWidget* label_box = gtk_hbox_new(FALSE, 0); | 117 GtkWidget* label_box = gtk_hbox_new(FALSE, 0); |
| 118 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); |
| 119 | 119 |
| 120 gtk_box_pack_start(GTK_BOX(list_content), | 120 gtk_box_pack_start(GTK_BOX(list_content), |
| 121 label_box, | 121 label_box, |
| 122 FALSE, FALSE, 0); | 122 FALSE, FALSE, 0); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { | 308 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { |
| 309 content_setting_bubble_model_->OnCustomLinkClicked(); | 309 content_setting_bubble_model_->OnCustomLinkClicked(); |
| 310 Close(); | 310 Close(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { | 313 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { |
| 314 content_setting_bubble_model_->OnManageLinkClicked(); | 314 content_setting_bubble_model_->OnManageLinkClicked(); |
| 315 Close(); | 315 Close(); |
| 316 } | 316 } |
| OLD | NEW |