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/views/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
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/views/browser_dialogs.h" | 17 #include "chrome/browser/ui/views/browser_dialogs.h" |
17 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
18 #include "content/public/browser/notification_types.h" | 19 #include "content/public/browser/notification_types.h" |
19 #include "content/public/browser/plugin_service.h" | 20 #include "content/public/browser/plugin_service.h" |
20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/views/controls/button/radio_button.h" | 23 #include "ui/views/controls/button/radio_button.h" |
23 #include "ui/views/controls/button/text_button.h" | 24 #include "ui/views/controls/button/text_button.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 bubble_content.title)); | 149 bubble_content.title)); |
149 layout->StartRow(0, single_column_set_id); | 150 layout->StartRow(0, single_column_set_id); |
150 layout->AddView(title_label); | 151 layout->AddView(title_label); |
151 bubble_content_empty = false; | 152 bubble_content_empty = false; |
152 } | 153 } |
153 | 154 |
154 const std::set<std::string>& plugins = bubble_content.resource_identifiers; | 155 const std::set<std::string>& plugins = bubble_content.resource_identifiers; |
155 if (!plugins.empty()) { | 156 if (!plugins.empty()) { |
156 if (!bubble_content_empty) | 157 if (!bubble_content_empty) |
157 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 158 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 159 |
| 160 std::vector<webkit::WebPluginInfo> web_plugins; |
| 161 PluginService::GetInstance()->GetPluginList()-> |
| 162 GetPluginsNoRefresh(&web_plugins); |
158 for (std::set<std::string>::const_iterator i(plugins.begin()); | 163 for (std::set<std::string>::const_iterator i(plugins.begin()); |
159 i != plugins.end(); ++i) { | 164 i != plugins.end(); ++i) { |
160 string16 name = PluginService::GetInstance()->GetPluginGroupName(*i); | 165 string16 name = |
| 166 PluginInstaller::GetGroupNameByIdentifier(web_plugins, *i); |
161 if (name.empty()) | 167 if (name.empty()) |
162 name = UTF8ToUTF16(*i); | 168 name = UTF8ToUTF16(*i); |
163 layout->StartRow(0, single_column_set_id); | 169 layout->StartRow(0, single_column_set_id); |
164 layout->AddView(new views::Label(name)); | 170 layout->AddView(new views::Label(name)); |
165 bubble_content_empty = false; | 171 bubble_content_empty = false; |
166 } | 172 } |
167 } | 173 } |
168 | 174 |
169 if (content_setting_bubble_model_->content_type() == | 175 if (content_setting_bubble_model_->content_type() == |
170 CONTENT_SETTINGS_TYPE_POPUPS) { | 176 CONTENT_SETTINGS_TYPE_POPUPS) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 327 } |
322 | 328 |
323 void ContentSettingBubbleContents::Observe( | 329 void ContentSettingBubbleContents::Observe( |
324 int type, | 330 int type, |
325 const content::NotificationSource& source, | 331 const content::NotificationSource& source, |
326 const content::NotificationDetails& details) { | 332 const content::NotificationDetails& details) { |
327 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); | 333 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); |
328 DCHECK(source == content::Source<WebContents>(web_contents_)); | 334 DCHECK(source == content::Source<WebContents>(web_contents_)); |
329 web_contents_ = NULL; | 335 web_contents_ = NULL; |
330 } | 336 } |
OLD | NEW |