| 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 NSString* name = |
| 253 PluginService::GetInstance()->GetPluginGroupName(*it)); | 256 SysUTF16ToNSString(finder->FindPluginNameWithIdentifier(*it)); |
| 254 if ([name length] == 0) | |
| 255 name = base::SysUTF8ToNSString(*it); | |
| 256 [pluginArray addObject:name]; | 257 [pluginArray addObject:name]; |
| 257 } | 258 } |
| 258 [blockedResourcesField_ | 259 [blockedResourcesField_ |
| 259 setStringValue:[pluginArray componentsJoinedByString:@"\n"]]; | 260 setStringValue:[pluginArray componentsJoinedByString:@"\n"]]; |
| 260 [GTMUILocalizerAndLayoutTweaker | 261 [GTMUILocalizerAndLayoutTweaker |
| 261 sizeToFitFixedWidthTextField:blockedResourcesField_]; | 262 sizeToFitFixedWidthTextField:blockedResourcesField_]; |
| 262 } | 263 } |
| 263 } | 264 } |
| 264 | 265 |
| 265 - (void)initializePopupList { | 266 - (void)initializePopupList { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 - (IBAction)manageBlocking:(id)sender { | 494 - (IBAction)manageBlocking:(id)sender { |
| 494 contentSettingBubbleModel_->OnManageLinkClicked(); | 495 contentSettingBubbleModel_->OnManageLinkClicked(); |
| 495 } | 496 } |
| 496 | 497 |
| 497 - (IBAction)closeBubble:(id)sender { | 498 - (IBAction)closeBubble:(id)sender { |
| 498 contentSettingBubbleModel_->OnDoneClicked(); | 499 contentSettingBubbleModel_->OnDoneClicked(); |
| 499 [self close]; | 500 [self close]; |
| 500 } | 501 } |
| 501 | 502 |
| 502 @end // ContentSettingBubbleController | 503 @end // ContentSettingBubbleController |
| OLD | NEW |