Chromium Code Reviews| 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/plugins/plugin_finder.h" | |
| 13 #include "chrome/browser/plugins/plugin_metadata.h" | |
| 12 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 14 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 13 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" | 15 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" |
| 14 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 16 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 15 #import "chrome/browser/ui/cocoa/l10n_util.h" | 17 #import "chrome/browser/ui/cocoa/l10n_util.h" |
| 16 #include "content/public/browser/plugin_service.h" | 18 #include "content/public/browser/plugin_service.h" |
| 17 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 18 #include "skia/ext/skia_utils_mac.h" | 20 #include "skia/ext/skia_utils_mac.h" |
| 19 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 21 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 21 | 23 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 const std::set<std::string>& plugins = | 242 const std::set<std::string>& plugins = |
| 241 contentSettingBubbleModel_->bubble_content().resource_identifiers; | 243 contentSettingBubbleModel_->bubble_content().resource_identifiers; |
| 242 if (plugins.empty()) { | 244 if (plugins.empty()) { |
| 243 int delta = NSMinY([titleLabel_ frame]) - | 245 int delta = NSMinY([titleLabel_ frame]) - |
| 244 NSMinY([blockedResourcesField_ frame]); | 246 NSMinY([blockedResourcesField_ frame]); |
| 245 [blockedResourcesField_ removeFromSuperview]; | 247 [blockedResourcesField_ removeFromSuperview]; |
| 246 NSRect frame = [[self window] frame]; | 248 NSRect frame = [[self window] frame]; |
| 247 frame.size.height -= delta; | 249 frame.size.height -= delta; |
| 248 [[self window] setFrame:frame display:NO]; | 250 [[self window] setFrame:frame display:NO]; |
| 249 } else { | 251 } else { |
| 252 PluginFinder* finder = PluginFinder::GetInstance(); | |
| 250 for (std::set<std::string>::iterator it = plugins.begin(); | 253 for (std::set<std::string>::iterator it = plugins.begin(); |
| 251 it != plugins.end(); ++it) { | 254 it != plugins.end(); ++it) { |
| 252 NSString* name = SysUTF16ToNSString( | 255 PluginMetadata* plugin = finder->FindPluginMetadataWithIdentifier(*it); |
| 253 PluginService::GetInstance()->GetPluginGroupName(*it)); | 256 NSString* name = nil; |
|
Peter Kasting
2012/09/21 20:10:56
Nit: Or just
NSString* name = plugin ? SysU
ibraaaa
2012/09/24 11:42:29
Done.
| |
| 254 if ([name length] == 0) | 257 if (plugin) |
| 258 name = SysUTF16ToNSString(plugin->name()); | |
| 259 if (!name || [name length] == 0) | |
| 255 name = base::SysUTF8ToNSString(*it); | 260 name = base::SysUTF8ToNSString(*it); |
| 256 [pluginArray addObject:name]; | 261 [pluginArray addObject:name]; |
| 257 } | 262 } |
| 258 [blockedResourcesField_ | 263 [blockedResourcesField_ |
| 259 setStringValue:[pluginArray componentsJoinedByString:@"\n"]]; | 264 setStringValue:[pluginArray componentsJoinedByString:@"\n"]]; |
| 260 [GTMUILocalizerAndLayoutTweaker | 265 [GTMUILocalizerAndLayoutTweaker |
| 261 sizeToFitFixedWidthTextField:blockedResourcesField_]; | 266 sizeToFitFixedWidthTextField:blockedResourcesField_]; |
| 262 } | 267 } |
| 263 } | 268 } |
| 264 | 269 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 - (IBAction)manageBlocking:(id)sender { | 498 - (IBAction)manageBlocking:(id)sender { |
| 494 contentSettingBubbleModel_->OnManageLinkClicked(); | 499 contentSettingBubbleModel_->OnManageLinkClicked(); |
| 495 } | 500 } |
| 496 | 501 |
| 497 - (IBAction)closeBubble:(id)sender { | 502 - (IBAction)closeBubble:(id)sender { |
| 498 contentSettingBubbleModel_->OnDoneClicked(); | 503 contentSettingBubbleModel_->OnDoneClicked(); |
| 499 [self close]; | 504 [self close]; |
| 500 } | 505 } |
| 501 | 506 |
| 502 @end // ContentSettingBubbleController | 507 @end // ContentSettingBubbleController |
| OLD | NEW |