| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/content_settings/content_setting_bubble_model.h" | 12 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 13 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" | 13 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" |
| 14 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 14 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 15 #import "chrome/browser/ui/cocoa/l10n_util.h" | 15 #import "chrome/browser/ui/cocoa/l10n_util.h" |
| 16 #include "content/browser/plugin_service.h" |
| 16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 17 #include "skia/ext/skia_utils_mac.h" | 18 #include "skia/ext/skia_utils_mac.h" |
| 18 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 19 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "webkit/plugins/npapi/plugin_list.h" | |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Must match the tag of the unblock radio button in the xib files. | 24 // Must match the tag of the unblock radio button in the xib files. |
| 25 const int kAllowTag = 1; | 25 const int kAllowTag = 1; |
| 26 | 26 |
| 27 // Must match the tag of the block radio button in the xib files. | 27 // Must match the tag of the block radio button in the xib files. |
| 28 const int kBlockTag = 2; | 28 const int kBlockTag = 2; |
| 29 | 29 |
| 30 // Height of one link in the popup list. | 30 // Height of one link in the popup list. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 int delta = NSMinY([titleLabel_ frame]) - | 238 int delta = NSMinY([titleLabel_ frame]) - |
| 239 NSMinY([blockedResourcesField_ frame]); | 239 NSMinY([blockedResourcesField_ frame]); |
| 240 [blockedResourcesField_ removeFromSuperview]; | 240 [blockedResourcesField_ removeFromSuperview]; |
| 241 NSRect frame = [[self window] frame]; | 241 NSRect frame = [[self window] frame]; |
| 242 frame.size.height -= delta; | 242 frame.size.height -= delta; |
| 243 [[self window] setFrame:frame display:NO]; | 243 [[self window] setFrame:frame display:NO]; |
| 244 } else { | 244 } else { |
| 245 for (std::set<std::string>::iterator it = plugins.begin(); | 245 for (std::set<std::string>::iterator it = plugins.begin(); |
| 246 it != plugins.end(); ++it) { | 246 it != plugins.end(); ++it) { |
| 247 NSString* name = SysUTF16ToNSString( | 247 NSString* name = SysUTF16ToNSString( |
| 248 webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it)); | 248 PluginService::GetInstance()->GetPluginGroupName(*it)); |
| 249 if ([name length] == 0) | 249 if ([name length] == 0) |
| 250 name = base::SysUTF8ToNSString(*it); | 250 name = base::SysUTF8ToNSString(*it); |
| 251 [pluginArray addObject:name]; | 251 [pluginArray addObject:name]; |
| 252 } | 252 } |
| 253 [blockedResourcesField_ | 253 [blockedResourcesField_ |
| 254 setStringValue:[pluginArray componentsJoinedByString:@"\n"]]; | 254 setStringValue:[pluginArray componentsJoinedByString:@"\n"]]; |
| 255 [GTMUILocalizerAndLayoutTweaker | 255 [GTMUILocalizerAndLayoutTweaker |
| 256 sizeToFitFixedWidthTextField:blockedResourcesField_]; | 256 sizeToFitFixedWidthTextField:blockedResourcesField_]; |
| 257 } | 257 } |
| 258 } | 258 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 483 |
| 484 - (IBAction)manageBlocking:(id)sender { | 484 - (IBAction)manageBlocking:(id)sender { |
| 485 contentSettingBubbleModel_->OnManageLinkClicked(); | 485 contentSettingBubbleModel_->OnManageLinkClicked(); |
| 486 } | 486 } |
| 487 | 487 |
| 488 - (IBAction)closeBubble:(id)sender { | 488 - (IBAction)closeBubble:(id)sender { |
| 489 [self close]; | 489 [self close]; |
| 490 } | 490 } |
| 491 | 491 |
| 492 @end // ContentSettingBubbleController | 492 @end // ContentSettingBubbleController |
| OLD | NEW |