OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 15 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
18 #include "chrome/browser/ui/gtk/gtk_util.h" | 18 #include "chrome/browser/ui/gtk/gtk_util.h" |
19 #include "chrome/common/content_settings.h" | 19 #include "chrome/common/content_settings.h" |
| 20 #include "content/browser/plugin_service.h" |
20 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
21 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
22 #include "content/public/browser/notification_types.h" | 23 #include "content/public/browser/notification_types.h" |
23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
24 #include "grit/ui_resources.h" | 25 #include "grit/ui_resources.h" |
25 #include "ui/base/gtk/gtk_hig_constants.h" | 26 #include "ui/base/gtk/gtk_hig_constants.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/text/text_elider.h" | 28 #include "ui/base/text/text_elider.h" |
28 #include "ui/gfx/gtk_util.h" | 29 #include "ui/gfx/gtk_util.h" |
29 #include "webkit/plugins/npapi/plugin_list.h" | |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 // Padding between content and edge of bubble. | 33 // Padding between content and edge of bubble. |
34 const int kContentBorder = 7; | 34 const int kContentBorder = 7; |
35 | 35 |
36 // The maximum width of a title entry in the content box. We elide anything | 36 // The maximum width of a title entry in the content box. We elide anything |
37 // longer than this. | 37 // longer than this. |
38 const int kMaxLinkPixelSize = 500; | 38 const int kMaxLinkPixelSize = 500; |
39 | 39 |
(...skipping 62 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, ui::kControlSpacing); | 107 GtkWidget* list_content = gtk_vbox_new(FALSE, ui::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 PluginService::GetInstance()->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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { | 304 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { |
305 content_setting_bubble_model_->OnCustomLinkClicked(); | 305 content_setting_bubble_model_->OnCustomLinkClicked(); |
306 Close(); | 306 Close(); |
307 } | 307 } |
308 | 308 |
309 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { | 309 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { |
310 content_setting_bubble_model_->OnManageLinkClicked(); | 310 content_setting_bubble_model_->OnManageLinkClicked(); |
311 Close(); | 311 Close(); |
312 } | 312 } |
OLD | NEW |