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 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h " | 5 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h " |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/content_settings/host_content_settings_map.h" | 11 #include "chrome/browser/content_settings/host_content_settings_map.h" |
12 #include "chrome/browser/plugin_installer.h" | |
12 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 13 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
13 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" | 14 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" |
14 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
15 #import "chrome/browser/ui/cocoa/l10n_util.h" | 16 #import "chrome/browser/ui/cocoa/l10n_util.h" |
16 #include "content/public/browser/plugin_service.h" | 17 #include "content/public/browser/plugin_service.h" |
17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
18 #include "skia/ext/skia_utils_mac.h" | 19 #include "skia/ext/skia_utils_mac.h" |
19 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 20 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "webkit/plugins/npapi/plugin_list.h" | |
21 | 23 |
22 using content::PluginService; | 24 using content::PluginService; |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
26 // Height of one link in the popup list. | 28 // Height of one link in the popup list. |
27 const int kLinkHeight = 16; | 29 const int kLinkHeight = 16; |
28 | 30 |
29 // Space between two popup links. | 31 // Space between two popup links. |
30 const int kLinkPadding = 4; | 32 const int kLinkPadding = 4; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 const std::set<std::string>& plugins = | 233 const std::set<std::string>& plugins = |
232 contentSettingBubbleModel_->bubble_content().resource_identifiers; | 234 contentSettingBubbleModel_->bubble_content().resource_identifiers; |
233 if (plugins.empty()) { | 235 if (plugins.empty()) { |
234 int delta = NSMinY([titleLabel_ frame]) - | 236 int delta = NSMinY([titleLabel_ frame]) - |
235 NSMinY([blockedResourcesField_ frame]); | 237 NSMinY([blockedResourcesField_ frame]); |
236 [blockedResourcesField_ removeFromSuperview]; | 238 [blockedResourcesField_ removeFromSuperview]; |
237 NSRect frame = [[self window] frame]; | 239 NSRect frame = [[self window] frame]; |
238 frame.size.height -= delta; | 240 frame.size.height -= delta; |
239 [[self window] setFrame:frame display:NO]; | 241 [[self window] setFrame:frame display:NO]; |
240 } else { | 242 } else { |
243 std::vector<webkit::WebPluginInfo> web_plugins; | |
244 PluginService::GetInstance()->GetPluginList()-> | |
Bernhard Bauer
2012/08/21 19:14:52
This method is deprecated in favor of using the as
| |
245 GetPluginsNoRefresh(&web_plugins); | |
241 for (std::set<std::string>::iterator it = plugins.begin(); | 246 for (std::set<std::string>::iterator it = plugins.begin(); |
242 it != plugins.end(); ++it) { | 247 it != plugins.end(); ++it) { |
243 NSString* name = SysUTF16ToNSString( | 248 NSString* name = SysUTF16ToNSString( |
244 PluginService::GetInstance()->GetPluginGroupName(*it)); | 249 PluginInstaller::GetGroupNameByIdentifier(web_plugins, *it)); |
245 if ([name length] == 0) | 250 if ([name length] == 0) |
246 name = base::SysUTF8ToNSString(*it); | 251 name = base::SysUTF8ToNSString(*it); |
247 [pluginArray addObject:name]; | 252 [pluginArray addObject:name]; |
248 } | 253 } |
249 [blockedResourcesField_ | 254 [blockedResourcesField_ |
250 setStringValue:[pluginArray componentsJoinedByString:@"\n"]]; | 255 setStringValue:[pluginArray componentsJoinedByString:@"\n"]]; |
251 [GTMUILocalizerAndLayoutTweaker | 256 [GTMUILocalizerAndLayoutTweaker |
252 sizeToFitFixedWidthTextField:blockedResourcesField_]; | 257 sizeToFitFixedWidthTextField:blockedResourcesField_]; |
253 } | 258 } |
254 } | 259 } |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 - (IBAction)manageBlocking:(id)sender { | 489 - (IBAction)manageBlocking:(id)sender { |
485 contentSettingBubbleModel_->OnManageLinkClicked(); | 490 contentSettingBubbleModel_->OnManageLinkClicked(); |
486 } | 491 } |
487 | 492 |
488 - (IBAction)closeBubble:(id)sender { | 493 - (IBAction)closeBubble:(id)sender { |
489 contentSettingBubbleModel_->OnDoneClicked(); | 494 contentSettingBubbleModel_->OnDoneClicked(); |
490 [self close]; | 495 [self close]; |
491 } | 496 } |
492 | 497 |
493 @end // ContentSettingBubbleController | 498 @end // ContentSettingBubbleController |
OLD | NEW |