Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: chrome/browser/ui/gtk/content_setting_bubble_gtk.cc

Issue 10823434: [6] Moves CreateVersionFromString to plugin_utils and updates the callers. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 2nd CL in series to delete PluginGroup. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/plugin_installer.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 16 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" 17 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 18 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
18 #include "chrome/browser/ui/gtk/gtk_util.h" 19 #include "chrome/browser/ui/gtk/gtk_util.h"
19 #include "chrome/common/content_settings.h" 20 #include "chrome/common/content_settings.h"
20 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
21 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
22 #include "content/public/browser/plugin_service.h" 23 #include "content/public/browser/plugin_service.h"
23 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
24 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
25 #include "grit/ui_resources.h" 26 #include "grit/ui_resources.h"
26 #include "ui/base/gtk/gtk_hig_constants.h" 27 #include "ui/base/gtk/gtk_hig_constants.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/text/text_elider.h" 29 #include "ui/base/text/text_elider.h"
29 #include "ui/gfx/gtk_util.h" 30 #include "ui/gfx/gtk_util.h"
31 #include "webkit/plugins/npapi/plugin_list.h"
30 32
31 using content::PluginService; 33 using content::PluginService;
32 using content::WebContents; 34 using content::WebContents;
33 35
34 namespace { 36 namespace {
35 37
36 // Padding between content and edge of bubble. 38 // Padding between content and edge of bubble.
37 const int kContentBorder = 7; 39 const int kContentBorder = 7;
38 40
39 // The maximum width of a title entry in the content box. We elide anything 41 // The maximum width of a title entry in the content box. We elide anything
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Add the content label. 104 // Add the content label.
103 GtkWidget* label = gtk_label_new(content.title.c_str()); 105 GtkWidget* label = gtk_label_new(content.title.c_str());
104 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 106 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
105 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); 107 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0);
106 } 108 }
107 109
108 const std::set<std::string>& plugins = content.resource_identifiers; 110 const std::set<std::string>& plugins = content.resource_identifiers;
109 if (!plugins.empty()) { 111 if (!plugins.empty()) {
110 GtkWidget* list_content = gtk_vbox_new(FALSE, ui::kControlSpacing); 112 GtkWidget* list_content = gtk_vbox_new(FALSE, ui::kControlSpacing);
111 113
114 std::vector<webkit::WebPluginInfo> web_plugins;
115 PluginService::GetInstance()->GetPluginList()->
116 GetPluginsNoRefresh(&web_plugins);
112 for (std::set<std::string>::const_iterator it = plugins.begin(); 117 for (std::set<std::string>::const_iterator it = plugins.begin();
113 it != plugins.end(); ++it) { 118 it != plugins.end(); ++it) {
114 std::string name = UTF16ToUTF8( 119 std::string name = UTF16ToUTF8(
115 PluginService::GetInstance()->GetPluginGroupName(*it)); 120 PluginInstaller::GetGroupNameByIdentifier(web_plugins, *it));
116 if (name.empty()) 121 if (name.empty())
117 name = *it; 122 name = *it;
118 123
119 GtkWidget* label = gtk_label_new(BuildElidedText(name).c_str()); 124 GtkWidget* label = gtk_label_new(BuildElidedText(name).c_str());
120 GtkWidget* label_box = gtk_hbox_new(FALSE, 0); 125 GtkWidget* label_box = gtk_hbox_new(FALSE, 0);
121 gtk_box_pack_start(GTK_BOX(label_box), label, FALSE, FALSE, 0); 126 gtk_box_pack_start(GTK_BOX(label_box), label, FALSE, FALSE, 0);
122 127
123 gtk_box_pack_start(GTK_BOX(list_content), 128 gtk_box_pack_start(GTK_BOX(list_content),
124 label_box, 129 label_box,
125 FALSE, FALSE, 0); 130 FALSE, FALSE, 0);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 315
311 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { 316 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) {
312 content_setting_bubble_model_->OnCustomLinkClicked(); 317 content_setting_bubble_model_->OnCustomLinkClicked();
313 Close(); 318 Close();
314 } 319 }
315 320
316 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { 321 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) {
317 content_setting_bubble_model_->OnManageLinkClicked(); 322 content_setting_bubble_model_->OnManageLinkClicked();
318 Close(); 323 Close();
319 } 324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698