| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/content_setting_bubble_cocoa.h" | 5 #import "chrome/browser/cocoa/content_setting_bubble_cocoa.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 429 |
| 430 // Resize window, autoresizing takes care of the rest. | 430 // Resize window, autoresizing takes care of the rest. |
| 431 NSSize size = NSMakeSize(requiredWidth - actualWidth, 0); | 431 NSSize size = NSMakeSize(requiredWidth - actualWidth, 0); |
| 432 size = [[[self window] contentView] convertSize:size toView:nil]; | 432 size = [[[self window] contentView] convertSize:size toView:nil]; |
| 433 NSRect frame = [[self window] frame]; | 433 NSRect frame = [[self window] frame]; |
| 434 frame.origin.x -= size.width; | 434 frame.origin.x -= size.width; |
| 435 frame.size.width += size.width; | 435 frame.size.width += size.width; |
| 436 [[self window] setFrame:frame display:NO]; | 436 [[self window] setFrame:frame display:NO]; |
| 437 } | 437 } |
| 438 | 438 |
| 439 - (void)removeInfoButton { | |
| 440 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 441 switches::kEnableCookiePrompt)) { | |
| 442 // Remove info button and resize vertically. | |
| 443 int deltaY = NSHeight([infoButton_ frame]); | |
| 444 [infoButton_ removeFromSuperview]; | |
| 445 NSRect frame = [[self window] frame]; | |
| 446 frame.size.height -= deltaY; | |
| 447 [[self window] setFrame:frame display:NO]; | |
| 448 } | |
| 449 } | |
| 450 | |
| 451 - (void)awakeFromNib { | 439 - (void)awakeFromNib { |
| 452 [[self bubble] setBubbleType:info_bubble::kWhiteInfoBubble]; | 440 [[self bubble] setBubbleType:info_bubble::kWhiteInfoBubble]; |
| 453 [[self bubble] setArrowLocation:info_bubble::kTopRight]; | 441 [[self bubble] setArrowLocation:info_bubble::kTopRight]; |
| 454 | 442 |
| 455 // Adapt window size to bottom buttons. Do this before all other layouting. | 443 // Adapt window size to bottom buttons. Do this before all other layouting. |
| 456 [self sizeToFitManageDoneButtons]; | 444 [self sizeToFitManageDoneButtons]; |
| 457 | 445 |
| 458 [self initializeTitle]; | 446 [self initializeTitle]; |
| 459 | 447 |
| 460 ContentSettingsType type = contentSettingBubbleModel_->content_type(); | 448 ContentSettingsType type = contentSettingBubbleModel_->content_type(); |
| 461 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { | 449 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| 462 [self sizeToFitLoadPluginsButton]; | 450 [self sizeToFitLoadPluginsButton]; |
| 463 [self initializeBlockedPluginsList]; | 451 [self initializeBlockedPluginsList]; |
| 464 } | 452 } |
| 465 if (type == CONTENT_SETTINGS_TYPE_COOKIES) | |
| 466 [self removeInfoButton]; | |
| 467 if (allowBlockRadioGroup_) // not bound in cookie bubble xib | 453 if (allowBlockRadioGroup_) // not bound in cookie bubble xib |
| 468 [self initializeRadioGroup]; | 454 [self initializeRadioGroup]; |
| 469 | 455 |
| 470 if (type == CONTENT_SETTINGS_TYPE_POPUPS) | 456 if (type == CONTENT_SETTINGS_TYPE_POPUPS) |
| 471 [self initializePopupList]; | 457 [self initializePopupList]; |
| 472 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) | 458 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) |
| 473 [self initializeGeoLists]; | 459 [self initializeGeoLists]; |
| 474 } | 460 } |
| 475 | 461 |
| 476 /////////////////////////////////////////////////////////////////////////////// | 462 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 28 matching lines...) Expand all Loading... |
| 505 DCHECK(i != popupLinks_.end()); | 491 DCHECK(i != popupLinks_.end()); |
| 506 contentSettingBubbleModel_->OnPopupClicked(i->second); | 492 contentSettingBubbleModel_->OnPopupClicked(i->second); |
| 507 } | 493 } |
| 508 | 494 |
| 509 - (void)clearGeolocationForCurrentHost:(id)sender { | 495 - (void)clearGeolocationForCurrentHost:(id)sender { |
| 510 contentSettingBubbleModel_->OnClearLinkClicked(); | 496 contentSettingBubbleModel_->OnClearLinkClicked(); |
| 511 [self close]; | 497 [self close]; |
| 512 } | 498 } |
| 513 | 499 |
| 514 @end // ContentSettingBubbleController | 500 @end // ContentSettingBubbleController |
| OLD | NEW |