| 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/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 if (NSWidth(buttonFrame) > maxWidth) | 339 if (NSWidth(buttonFrame) > maxWidth) |
| 340 buttonFrame.size.width = maxWidth; | 340 buttonFrame.size.width = maxWidth; |
| 341 | 341 |
| 342 [button setFrame:buttonFrame]; | 342 [button setFrame:buttonFrame]; |
| 343 [button setTarget:self]; | 343 [button setTarget:self]; |
| 344 [button setAction:@selector(popupLinkClicked:)]; | 344 [button setAction:@selector(popupLinkClicked:)]; |
| 345 return button; | 345 return button; |
| 346 } | 346 } |
| 347 | 347 |
| 348 - (void)initializeBlockedPluginsList { | 348 - (void)initializeBlockedPluginsList { |
| 349 NSMutableArray* pluginArray = [NSMutableArray array]; | 349 int delta = NSMinY([titleLabel_ frame]) - |
| 350 const std::set<std::string>& plugins = | 350 NSMinY([blockedResourcesField_ frame]); |
| 351 contentSettingBubbleModel_->bubble_content().resource_identifiers; | 351 [blockedResourcesField_ removeFromSuperview]; |
| 352 if (plugins.empty()) { | 352 NSRect frame = [[self window] frame]; |
| 353 int delta = NSMinY([titleLabel_ frame]) - | 353 frame.size.height -= delta; |
| 354 NSMinY([blockedResourcesField_ frame]); | 354 [[self window] setFrame:frame display:NO]; |
| 355 [blockedResourcesField_ removeFromSuperview]; | |
| 356 NSRect frame = [[self window] frame]; | |
| 357 frame.size.height -= delta; | |
| 358 [[self window] setFrame:frame display:NO]; | |
| 359 } else { | |
| 360 PluginFinder* finder = PluginFinder::GetInstance(); | |
| 361 for (std::set<std::string>::iterator it = plugins.begin(); | |
| 362 it != plugins.end(); ++it) { | |
| 363 NSString* name = | |
| 364 SysUTF16ToNSString(finder->FindPluginNameWithIdentifier(*it)); | |
| 365 [pluginArray addObject:name]; | |
| 366 } | |
| 367 [blockedResourcesField_ | |
| 368 setStringValue:[pluginArray componentsJoinedByString:@"\n"]]; | |
| 369 [GTMUILocalizerAndLayoutTweaker | |
| 370 sizeToFitFixedWidthTextField:blockedResourcesField_]; | |
| 371 } | |
| 372 } | 355 } |
| 373 | 356 |
| 374 - (void)initializePopupList { | 357 - (void)initializePopupList { |
| 375 // I didn't put the buttons into a NSMatrix because then they are only one | 358 // I didn't put the buttons into a NSMatrix because then they are only one |
| 376 // entity in the key view loop. This way, one can tab through all of them. | 359 // entity in the key view loop. This way, one can tab through all of them. |
| 377 const ContentSettingBubbleModel::PopupItems& popupItems = | 360 const ContentSettingBubbleModel::PopupItems& popupItems = |
| 378 contentSettingBubbleModel_->bubble_content().popup_items; | 361 contentSettingBubbleModel_->bubble_content().popup_items; |
| 379 | 362 |
| 380 // Get the pre-resize frame of the radio group. Its origin is where the | 363 // Get the pre-resize frame of the radio group. Its origin is where the |
| 381 // popup list should go. | 364 // popup list should go. |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index))); | 781 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index))); |
| 799 | 782 |
| 800 it->second->model->ExecuteCommand(index, 0); | 783 it->second->model->ExecuteCommand(index, 0); |
| 801 } | 784 } |
| 802 | 785 |
| 803 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { | 786 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { |
| 804 return &mediaMenus_; | 787 return &mediaMenus_; |
| 805 } | 788 } |
| 806 | 789 |
| 807 @end // ContentSettingBubbleController | 790 @end // ContentSettingBubbleController |
| OLD | NEW |