| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/website_settings/website_settings_bubble_contro
ller.h" | 5 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro
ller.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "content/public/browser/cert_store.h" | 34 #include "content/public/browser/cert_store.h" |
| 35 #include "content/public/browser/page_navigator.h" | 35 #include "content/public/browser/page_navigator.h" |
| 36 #include "content/public/browser/ssl_host_state_delegate.h" | 36 #include "content/public/browser/ssl_host_state_delegate.h" |
| 37 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
| 38 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 39 #include "content/public/common/url_constants.h" | 39 #include "content/public/common/url_constants.h" |
| 40 #include "extensions/common/constants.h" | 40 #include "extensions/common/constants.h" |
| 41 #include "grit/components_chromium_strings.h" | 41 #include "grit/components_chromium_strings.h" |
| 42 #include "grit/components_google_chrome_strings.h" | 42 #include "grit/components_google_chrome_strings.h" |
| 43 #include "grit/components_strings.h" | 43 #include "grit/components_strings.h" |
| 44 #include "skia/ext/skia_utils_mac.h" |
| 44 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 45 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
| 45 #include "ui/base/cocoa/cocoa_base_utils.h" | 46 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 46 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 47 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
| 47 #import "ui/base/cocoa/flipped_view.h" | 48 #import "ui/base/cocoa/flipped_view.h" |
| 48 #import "ui/base/cocoa/hover_image_button.h" | 49 #import "ui/base/cocoa/hover_image_button.h" |
| 49 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
| 50 #include "ui/base/resource/resource_bundle.h" | 51 #include "ui/base/resource/resource_bundle.h" |
| 51 #import "ui/gfx/mac/coordinate_conversion.h" | 52 #import "ui/gfx/mac/coordinate_conversion.h" |
| 52 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 53 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 53 #include "ui/resources/grit/ui_resources.h" | 54 #include "ui/resources/grit/ui_resources.h" |
| 54 | 55 |
| 55 using ChosenObjectInfoPtr = | 56 using ChosenObjectInfoPtr = |
| 56 std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo>; | 57 std::unique_ptr<WebsiteSettingsUI::ChosenObjectInfo>; |
| 57 using ChosenObjectDeleteCallback = | 58 using ChosenObjectDeleteCallback = |
| 58 base::Callback<void(const WebsiteSettingsUI::ChosenObjectInfo&)>; | 59 base::Callback<void(const WebsiteSettingsUI::ChosenObjectInfo&)>; |
| 59 | 60 |
| 60 namespace { | 61 namespace { |
| 61 | 62 |
| 62 // The default width of the window, in view coordinates. It may be larger to | |
| 63 // fit the content. | |
| 64 const CGFloat kDefaultWindowWidth = 310; | |
| 65 | |
| 66 // Padding between the window frame and content. | |
| 67 const CGFloat kFramePadding = 20; | |
| 68 | |
| 69 // Padding between the window frame and content. | |
| 70 const CGFloat kVerticalSectionMargin = 16; | |
| 71 | |
| 72 // Padding between the window frame and content for the internal page bubble. | |
| 73 const CGFloat kInternalPageFramePadding = 10; | |
| 74 | |
| 75 // Spacing between the identity field and the security summary. | |
| 76 const CGFloat kSpacingBeforeSecuritySummary = 2; | |
| 77 | |
| 78 // Spacing between the security summary and the reset decisions button. | |
| 79 const CGFloat kSpacingBeforeResetDecisionsButton = 8; | |
| 80 | |
| 81 // Spacing between parts of the site settings section. | |
| 82 const CGFloat kSiteSettingsSectionSpacing = 2; | |
| 83 | |
| 84 // Spacing between the image and text for internal pages. | |
| 85 const CGFloat kInternalPageImageSpacing = 10; | |
| 86 | |
| 87 // Square size of the permission images. | |
| 88 const CGFloat kPermissionImageSize = 19; | |
| 89 | |
| 90 // Square size of the permission delete button image. | |
| 91 const CGFloat kPermissionDeleteImageSize = 16; | |
| 92 | |
| 93 // Vertical adjustment for the permission images. They have an extra pixel of | |
| 94 // padding on the bottom edge. | |
| 95 const CGFloat kPermissionImageYAdjust = 1; | |
| 96 | |
| 97 // Spacing between a permission image and the text. | |
| 98 const CGFloat kPermissionImageSpacing = 3; | |
| 99 | |
| 100 // The spacing between individual items in the Permissions tab. | |
| 101 const CGFloat kPermissionsTabSpacing = 12; | |
| 102 | |
| 103 // Extra spacing after a headline on the Permissions tab. | |
| 104 const CGFloat kPermissionsHeadlineSpacing = 2; | |
| 105 | |
| 106 // The amount of horizontal space between a permission label and the popup. | |
| 107 const CGFloat kPermissionPopUpXSpacing = 3; | |
| 108 | |
| 109 // The amount of padding to *remove* when placing | |
| 110 // |IDS_WEBSITE_SETTINGS_{FIRST,THIRD}_PARTY_SITE_DATA| next to each other. | |
| 111 const CGFloat kTextLabelXPadding = 5; | |
| 112 | |
| 113 // NOTE: This assumes that there will never be more than one website settings | 63 // NOTE: This assumes that there will never be more than one website settings |
| 114 // popup shown, and that the one that is shown is associated with the current | 64 // popup shown, and that the one that is shown is associated with the current |
| 115 // window. This matches the behaviour in views: see WebsiteSettingsPopupView. | 65 // window. This matches the behaviour in views: see WebsiteSettingsPopupView. |
| 116 bool g_is_popup_showing = false; | 66 bool g_is_popup_showing = false; |
| 117 | 67 |
| 68 /**************** General ****************/ |
| 69 |
| 70 // The default width of the window, in view coordinates. It may be larger to |
| 71 // fit the content. |
| 72 const CGFloat kDefaultWindowWidth = 320; |
| 73 |
| 74 // Padding around each section |
| 75 const CGFloat kSectionVerticalPadding = 20; |
| 76 const CGFloat kSectionHorizontalPadding = 16; |
| 77 |
| 78 /**************** Security Section ****************/ |
| 79 |
| 80 // Tweak to move the security summary up. |
| 81 const CGFloat kSecuritySummaryYAdjustment = -6; |
| 82 |
| 83 // Spacing between security summary, security details, and cert decisions text. |
| 84 const CGFloat kSecurityParagraphSpacing = 12; |
| 85 |
| 86 /**************** Site Settings Section ****************/ |
| 87 |
| 88 // The amount of padding to *remove* when placing |
| 89 // |IDS_WEBSITE_SETTINGS_{FIRST,THIRD}_PARTY_SITE_DATA| next to each other. |
| 90 const CGFloat kCookieCountXAdjustment = 5; |
| 91 |
| 92 // Square size of the permission images. |
| 93 const CGFloat kPermissionImageSize = 16; |
| 94 |
| 95 // Spacing between a permission image and the text. |
| 96 const CGFloat kPermissionImageSpacing = 6; |
| 97 |
| 98 // Square size of the permission delete button image. |
| 99 const CGFloat kPermissionDeleteImageSize = 16; |
| 100 |
| 101 // The spacing between individual permissions. |
| 102 const CGFloat kPermissionsVerticalSpacing = 16; |
| 103 |
| 104 // Amount to lower each permission popup button to make its text align with the |
| 105 // permission label. |
| 106 const CGFloat kPermissionPopupButtonYAdjustment = 3; |
| 107 |
| 108 /**************** Internal Page Bubble ****************/ |
| 109 |
| 110 // Padding between the window frame and content for the internal page bubble. |
| 111 const CGFloat kInternalPageFramePadding = 10; |
| 112 |
| 113 // Spacing between the image and text for internal pages. |
| 114 const CGFloat kInternalPageImageSpacing = 10; |
| 115 |
| 118 // Takes in the parent window, which should be a BrowserWindow, and gets the | 116 // Takes in the parent window, which should be a BrowserWindow, and gets the |
| 119 // proper anchor point for the bubble. The returned point is in screen | 117 // proper anchor point for the bubble. The returned point is in screen |
| 120 // coordinates. | 118 // coordinates. |
| 121 NSPoint AnchorPointForWindow(NSWindow* parent) { | 119 NSPoint AnchorPointForWindow(NSWindow* parent) { |
| 122 BrowserWindowController* controller = [parent windowController]; | 120 BrowserWindowController* controller = [parent windowController]; |
| 123 NSPoint origin = NSZeroPoint; | 121 NSPoint origin = NSZeroPoint; |
| 124 if ([controller isKindOfClass:[BrowserWindowController class]]) { | 122 if ([controller isKindOfClass:[BrowserWindowController class]]) { |
| 125 LocationBarViewMac* location_bar = [controller locationBarBridge]; | 123 LocationBarViewMac* location_bar = [controller locationBarBridge]; |
| 126 if (location_bar) { | 124 if (location_bar) { |
| 127 NSPoint bubble_point = location_bar->GetPageInfoBubblePoint(); | 125 NSPoint bubble_point = location_bar->GetPageInfoBubblePoint(); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // results when the image, at 26x26, was taller than (or just slightly | 271 // results when the image, at 26x26, was taller than (or just slightly |
| 274 // shorter) than the text, but produced incorrect results once the icon | 272 // shorter) than the text, but produced incorrect results once the icon |
| 275 // shrank to 16x16. The icon should now always be shorter than the text. | 273 // shrank to 16x16. The icon should now always be shorter than the text. |
| 276 // See crbug.com/572044 . | 274 // See crbug.com/572044 . |
| 277 NSRect textFrame = [textField frame]; | 275 NSRect textFrame = [textField frame]; |
| 278 imageFrame.origin.y += (NSHeight(textFrame) - NSHeight(imageFrame)) / 2; | 276 imageFrame.origin.y += (NSHeight(textFrame) - NSHeight(imageFrame)) / 2; |
| 279 [imageView setFrame:imageFrame]; | 277 [imageView setFrame:imageFrame]; |
| 280 | 278 |
| 281 // Adjust the contentView to fit everything. | 279 // Adjust the contentView to fit everything. |
| 282 CGFloat maxY = std::max(NSMaxY(imageFrame), NSMaxY(textFrame)); | 280 CGFloat maxY = std::max(NSMaxY(imageFrame), NSMaxY(textFrame)); |
| 283 [contentView_ setFrame:NSMakeRect( | 281 [contentView_ setFrame:NSMakeRect(0, 0, [self defaultWindowWidth], |
| 284 0, 0, [self defaultWindowWidth], maxY + kInternalPageFramePadding)]; | 282 maxY + kInternalPageFramePadding)]; |
| 285 | 283 |
| 286 [self sizeAndPositionWindow]; | 284 [self sizeAndPositionWindow]; |
| 287 } | 285 } |
| 288 | 286 |
| 289 // Create the subviews for the website settings bubble. | 287 // Create the subviews for the website settings bubble. |
| 290 - (void)initializeContents { | 288 - (void)initializeContents { |
| 291 securitySectionView_ = [self addSecuritySectionToView:contentView_]; | 289 securitySectionView_ = [self addSecuritySectionToView:contentView_]; |
| 292 separatorAfterSecuritySection_ = [self addSeparatorToView:contentView_]; | 290 separatorAfterSecuritySection_ = [self addSeparatorToView:contentView_]; |
| 293 siteSettingsSectionView_ = [self addSiteSettingsSectionToView:contentView_]; | 291 siteSettingsSectionView_ = [self addSiteSettingsSectionToView:contentView_]; |
| 294 | 292 |
| 295 [self performLayout]; | 293 [self performLayout]; |
| 296 } | 294 } |
| 297 | 295 |
| 298 // Create and return a subview for the security section and add it to the given | 296 // Create and return a subview for the security section and add it to the given |
| 299 // |superview|. |superview| retains the new view. | 297 // |superview|. |superview| retains the new view. |
| 300 - (NSView*)addSecuritySectionToView:(NSView*)superview { | 298 - (NSView*)addSecuritySectionToView:(NSView*)superview { |
| 301 base::scoped_nsobject<NSView> securitySectionView( | 299 base::scoped_nsobject<NSView> securitySectionView( |
| 302 [[FlippedView alloc] initWithFrame:[superview frame]]); | 300 [[FlippedView alloc] initWithFrame:[superview frame]]); |
| 303 [superview addSubview:securitySectionView]; | 301 [superview addSubview:securitySectionView]; |
| 304 | 302 |
| 305 // Create a controlOrigin to place the text fields. The y value doesn't | 303 // Create a controlOrigin to place the text fields. The y value doesn't |
| 306 // matter, because the correct value is calculated in -performLayout. | 304 // matter, because the correct value is calculated in -performLayout. |
| 307 NSPoint controlOrigin = NSMakePoint(kFramePadding, 0); | 305 NSPoint controlOrigin = NSMakePoint(kSectionHorizontalPadding, 0); |
| 308 | |
| 309 // Create a text field (empty for now) to show the site identity. | |
| 310 identityField_ = [self addText:base::string16() | |
| 311 withSize:[NSFont systemFontSize] | |
| 312 bold:YES | |
| 313 toView:securitySectionView | |
| 314 atPoint:controlOrigin]; | |
| 315 | 306 |
| 316 // Create a text field for the security summary (private/not private/etc.). | 307 // Create a text field for the security summary (private/not private/etc.). |
| 317 securitySummaryField_ = [self addText:base::string16() | 308 securitySummaryField_ = [self addText:base::string16() |
| 309 withSize:[NSFont systemFontSize] |
| 310 bold:NO |
| 311 toView:securitySectionView |
| 312 atPoint:controlOrigin]; |
| 313 |
| 314 securityDetailsField_ = [self addText:base::string16() |
| 318 withSize:[NSFont smallSystemFontSize] | 315 withSize:[NSFont smallSystemFontSize] |
| 319 bold:NO | 316 bold:NO |
| 320 toView:securitySectionView | 317 toView:securitySectionView |
| 321 atPoint:controlOrigin]; | 318 atPoint:controlOrigin]; |
| 322 | 319 |
| 323 resetDecisionsButton_ = nil; // This will be created only if necessary. | 320 // These will be created only if necessary. |
| 321 resetDecisionsField_ = nil; |
| 322 resetDecisionsButton_ = nil; |
| 324 | 323 |
| 325 NSString* securityDetailsButtonText = | 324 NSString* securityDetailsButtonText = |
| 326 l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_DETAILS_LINK); | 325 l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_DETAILS_LINK); |
| 327 // Note: The security details button may be removed from the superview in | 326 // Note: The security details button may be removed from the superview in |
| 328 // -performLayout in order to hide it (depending on the connection). | 327 // -performLayout in order to hide it (depending on the connection). |
| 329 securityDetailsButton_ = [self addLinkButtonWithText:securityDetailsButtonText | 328 securityDetailsButton_ = [self addLinkButtonWithText:securityDetailsButtonText |
| 330 toView:securitySectionView]; | 329 toView:securitySectionView]; |
| 331 [securityDetailsButton_ setTarget:self]; | 330 [securityDetailsButton_ setTarget:self]; |
| 332 [securityDetailsButton_ setAction:@selector(showSecurityDetails:)]; | 331 [securityDetailsButton_ setAction:@selector(showSecurityDetails:)]; |
| 333 | 332 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 351 permissionsView_ = | 350 permissionsView_ = |
| 352 [[[FlippedView alloc] initWithFrame:[superview frame]] autorelease]; | 351 [[[FlippedView alloc] initWithFrame:[superview frame]] autorelease]; |
| 353 [siteSettingsSectionView addSubview:permissionsView_]; | 352 [siteSettingsSectionView addSubview:permissionsView_]; |
| 354 | 353 |
| 355 // Create the link button to view site settings. Its position will be set in | 354 // Create the link button to view site settings. Its position will be set in |
| 356 // performLayout. | 355 // performLayout. |
| 357 NSString* siteSettingsButtonText = | 356 NSString* siteSettingsButtonText = |
| 358 l10n_util::GetNSString(IDS_PAGE_INFO_SITE_SETTINGS_LINK); | 357 l10n_util::GetNSString(IDS_PAGE_INFO_SITE_SETTINGS_LINK); |
| 359 siteSettingsButton_ = [self addLinkButtonWithText:siteSettingsButtonText | 358 siteSettingsButton_ = [self addLinkButtonWithText:siteSettingsButtonText |
| 360 toView:siteSettingsSectionView]; | 359 toView:siteSettingsSectionView]; |
| 360 NSFont* font = [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]]; |
| 361 [siteSettingsButton_ setFont:font]; |
| 362 [GTMUILocalizerAndLayoutTweaker sizeToFitView:siteSettingsButton_]; |
| 363 |
| 361 [siteSettingsButton_ setTarget:self]; | 364 [siteSettingsButton_ setTarget:self]; |
| 362 [siteSettingsButton_ setAction:@selector(showSiteSettingsData:)]; | 365 [siteSettingsButton_ setAction:@selector(showSiteSettingsData:)]; |
| 363 | 366 |
| 364 return siteSettingsSectionView.get(); | 367 return siteSettingsSectionView.get(); |
| 365 } | 368 } |
| 366 | 369 |
| 367 // Handler for the link button below the list of cookies. | 370 // Handler for the link button below the list of cookies. |
| 368 - (void)showCookiesAndSiteData:(id)sender { | 371 - (void)showCookiesAndSiteData:(id)sender { |
| 369 DCHECK(webContents_); | 372 DCHECK(webContents_); |
| 370 DCHECK(presenter_); | 373 DCHECK(presenter_); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 446 |
| 444 // Set the width of the content view now, so that all the text fields will | 447 // Set the width of the content view now, so that all the text fields will |
| 445 // be sized to fit before their heights and vertical positions are adjusted. | 448 // be sized to fit before their heights and vertical positions are adjusted. |
| 446 [self setWidthOfView:contentView_ to:contentWidth]; | 449 [self setWidthOfView:contentView_ to:contentWidth]; |
| 447 [self setWidthOfView:securitySectionView_ to:contentWidth]; | 450 [self setWidthOfView:securitySectionView_ to:contentWidth]; |
| 448 [self setWidthOfView:siteSettingsSectionView_ to:contentWidth]; | 451 [self setWidthOfView:siteSettingsSectionView_ to:contentWidth]; |
| 449 | 452 |
| 450 CGFloat yPos = info_bubble::kBubbleArrowHeight; | 453 CGFloat yPos = info_bubble::kBubbleArrowHeight; |
| 451 | 454 |
| 452 [self layoutSecuritySection]; | 455 [self layoutSecuritySection]; |
| 453 yPos = [self setYPositionOfView:securitySectionView_ to:yPos + kFramePadding]; | 456 yPos = [self setYPositionOfView:securitySectionView_ to:yPos]; |
| 454 | 457 |
| 455 yPos = [self setYPositionOfView:separatorAfterSecuritySection_ | 458 yPos = [self setYPositionOfView:separatorAfterSecuritySection_ |
| 456 to:yPos + kVerticalSectionMargin]; | 459 to:yPos + kSectionHorizontalPadding]; |
| 457 | 460 |
| 458 [self layoutSiteSettingsSection]; | 461 [self layoutSiteSettingsSection]; |
| 459 yPos = [self setYPositionOfView:siteSettingsSectionView_ | 462 yPos = [self setYPositionOfView:siteSettingsSectionView_ |
| 460 to:yPos + kVerticalSectionMargin]; | 463 to:yPos + kSectionHorizontalPadding]; |
| 461 | 464 |
| 462 [contentView_ setFrame:NSMakeRect(0, 0, NSWidth([contentView_ frame]), | 465 [contentView_ setFrame:NSMakeRect(0, 0, NSWidth([contentView_ frame]), |
| 463 yPos + kFramePadding)]; | 466 yPos + kSectionVerticalPadding)]; |
| 464 | 467 |
| 465 [self sizeAndPositionWindow]; | 468 [self sizeAndPositionWindow]; |
| 466 } | 469 } |
| 467 | 470 |
| 468 - (void)layoutSecuritySection { | 471 - (void)layoutSecuritySection { |
| 469 // Start the layout with the first element. Margins are handled by the caller. | 472 // Start the layout with the first element. Margins are handled by the caller. |
| 470 CGFloat yPos = 0; | 473 CGFloat yPos = 0; |
| 471 | 474 |
| 472 [self sizeTextFieldHeightToFit:identityField_]; | |
| 473 yPos = [self setYPositionOfView:identityField_ to:yPos]; | |
| 474 | |
| 475 [self sizeTextFieldHeightToFit:securitySummaryField_]; | 475 [self sizeTextFieldHeightToFit:securitySummaryField_]; |
| 476 yPos = [self setYPositionOfView:securitySummaryField_ | 476 yPos = [self setYPositionOfView:securitySummaryField_ |
| 477 to:yPos + kSpacingBeforeSecuritySummary]; | 477 to:yPos + kSectionVerticalPadding + |
| 478 kSecuritySummaryYAdjustment]; |
| 479 |
| 480 [self sizeTextFieldHeightToFit:securityDetailsField_]; |
| 481 yPos = [self setYPositionOfView:securityDetailsField_ |
| 482 to:yPos + kSecurityParagraphSpacing]; |
| 478 | 483 |
| 479 if (isDevToolsDisabled_ && certificateId_ == 0) { | 484 if (isDevToolsDisabled_ && certificateId_ == 0) { |
| 480 // -removeFromSuperview is idempotent. | 485 // -removeFromSuperview is idempotent. |
| 481 [securityDetailsButton_ removeFromSuperview]; | 486 [securityDetailsButton_ removeFromSuperview]; |
| 482 } else { | 487 } else { |
| 483 // -addSubview is idempotent. | 488 // -addSubview is idempotent. |
| 484 [securitySectionView_ addSubview:securityDetailsButton_]; | 489 [securitySectionView_ addSubview:securityDetailsButton_]; |
| 485 yPos = [self setYPositionOfView:securityDetailsButton_ to:yPos]; | 490 yPos = [self setYPositionOfView:securityDetailsButton_ to:yPos]; |
| 486 } | 491 } |
| 487 | 492 |
| 488 if (resetDecisionsButton_) { | 493 if (resetDecisionsButton_) { |
| 489 yPos = [self setYPositionOfView:resetDecisionsButton_ | 494 DCHECK(resetDecisionsField_); |
| 490 to:yPos + kSpacingBeforeResetDecisionsButton]; | 495 yPos = [self setYPositionOfView:resetDecisionsField_ |
| 496 to:yPos + kSecurityParagraphSpacing]; |
| 497 yPos = [self setYPositionOfView:resetDecisionsButton_ to:yPos]; |
| 491 } | 498 } |
| 492 | 499 |
| 493 // Resize the height based on contents. | 500 // Resize the height based on contents. |
| 494 [self setHeightOfView:securitySectionView_ to:yPos]; | 501 [self setHeightOfView:securitySectionView_ to:yPos]; |
| 495 } | 502 } |
| 496 | 503 |
| 497 - (void)layoutSiteSettingsSection { | 504 - (void)layoutSiteSettingsSection { |
| 498 // Start the layout with the first element. Margins are handled by the caller. | 505 // Start the layout with the first element. Margins are handled by the caller. |
| 499 CGFloat yPos = 0; | 506 CGFloat yPos = 0; |
| 500 | 507 |
| 501 yPos = [self setYPositionOfView:cookiesView_ to:yPos]; | 508 yPos = [self setYPositionOfView:cookiesView_ to:yPos]; |
| 502 | 509 |
| 503 if (permissionsPresent_) { | 510 if (permissionsPresent_) { |
| 504 // Put the permission info just below the link button. | 511 // Put the permission info just below the link button. |
| 505 yPos = [self setYPositionOfView:permissionsView_ | 512 yPos = [self setYPositionOfView:permissionsView_ to:yPos]; |
| 506 to:yPos + kSiteSettingsSectionSpacing]; | |
| 507 } | 513 } |
| 508 | 514 |
| 509 // Put the link button for site settings just below the permissions. | 515 // Put the link button for site settings just below the permissions. |
| 510 // TODO(lgarron): set the position of this based on RTL/LTR. | 516 // TODO(lgarron): set the position of this based on RTL/LTR. |
| 511 // http://code.google.com/p/chromium/issues/detail?id=525304 | 517 // http://code.google.com/p/chromium/issues/detail?id=525304 |
| 512 yPos += kSiteSettingsSectionSpacing; | 518 CGFloat xPos = kDefaultWindowWidth - kSectionVerticalPadding - |
| 513 [siteSettingsButton_ setFrameOrigin:NSMakePoint(kFramePadding, yPos)]; | 519 NSWidth([siteSettingsButton_ frame]); |
| 520 [siteSettingsButton_ setFrameOrigin:NSMakePoint(xPos, yPos)]; |
| 514 yPos = NSMaxY([siteSettingsButton_ frame]); | 521 yPos = NSMaxY([siteSettingsButton_ frame]); |
| 515 | 522 |
| 516 // Resize the height based on contents. | 523 // Resize the height based on contents. |
| 517 [self setHeightOfView:siteSettingsSectionView_ to:yPos]; | 524 [self setHeightOfView:siteSettingsSectionView_ to:yPos]; |
| 518 } | 525 } |
| 519 | 526 |
| 520 // Adjust the size of the window to match the size of the content, and position | 527 // Adjust the size of the window to match the size of the content, and position |
| 521 // the bubble anchor appropriately. | 528 // the bubble anchor appropriately. |
| 522 - (void)sizeAndPositionWindow { | 529 - (void)sizeAndPositionWindow { |
| 523 NSRect windowFrame = [contentView_ frame]; | 530 NSRect windowFrame = [contentView_ frame]; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 565 |
| 559 // Create a new text field and add it to the given array of subviews. | 566 // Create a new text field and add it to the given array of subviews. |
| 560 // The array will retain a reference to the object. | 567 // The array will retain a reference to the object. |
| 561 - (NSTextField*)addText:(const base::string16&)text | 568 - (NSTextField*)addText:(const base::string16&)text |
| 562 withSize:(CGFloat)fontSize | 569 withSize:(CGFloat)fontSize |
| 563 bold:(BOOL)bold | 570 bold:(BOOL)bold |
| 564 toView:(NSView*)view | 571 toView:(NSView*)view |
| 565 atPoint:(NSPoint)point { | 572 atPoint:(NSPoint)point { |
| 566 // Size the text to take up the full available width, with some padding. | 573 // Size the text to take up the full available width, with some padding. |
| 567 // The height is arbitrary as it will be adjusted later. | 574 // The height is arbitrary as it will be adjusted later. |
| 568 CGFloat width = NSWidth([view frame]) - point.x - kFramePadding; | 575 CGFloat width = NSWidth([view frame]) - point.x - kSectionHorizontalPadding; |
| 569 NSRect frame = NSMakeRect(point.x, point.y, width, 100); | 576 NSRect frame = NSMakeRect(point.x, point.y, width, 100); |
| 570 base::scoped_nsobject<NSTextField> textField( | 577 base::scoped_nsobject<NSTextField> textField( |
| 571 [[NSTextField alloc] initWithFrame:frame]); | 578 [[NSTextField alloc] initWithFrame:frame]); |
| 572 [self configureTextFieldAsLabel:textField.get()]; | 579 [self configureTextFieldAsLabel:textField.get()]; |
| 573 [textField setStringValue:base::SysUTF16ToNSString(text)]; | 580 [textField setStringValue:base::SysUTF16ToNSString(text)]; |
| 574 NSFont* font = bold ? [NSFont boldSystemFontOfSize:fontSize] | 581 NSFont* font = bold ? [NSFont boldSystemFontOfSize:fontSize] |
| 575 : [NSFont systemFontOfSize:fontSize]; | 582 : [NSFont systemFontOfSize:fontSize]; |
| 576 [textField setFont:font]; | 583 [textField setFont:font]; |
| 577 [self sizeTextFieldHeightToFit:textField]; | 584 [self sizeTextFieldHeightToFit:textField]; |
| 578 [textField setAutoresizingMask:NSViewWidthSizable]; | 585 [textField setAutoresizingMask:NSViewWidthSizable]; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 598 // Use an arbitrary position; it will be adjusted in performLayout. | 605 // Use an arbitrary position; it will be adjusted in performLayout. |
| 599 NSBox* spacer = [self | 606 NSBox* spacer = [self |
| 600 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)]; | 607 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)]; |
| 601 [view addSubview:spacer]; | 608 [view addSubview:spacer]; |
| 602 return spacer; | 609 return spacer; |
| 603 } | 610 } |
| 604 | 611 |
| 605 // Add a link button with the given text to |view|. | 612 // Add a link button with the given text to |view|. |
| 606 - (NSButton*)addLinkButtonWithText:(NSString*)text toView:(NSView*)view { | 613 - (NSButton*)addLinkButtonWithText:(NSString*)text toView:(NSView*)view { |
| 607 // Frame size is arbitrary; it will be adjusted by the layout tweaker. | 614 // Frame size is arbitrary; it will be adjusted by the layout tweaker. |
| 608 NSRect frame = NSMakeRect(kFramePadding, 0, 100, 10); | 615 NSRect frame = NSMakeRect(kSectionHorizontalPadding, 0, 100, 10); |
| 609 base::scoped_nsobject<NSButton> button( | 616 base::scoped_nsobject<NSButton> button( |
| 610 [[NSButton alloc] initWithFrame:frame]); | 617 [[NSButton alloc] initWithFrame:frame]); |
| 611 base::scoped_nsobject<HyperlinkButtonCell> cell( | 618 base::scoped_nsobject<HyperlinkButtonCell> cell( |
| 612 [[HyperlinkButtonCell alloc] initTextCell:text]); | 619 [[HyperlinkButtonCell alloc] initTextCell:text]); |
| 613 [cell setControlSize:NSSmallControlSize]; | 620 [cell setControlSize:NSSmallControlSize]; |
| 614 [button setCell:cell.get()]; | 621 [button setCell:cell.get()]; |
| 615 [button setButtonType:NSMomentaryPushInButton]; | 622 [button setButtonType:NSMomentaryPushInButton]; |
| 616 [button setBezelStyle:NSRegularSquareBezelStyle]; | 623 [button setBezelStyle:NSRegularSquareBezelStyle]; |
| 617 [view addSubview:button.get()]; | 624 [view addSubview:button.get()]; |
| 618 | 625 |
| 619 [GTMUILocalizerAndLayoutTweaker sizeToFitView:button.get()]; | 626 [GTMUILocalizerAndLayoutTweaker sizeToFitView:button.get()]; |
| 620 return button.get(); | 627 return button.get(); |
| 621 } | 628 } |
| 622 | 629 |
| 623 // Create and return a button with the specified text and add it to the given | 630 // Create and return a button with the specified text and add it to the given |
| 624 // |view|. |view| retains the new button. | 631 // |view|. |view| retains the new button. |
| 625 - (NSButton*)addButtonWithText:(NSString*)text toView:(NSView*)view { | 632 - (NSButton*)addButtonWithText:(NSString*)text toView:(NSView*)view { |
| 626 NSRect containerFrame = [view frame]; | 633 NSRect containerFrame = [view frame]; |
| 627 // Frame size is arbitrary; it will be adjusted by the layout tweaker. | 634 // Frame size is arbitrary; it will be adjusted by the layout tweaker. |
| 628 NSRect frame = NSMakeRect(kFramePadding, 0, 100, 10); | 635 NSRect frame = NSMakeRect(kSectionHorizontalPadding, 0, 100, 10); |
| 629 base::scoped_nsobject<NSButton> button( | 636 base::scoped_nsobject<NSButton> button( |
| 630 [[NSButton alloc] initWithFrame:frame]); | 637 [[NSButton alloc] initWithFrame:frame]); |
| 631 | 638 |
| 632 // Determine the largest possible size for this button. The size is the width | 639 // Determine the largest possible size for this button. The size is the width |
| 633 // of the connection section minus the padding on both sides minus the | 640 // of the connection section minus the padding on both sides minus the |
| 634 // connection image size and spacing. | 641 // connection image size and spacing. |
| 635 // TODO(lgarron): handle this sizing in -performLayout. | 642 // TODO(lgarron): handle this sizing in -performLayout. |
| 636 CGFloat maxTitleWidth = containerFrame.size.width - kFramePadding * 2; | 643 CGFloat maxTitleWidth = |
| 644 containerFrame.size.width - kSectionHorizontalPadding * 2; |
| 637 | 645 |
| 638 base::scoped_nsobject<NSButtonCell> cell( | 646 base::scoped_nsobject<NSButtonCell> cell( |
| 639 [[NSButtonCell alloc] initTextCell:text]); | 647 [[NSButtonCell alloc] initTextCell:text]); |
| 640 [button setCell:cell.get()]; | 648 [button setCell:cell.get()]; |
| 641 [GTMUILocalizerAndLayoutTweaker sizeToFitView:button.get()]; | 649 [GTMUILocalizerAndLayoutTweaker sizeToFitView:button.get()]; |
| 642 | 650 |
| 643 // Ensure the containing view is large enough to contain the button with its | 651 // Ensure the containing view is large enough to contain the button with its |
| 644 // widest possible title. | 652 // widest possible title. |
| 645 NSRect buttonFrame = [button frame]; | 653 NSRect buttonFrame = [button frame]; |
| 646 buttonFrame.size.width = maxTitleWidth; | 654 buttonFrame.size.width = maxTitleWidth; |
| 647 | 655 |
| 648 [button setFrame:buttonFrame]; | 656 [button setFrame:buttonFrame]; |
| 649 [button setButtonType:NSMomentaryPushInButton]; | 657 [button setButtonType:NSMomentaryPushInButton]; |
| 650 [button setBezelStyle:NSRegularSquareBezelStyle]; | 658 [button setBezelStyle:NSRegularSquareBezelStyle]; |
| 651 [view addSubview:button.get()]; | 659 [view addSubview:button.get()]; |
| 652 | 660 |
| 653 return button.get(); | 661 return button.get(); |
| 654 } | 662 } |
| 655 | 663 |
| 656 // Set the content of the identity and identity status fields. | 664 // Set the content of the identity and identity status fields. |
| 657 - (void)setIdentityInfo:(const WebsiteSettingsUI::IdentityInfo&)identityInfo { | 665 - (void)setIdentityInfo:(const WebsiteSettingsUI::IdentityInfo&)identityInfo { |
| 658 [identityField_ | 666 std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description = |
| 659 setStringValue:base::SysUTF8ToNSString(identityInfo.site_identity)]; | 667 identityInfo.GetSecurityDescription(); |
| 660 [securitySummaryField_ setStringValue:base::SysUTF16ToNSString( | 668 [securitySummaryField_ |
| 661 identityInfo.GetSecuritySummary())]; | 669 setStringValue:base::SysUTF16ToNSString(security_description->summary)]; |
| 670 |
| 671 if (security_description->summary_style & WebsiteSettingsUI::STYLE_COLOR) { |
| 672 NSColor* color = |
| 673 skia::SkColorToSRGBNSColor(security_description->summary_color); |
| 674 [securitySummaryField_ setTextColor:color]; |
| 675 } |
| 676 |
| 677 [securityDetailsField_ |
| 678 setStringValue:SysUTF16ToNSString(security_description->details)]; |
| 662 | 679 |
| 663 certificateId_ = identityInfo.cert_id; | 680 certificateId_ = identityInfo.cert_id; |
| 664 | 681 |
| 665 if (certificateId_ && identityInfo.show_ssl_decision_revoke_button) { | 682 if (certificateId_ && identityInfo.show_ssl_decision_revoke_button) { |
| 666 NSString* text = l10n_util::GetNSString( | 683 resetDecisionsField_ = |
| 667 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON); | 684 [self addText:base::string16() |
| 685 withSize:[NSFont smallSystemFontSize] |
| 686 bold:NO |
| 687 toView:securitySectionView_ |
| 688 atPoint:NSMakePoint(kSectionHorizontalPadding, 0)]; |
| 689 [resetDecisionsField_ |
| 690 setStringValue:l10n_util::GetNSString( |
| 691 IDS_PAGEINFO_INVALID_CERTIFICATE_DESCRIPTION)]; |
| 692 [self sizeTextFieldHeightToFit:resetDecisionsField_]; |
| 693 |
| 668 resetDecisionsButton_ = | 694 resetDecisionsButton_ = |
| 669 [self addButtonWithText:text toView:securitySectionView_]; | 695 [self addLinkButtonWithText: |
| 696 l10n_util::GetNSString( |
| 697 IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON) |
| 698 toView:securitySectionView_]; |
| 670 [resetDecisionsButton_ setTarget:self]; | 699 [resetDecisionsButton_ setTarget:self]; |
| 671 [resetDecisionsButton_ setAction:@selector(resetCertificateDecisions:)]; | 700 [resetDecisionsButton_ setAction:@selector(resetCertificateDecisions:)]; |
| 672 } | 701 } |
| 673 | 702 |
| 674 [self performLayout]; | 703 [self performLayout]; |
| 675 } | 704 } |
| 676 | 705 |
| 677 // Add a pop-up button for |permissionInfo| to the given view. | 706 // Add a pop-up button for |permissionInfo| to the given view. |
| 678 - (NSPopUpButton*)addPopUpButtonForPermission: | 707 - (NSPopUpButton*)addPopUpButtonForPermission: |
| 679 (const WebsiteSettingsUI::PermissionInfo&)permissionInfo | 708 (const WebsiteSettingsUI::PermissionInfo&)permissionInfo |
| 680 toView:(NSView*)view | 709 toView:(NSView*)view |
| 681 atPoint:(NSPoint)point { | 710 atPoint:(NSPoint)point { |
| 682 | 711 |
| 683 GURL url = webContents_ ? webContents_->GetURL() : GURL(); | 712 GURL url = webContents_ ? webContents_->GetURL() : GURL(); |
| 684 __block WebsiteSettingsBubbleController* weakSelf = self; | 713 __block WebsiteSettingsBubbleController* weakSelf = self; |
| 685 PermissionMenuModel::ChangeCallback callback = | 714 PermissionMenuModel::ChangeCallback callback = |
| 686 base::BindBlock(^(const WebsiteSettingsUI::PermissionInfo& permission) { | 715 base::BindBlock(^(const WebsiteSettingsUI::PermissionInfo& permission) { |
| 687 [weakSelf onPermissionChanged:permission.type to:permission.setting]; | 716 [weakSelf onPermissionChanged:permission.type to:permission.setting]; |
| 688 }); | 717 }); |
| 689 base::scoped_nsobject<PermissionSelectorButton> button( | 718 base::scoped_nsobject<PermissionSelectorButton> button( |
| 690 [[PermissionSelectorButton alloc] initWithPermissionInfo:permissionInfo | 719 [[PermissionSelectorButton alloc] initWithPermissionInfo:permissionInfo |
| 691 forURL:url | 720 forURL:url |
| 692 withCallback:callback]); | 721 withCallback:callback]); |
| 722 |
| 693 // Determine the largest possible size for this button. | 723 // Determine the largest possible size for this button. |
| 694 CGFloat maxTitleWidth = [button | 724 CGFloat maxTitleWidth = [button |
| 695 maxTitleWidthForContentSettingsType:permissionInfo.type | 725 maxTitleWidthForContentSettingsType:permissionInfo.type |
| 696 withDefaultSetting:permissionInfo.default_setting]; | 726 withDefaultSetting:permissionInfo.default_setting]; |
| 697 | 727 |
| 698 // Ensure the containing view is large enough to contain the button with its | 728 // Ensure the containing view is large enough to contain the button with its |
| 699 // widest possible title. | 729 // widest possible title. |
| 700 NSRect containerFrame = [view frame]; | 730 NSRect containerFrame = [view frame]; |
| 701 containerFrame.size.width = std::max( | 731 containerFrame.size.width = |
| 702 NSWidth(containerFrame), point.x + maxTitleWidth + kFramePadding); | 732 std::max(NSWidth(containerFrame), |
| 733 point.x + maxTitleWidth + kSectionHorizontalPadding); |
| 703 [view setFrame:containerFrame]; | 734 [view setFrame:containerFrame]; |
| 704 [view addSubview:button.get()]; | 735 [view addSubview:button.get()]; |
| 705 return button.get(); | 736 return button.get(); |
| 706 } | 737 } |
| 707 | 738 |
| 708 // Add a delete button for |objectInfo| to the given view. | 739 // Add a delete button for |objectInfo| to the given view. |
| 709 - (NSButton*)addDeleteButtonForChosenObject:(ChosenObjectInfoPtr)objectInfo | 740 - (NSButton*)addDeleteButtonForChosenObject:(ChosenObjectInfoPtr)objectInfo |
| 710 toView:(NSView*)view | 741 toView:(NSView*)view |
| 711 atPoint:(NSPoint)point { | 742 atPoint:(NSPoint)point { |
| 712 __block WebsiteSettingsBubbleController* weakSelf = self; | 743 __block WebsiteSettingsBubbleController* weakSelf = self; |
| 713 auto callback = | 744 auto callback = |
| 714 base::BindBlock(^(const WebsiteSettingsUI::ChosenObjectInfo& objectInfo) { | 745 base::BindBlock(^(const WebsiteSettingsUI::ChosenObjectInfo& objectInfo) { |
| 715 [weakSelf onChosenObjectDeleted:objectInfo]; | 746 [weakSelf onChosenObjectDeleted:objectInfo]; |
| 716 }); | 747 }); |
| 717 base::scoped_nsobject<ChosenObjectDeleteButton> button( | 748 base::scoped_nsobject<ChosenObjectDeleteButton> button( |
| 718 [[ChosenObjectDeleteButton alloc] | 749 [[ChosenObjectDeleteButton alloc] |
| 719 initWithChosenObject:std::move(objectInfo) | 750 initWithChosenObject:std::move(objectInfo) |
| 720 atPoint:point | 751 atPoint:point |
| 721 withCallback:callback]); | 752 withCallback:callback]); |
| 722 | 753 |
| 723 // Ensure the containing view is large enough to contain the button. | 754 // Ensure the containing view is large enough to contain the button. |
| 724 NSRect containerFrame = [view frame]; | 755 NSRect containerFrame = [view frame]; |
| 725 containerFrame.size.width = | 756 containerFrame.size.width = |
| 726 std::max(NSWidth(containerFrame), | 757 std::max(NSWidth(containerFrame), point.x + kPermissionDeleteImageSize + |
| 727 point.x + kPermissionDeleteImageSize + kFramePadding); | 758 kSectionHorizontalPadding); |
| 728 [view setFrame:containerFrame]; | 759 [view setFrame:containerFrame]; |
| 729 [view addSubview:button.get()]; | 760 [view addSubview:button.get()]; |
| 730 return button.get(); | 761 return button.get(); |
| 731 } | 762 } |
| 732 | 763 |
| 733 // Called when the user changes the setting of a permission. | 764 // Called when the user changes the setting of a permission. |
| 734 - (void)onPermissionChanged:(ContentSettingsType)permissionType | 765 - (void)onPermissionChanged:(ContentSettingsType)permissionType |
| 735 to:(ContentSetting)newSetting { | 766 to:(ContentSetting)newSetting { |
| 736 if (presenter_) | 767 if (presenter_) |
| 737 presenter_->OnSitePermissionChanged(permissionType, newSetting); | 768 presenter_->OnSitePermissionChanged(permissionType, newSetting); |
| 738 } | 769 } |
| 739 | 770 |
| 740 // Called when the user revokes permission for a previously chosen object. | 771 // Called when the user revokes permission for a previously chosen object. |
| 741 - (void)onChosenObjectDeleted:(const WebsiteSettingsUI::ChosenObjectInfo&)info { | 772 - (void)onChosenObjectDeleted:(const WebsiteSettingsUI::ChosenObjectInfo&)info { |
| 742 if (presenter_) | 773 if (presenter_) |
| 743 presenter_->OnSiteChosenObjectDeleted(info.ui_info, *info.object); | 774 presenter_->OnSiteChosenObjectDeleted(info.ui_info, *info.object); |
| 744 } | 775 } |
| 745 | 776 |
| 746 // Adds a new row to the UI listing the permissions. Returns the NSPoint of the | 777 // Adds a new row to the UI listing the permissions. Returns the NSPoint of the |
| 747 // last UI element added (either the permission button, in LTR, or the text | 778 // last UI element added (either the permission button, in LTR, or the text |
| 748 // label, in RTL). | 779 // label, in RTL). |
| 749 - (NSPoint)addPermission: | 780 - (NSPoint)addPermission: |
| 750 (const WebsiteSettingsUI::PermissionInfo&)permissionInfo | 781 (const WebsiteSettingsUI::PermissionInfo&)permissionInfo |
| 751 toView:(NSView*)view | 782 toView:(NSView*)view |
| 752 atPoint:(NSPoint)point { | 783 atPoint:(NSPoint)point { |
| 753 base::string16 labelText = | 784 base::string16 labelText = |
| 754 WebsiteSettingsUI::PermissionTypeToUIString(permissionInfo.type) + | 785 WebsiteSettingsUI::PermissionTypeToUIString(permissionInfo.type); |
| 755 base::ASCIIToUTF16(":"); | |
| 756 bool isRTL = | 786 bool isRTL = |
| 757 base::i18n::RIGHT_TO_LEFT == base::i18n::GetStringDirection(labelText); | 787 base::i18n::RIGHT_TO_LEFT == base::i18n::GetStringDirection(labelText); |
| 758 base::scoped_nsobject<NSImage> image( | 788 base::scoped_nsobject<NSImage> image( |
| 759 [WebsiteSettingsUI::GetPermissionIcon(permissionInfo).ToNSImage() | 789 [WebsiteSettingsUI::GetPermissionIcon(permissionInfo).ToNSImage() |
| 760 retain]); | 790 retain]); |
| 761 | 791 |
| 762 NSPoint position; | 792 NSPoint position; |
| 763 NSImageView* imageView; | 793 NSImageView* imageView; |
| 764 NSPopUpButton* button; | 794 NSPopUpButton* button; |
| 765 NSTextField* label; | 795 NSTextField* label; |
| 766 | 796 |
| 767 CGFloat viewWidth = NSWidth([view frame]); | 797 CGFloat viewWidth = NSWidth([view frame]); |
| 768 | 798 |
| 769 if (isRTL) { | 799 if (isRTL) { |
| 770 point.x = NSWidth([view frame]) - kPermissionImageSize - | 800 point.x = NSWidth([view frame]) - kPermissionImageSize - |
| 771 kPermissionImageSpacing - kFramePadding; | 801 kPermissionImageSpacing - kSectionHorizontalPadding; |
| 772 imageView = [self addImageWithSize:[image size] toView:view atPoint:point]; | 802 imageView = [self addImageWithSize:[image size] toView:view atPoint:point]; |
| 773 [imageView setImage:image]; | 803 [imageView setImage:image]; |
| 774 point.x -= kPermissionImageSpacing; | 804 point.x -= kPermissionImageSpacing; |
| 775 | 805 |
| 776 label = [self addText:labelText | 806 label = [self addText:labelText |
| 777 withSize:[NSFont smallSystemFontSize] | 807 withSize:[NSFont systemFontSize] |
| 778 bold:NO | 808 bold:NO |
| 779 toView:view | 809 toView:view |
| 780 atPoint:point]; | 810 atPoint:point]; |
| 781 [label sizeToFit]; | 811 [label sizeToFit]; |
| 782 point.x -= NSWidth([label frame]); | 812 point.x -= NSWidth([label frame]); |
| 783 [label setFrameOrigin:point]; | 813 [label setFrameOrigin:point]; |
| 784 | 814 |
| 785 position = NSMakePoint(point.x, point.y); | 815 position = |
| 816 NSMakePoint(point.x, point.y + kPermissionPopupButtonYAdjustment); |
| 786 button = [self addPopUpButtonForPermission:permissionInfo | 817 button = [self addPopUpButtonForPermission:permissionInfo |
| 787 toView:view | 818 toView:view |
| 788 atPoint:position]; | 819 atPoint:position]; |
| 789 position.x -= NSWidth([button frame]); | 820 position.x -= NSWidth([button frame]); |
| 790 [button setFrameOrigin:position]; | 821 [button setFrameOrigin:position]; |
| 791 } else { | 822 } else { |
| 792 imageView = [self addImageWithSize:[image size] toView:view atPoint:point]; | 823 imageView = [self addImageWithSize:[image size] toView:view atPoint:point]; |
| 793 [imageView setImage:image]; | 824 [imageView setImage:image]; |
| 794 point.x += kPermissionImageSize + kPermissionImageSpacing; | 825 point.x += kPermissionImageSize + kPermissionImageSpacing; |
| 795 | 826 |
| 796 label = [self addText:labelText | 827 label = [self addText:labelText |
| 797 withSize:[NSFont smallSystemFontSize] | 828 withSize:[NSFont systemFontSize] |
| 798 bold:NO | 829 bold:NO |
| 799 toView:view | 830 toView:view |
| 800 atPoint:point]; | 831 atPoint:point]; |
| 801 [label sizeToFit]; | 832 [label sizeToFit]; |
| 802 | 833 |
| 803 position = NSMakePoint(NSMaxX([label frame]), point.y); | 834 position = NSMakePoint(NSMaxX([label frame]), |
| 835 point.y + kPermissionPopupButtonYAdjustment); |
| 836 |
| 804 button = [self addPopUpButtonForPermission:permissionInfo | 837 button = [self addPopUpButtonForPermission:permissionInfo |
| 805 toView:view | 838 toView:view |
| 806 atPoint:position]; | 839 atPoint:position]; |
| 807 } | 840 } |
| 808 | 841 |
| 809 [view setFrameSize:NSMakeSize(viewWidth, NSHeight([view frame]))]; | 842 [view setFrameSize:NSMakeSize(viewWidth, NSHeight([view frame]))]; |
| 810 | 843 |
| 811 // Adjust the vertical position of the button so that its title text is | 844 // Adjust the vertical position of the button so that its title text is |
| 812 // aligned with the label. Assumes that the text is the same size in both. | 845 // aligned with the label. Assumes that the text is the same size in both. |
| 813 // Also adjust the horizontal position to remove excess space due to the | 846 // Also adjust the horizontal position to remove excess space due to the |
| 814 // invisible bezel. | 847 // invisible bezel. |
| 815 NSRect titleRect = [[button cell] titleRectForBounds:[button bounds]]; | 848 NSRect titleRect = [[button cell] titleRectForBounds:[button bounds]]; |
| 816 if (isRTL) { | 849 if (isRTL) { |
| 817 position.x += kPermissionPopUpXSpacing; | 850 position.x = kSectionHorizontalPadding; |
| 818 } else { | 851 } else { |
| 819 position.x -= titleRect.origin.x - kPermissionPopUpXSpacing; | 852 position.x = kDefaultWindowWidth - kSectionHorizontalPadding - |
| 853 [button frame].size.width; |
| 820 } | 854 } |
| 821 position.y -= titleRect.origin.y; | 855 position.y -= titleRect.origin.y; |
| 822 [button setFrameOrigin:position]; | 856 [button setFrameOrigin:position]; |
| 823 | 857 |
| 824 // Align the icon with the text. | 858 // Align the icon with the text. |
| 825 [self alignPermissionIcon:imageView withTextField:label]; | 859 [self alignPermissionIcon:imageView withTextField:label]; |
| 826 | 860 |
| 827 // Permissions specified by policy or an extension cannot be changed. | 861 // Permissions specified by policy or an extension cannot be changed. |
| 828 if (permissionInfo.source == content_settings::SETTING_SOURCE_EXTENSION || | 862 if (permissionInfo.source == content_settings::SETTING_SOURCE_EXTENSION || |
| 829 permissionInfo.source == content_settings::SETTING_SOURCE_POLICY) { | 863 permissionInfo.source == content_settings::SETTING_SOURCE_POLICY) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 851 | 885 |
| 852 NSPoint position; | 886 NSPoint position; |
| 853 NSImageView* imageView; | 887 NSImageView* imageView; |
| 854 NSButton* button; | 888 NSButton* button; |
| 855 NSTextField* label; | 889 NSTextField* label; |
| 856 | 890 |
| 857 CGFloat viewWidth = NSWidth([view frame]); | 891 CGFloat viewWidth = NSWidth([view frame]); |
| 858 | 892 |
| 859 if (isRTL) { | 893 if (isRTL) { |
| 860 point.x = NSWidth([view frame]) - kPermissionImageSize - | 894 point.x = NSWidth([view frame]) - kPermissionImageSize - |
| 861 kPermissionImageSpacing - kFramePadding; | 895 kPermissionImageSpacing - kSectionHorizontalPadding; |
| 862 imageView = [self addImageWithSize:[image size] toView:view atPoint:point]; | 896 imageView = [self addImageWithSize:[image size] toView:view atPoint:point]; |
| 863 [imageView setImage:image]; | 897 [imageView setImage:image]; |
| 864 point.x -= kPermissionImageSpacing; | 898 point.x -= kPermissionImageSpacing; |
| 865 | 899 |
| 866 label = [self addText:labelText | 900 label = [self addText:labelText |
| 867 withSize:[NSFont smallSystemFontSize] | 901 withSize:[NSFont smallSystemFontSize] |
| 868 bold:NO | 902 bold:NO |
| 869 toView:view | 903 toView:view |
| 870 atPoint:point]; | 904 atPoint:point]; |
| 871 [label sizeToFit]; | 905 [label sizeToFit]; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 897 } | 931 } |
| 898 | 932 |
| 899 [view setFrameSize:NSMakeSize(viewWidth, NSHeight([view frame]))]; | 933 [view setFrameSize:NSMakeSize(viewWidth, NSHeight([view frame]))]; |
| 900 | 934 |
| 901 // Adjust the vertical position of the button so that its title text is | 935 // Adjust the vertical position of the button so that its title text is |
| 902 // aligned with the label. Assumes that the text is the same size in both. | 936 // aligned with the label. Assumes that the text is the same size in both. |
| 903 // Also adjust the horizontal position to remove excess space due to the | 937 // Also adjust the horizontal position to remove excess space due to the |
| 904 // invisible bezel. | 938 // invisible bezel. |
| 905 NSRect titleRect = [[button cell] titleRectForBounds:[button bounds]]; | 939 NSRect titleRect = [[button cell] titleRectForBounds:[button bounds]]; |
| 906 if (isRTL) { | 940 if (isRTL) { |
| 907 position.x += kPermissionPopUpXSpacing; | 941 // position.x += BYEkPermissionPopUpXSpacing; // TODO |
| 908 } else { | |
| 909 position.x -= titleRect.origin.x - kPermissionPopUpXSpacing; | |
| 910 } | 942 } |
| 911 position.y -= titleRect.origin.y; | 943 position.y -= titleRect.origin.y; |
| 912 [button setFrameOrigin:position]; | 944 [button setFrameOrigin:position]; |
| 913 | 945 |
| 914 // Align the icon with the text. | 946 // Align the icon with the text. |
| 915 [self alignPermissionIcon:imageView withTextField:label]; | 947 [self alignPermissionIcon:imageView withTextField:label]; |
| 916 | 948 |
| 917 NSRect buttonFrame = [button frame]; | 949 NSRect buttonFrame = [button frame]; |
| 918 return NSMakePoint(NSMaxX(buttonFrame), NSMaxY(buttonFrame)); | 950 return NSMakePoint(NSMaxX(buttonFrame), NSMaxY(buttonFrame)); |
| 919 } | 951 } |
| 920 | 952 |
| 921 // Align an image with a text field by vertically centering the image on | 953 // Align an image with a text field by vertically centering the image on |
| 922 // the cap height of the first line of text. | 954 // the cap height of the first line of text. |
| 923 - (void)alignPermissionIcon:(NSImageView*)imageView | 955 - (void)alignPermissionIcon:(NSImageView*)imageView |
| 924 withTextField:(NSTextField*)textField { | 956 withTextField:(NSTextField*)textField { |
| 925 NSFont* font = [textField font]; | 957 NSFont* font = [textField font]; |
| 926 | 958 |
| 927 // Calculate the offset from the top of the text field. | 959 // Calculate the offset from the top of the text field. |
| 928 CGFloat capHeight = [font capHeight]; | 960 CGFloat capHeight = [font capHeight]; |
| 929 CGFloat offset = (kPermissionImageSize - capHeight) / 2 - | 961 CGFloat offset = |
| 930 ([font ascender] - capHeight) - kPermissionImageYAdjust; | 962 (kPermissionImageSize - capHeight) / 2 - ([font ascender] - capHeight); |
| 931 | 963 |
| 932 NSRect frame = [imageView frame]; | 964 NSRect frame = [imageView frame]; |
| 933 frame.origin.y -= offset; | 965 frame.origin.y -= offset; |
| 934 [imageView setFrame:frame]; | 966 [imageView setFrame:frame]; |
| 935 } | 967 } |
| 936 | 968 |
| 937 - (void)setCookieInfo:(const CookieInfoList&)cookieInfoList { | 969 - (void)setCookieInfo:(const CookieInfoList&)cookieInfoList { |
| 938 // A result of re-ordering of the permissions (crbug.com/444244) is | 970 // A result of re-ordering of the permissions (crbug.com/444244) is |
| 939 // that sometimes permissions may not be displayed at all, so it's | 971 // that sometimes permissions may not be displayed at all, so it's |
| 940 // incorrect to check they are set before the cookie info. | 972 // incorrect to check they are set before the cookie info. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 953 IDS_WEBSITE_SETTINGS_THIRD_PARTY_SITE_DATA, i.allowed); | 985 IDS_WEBSITE_SETTINGS_THIRD_PARTY_SITE_DATA, i.allowed); |
| 954 } | 986 } |
| 955 } | 987 } |
| 956 | 988 |
| 957 base::string16 sectionTitle = | 989 base::string16 sectionTitle = |
| 958 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA); | 990 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA); |
| 959 bool isRTL = base::i18n::RIGHT_TO_LEFT == | 991 bool isRTL = base::i18n::RIGHT_TO_LEFT == |
| 960 base::i18n::GetStringDirection(firstPartyLabelText); | 992 base::i18n::GetStringDirection(firstPartyLabelText); |
| 961 | 993 |
| 962 [cookiesView_ setSubviews:[NSArray array]]; | 994 [cookiesView_ setSubviews:[NSArray array]]; |
| 963 NSPoint controlOrigin = NSMakePoint(kFramePadding, 0); | 995 NSPoint controlOrigin = NSMakePoint(kSectionHorizontalPadding, 0); |
| 964 | 996 |
| 965 NSTextField* label; | 997 NSTextField* label; |
| 966 | 998 |
| 967 CGFloat viewWidth = NSWidth([cookiesView_ frame]); | 999 CGFloat viewWidth = NSWidth([cookiesView_ frame]); |
| 968 | 1000 |
| 969 NSTextField* header = [self addText:sectionTitle | |
| 970 withSize:[NSFont smallSystemFontSize] | |
| 971 bold:YES | |
| 972 toView:cookiesView_ | |
| 973 atPoint:controlOrigin]; | |
| 974 [header sizeToFit]; | |
| 975 | |
| 976 if (isRTL) { | |
| 977 controlOrigin.x = viewWidth - kFramePadding - NSWidth([header frame]); | |
| 978 [header setFrameOrigin:controlOrigin]; | |
| 979 } | |
| 980 controlOrigin.y += NSHeight([header frame]) + kPermissionsHeadlineSpacing; | |
| 981 controlOrigin.y += kPermissionsTabSpacing; | |
| 982 | |
| 983 // Reset X for the cookie image. | 1001 // Reset X for the cookie image. |
| 984 if (isRTL) { | 1002 if (isRTL) { |
| 985 controlOrigin.x = viewWidth - kPermissionImageSize - | 1003 controlOrigin.x = viewWidth - kPermissionImageSize - |
| 986 kPermissionImageSpacing - kFramePadding; | 1004 kPermissionImageSpacing - kSectionHorizontalPadding; |
| 987 } | 1005 } |
| 988 | 1006 |
| 989 WebsiteSettingsUI::PermissionInfo info; | 1007 WebsiteSettingsUI::PermissionInfo info; |
| 990 info.type = CONTENT_SETTINGS_TYPE_COOKIES; | 1008 info.type = CONTENT_SETTINGS_TYPE_COOKIES; |
| 991 info.setting = CONTENT_SETTING_ALLOW; | 1009 info.setting = CONTENT_SETTING_ALLOW; |
| 992 // info.default_setting, info.source, and info.is_incognito have not been set, | 1010 // info.default_setting, info.source, and info.is_incognito have not been set, |
| 993 // but GetPermissionIcon doesn't use any of those. | 1011 // but GetPermissionIcon doesn't use any of those. |
| 994 NSImage* image = WebsiteSettingsUI::GetPermissionIcon(info).ToNSImage(); | 1012 NSImage* image = WebsiteSettingsUI::GetPermissionIcon(info).ToNSImage(); |
| 995 NSImageView* imageView = [self addImageWithSize:[image size] | 1013 NSImageView* imageView = [self addImageWithSize:[image size] |
| 996 toView:cookiesView_ | 1014 toView:cookiesView_ |
| 997 atPoint:controlOrigin]; | 1015 atPoint:controlOrigin]; |
| 998 [imageView setImage:image]; | 1016 [imageView setImage:image]; |
| 999 | 1017 |
| 1000 base::string16 comma = base::ASCIIToUTF16(", "); | 1018 base::string16 comma = base::ASCIIToUTF16(", "); |
| 1001 NSString* cookieButtonText = base::SysUTF16ToNSString(firstPartyLabelText); | 1019 NSString* cookieButtonText = base::SysUTF16ToNSString(firstPartyLabelText); |
| 1002 | 1020 |
| 1021 NSButton* cookiesButton = |
| 1022 [self addLinkButtonWithText:cookieButtonText toView:cookiesView_]; |
| 1023 [cookiesButton setTarget:self]; |
| 1024 [cookiesButton setAction:@selector(showCookiesAndSiteData:)]; |
| 1025 |
| 1003 if (isRTL) { | 1026 if (isRTL) { |
| 1004 NSButton* cookiesButton = | 1027 controlOrigin.x -= kPermissionImageSpacing; |
| 1005 [self addLinkButtonWithText:cookieButtonText toView:cookiesView_]; | 1028 NSTextField* cookiesLabel = |
| 1006 [cookiesButton setTarget:self]; | 1029 [self addText:l10n_util::GetStringUTF16(IDS_PAGE_INFO_COOKIES) |
| 1007 [cookiesButton setAction:@selector(showCookiesAndSiteData:)]; | 1030 withSize:[NSFont systemFontSize] |
| 1031 bold:NO |
| 1032 toView:cookiesView_ |
| 1033 atPoint:controlOrigin]; |
| 1034 [cookiesLabel sizeToFit]; |
| 1035 |
| 1036 NSPoint cookiesLabelOrigin = [cookiesLabel frame].origin; |
| 1037 cookiesLabelOrigin.x -= NSWidth([cookiesLabel frame]); |
| 1038 [cookiesLabel setFrameOrigin:cookiesLabelOrigin]; |
| 1039 |
| 1040 // Align the icon with the text. |
| 1041 [self alignPermissionIcon:imageView withTextField:cookiesLabel]; |
| 1042 |
| 1043 controlOrigin.y += NSHeight([cookiesLabel frame]); |
| 1008 controlOrigin.x -= NSWidth([cookiesButton frame]); | 1044 controlOrigin.x -= NSWidth([cookiesButton frame]); |
| 1009 [cookiesButton setFrameOrigin:controlOrigin]; | 1045 [cookiesButton setFrameOrigin:controlOrigin]; |
| 1010 | 1046 |
| 1011 label = [self addText:comma + thirdPartyLabelText | 1047 label = [self addText:comma + thirdPartyLabelText |
| 1012 withSize:[NSFont smallSystemFontSize] | 1048 withSize:[NSFont smallSystemFontSize] |
| 1013 bold:NO | 1049 bold:NO |
| 1014 toView:cookiesView_ | 1050 toView:cookiesView_ |
| 1015 atPoint:controlOrigin]; | 1051 atPoint:controlOrigin]; |
| 1016 [label sizeToFit]; | 1052 [label sizeToFit]; |
| 1017 controlOrigin.x -= NSWidth([label frame]) - kTextLabelXPadding; | 1053 controlOrigin.x -= NSWidth([label frame]) - kCookieCountXAdjustment; |
| 1018 [label setFrameOrigin:controlOrigin]; | 1054 [label setFrameOrigin:controlOrigin]; |
| 1019 } else { | 1055 } else { |
| 1020 controlOrigin.x += kPermissionImageSize + kPermissionImageSpacing; | 1056 controlOrigin.x += kPermissionImageSize + kPermissionImageSpacing; |
| 1057 NSTextField* cookiesLabel = |
| 1058 [self addText:l10n_util::GetStringUTF16(IDS_PAGE_INFO_COOKIES) |
| 1059 withSize:[NSFont systemFontSize] |
| 1060 bold:NO |
| 1061 toView:cookiesView_ |
| 1062 atPoint:controlOrigin]; |
| 1021 | 1063 |
| 1022 NSButton* cookiesButton = | 1064 controlOrigin.y += NSHeight([cookiesLabel frame]); |
| 1023 [self addLinkButtonWithText:cookieButtonText toView:cookiesView_]; | |
| 1024 [cookiesButton setTarget:self]; | |
| 1025 [cookiesButton setAction:@selector(showCookiesAndSiteData:)]; | |
| 1026 [cookiesButton setFrameOrigin:controlOrigin]; | 1065 [cookiesButton setFrameOrigin:controlOrigin]; |
| 1027 | 1066 |
| 1028 controlOrigin.x += NSWidth([cookiesButton frame]) - kTextLabelXPadding; | 1067 // Align the icon with the text. |
| 1068 [self alignPermissionIcon:imageView withTextField:cookiesLabel]; |
| 1069 |
| 1070 controlOrigin.x += NSWidth([cookiesButton frame]) - kCookieCountXAdjustment; |
| 1029 | 1071 |
| 1030 label = [self addText:comma + thirdPartyLabelText | 1072 label = [self addText:comma + thirdPartyLabelText |
| 1031 withSize:[NSFont smallSystemFontSize] | 1073 withSize:[NSFont smallSystemFontSize] |
| 1032 bold:NO | 1074 bold:NO |
| 1033 toView:cookiesView_ | 1075 toView:cookiesView_ |
| 1034 atPoint:controlOrigin]; | 1076 atPoint:controlOrigin]; |
| 1035 [label sizeToFit]; | 1077 [label sizeToFit]; |
| 1036 } | 1078 } |
| 1037 | 1079 |
| 1038 // Align the icon with the text. | 1080 controlOrigin.y += NSHeight([label frame]); |
| 1039 [self alignPermissionIcon:imageView withTextField:label]; | |
| 1040 | 1081 |
| 1041 controlOrigin.y += NSHeight([label frame]) + kPermissionsTabSpacing; | 1082 [cookiesView_ |
| 1042 | 1083 setFrameSize:NSMakeSize(NSWidth([cookiesView_ frame]), controlOrigin.y)]; |
| 1043 [cookiesView_ setFrameSize: | |
| 1044 NSMakeSize(NSWidth([cookiesView_ frame]), controlOrigin.y)]; | |
| 1045 | 1084 |
| 1046 [self performLayout]; | 1085 [self performLayout]; |
| 1047 } | 1086 } |
| 1048 | 1087 |
| 1049 - (void)setPermissionInfo:(const PermissionInfoList&)permissionInfoList | 1088 - (void)setPermissionInfo:(const PermissionInfoList&)permissionInfoList |
| 1050 andChosenObjects:(const ChosenObjectInfoList&)chosenObjectInfoList { | 1089 andChosenObjects:(const ChosenObjectInfoList&)chosenObjectInfoList { |
| 1051 [permissionsView_ setSubviews:[NSArray array]]; | 1090 [permissionsView_ setSubviews:[NSArray array]]; |
| 1052 NSPoint controlOrigin = NSMakePoint(kFramePadding, 0); | 1091 NSPoint controlOrigin = NSMakePoint(kSectionHorizontalPadding, 0); |
| 1053 | 1092 |
| 1054 permissionsPresent_ = YES; | 1093 permissionsPresent_ = YES; |
| 1055 | 1094 |
| 1056 if (permissionInfoList.size() > 0 || chosenObjectInfoList.size() > 0) { | 1095 if (permissionInfoList.size() > 0 || chosenObjectInfoList.size() > 0) { |
| 1057 base::string16 sectionTitle = l10n_util::GetStringUTF16( | 1096 base::string16 sectionTitle = l10n_util::GetStringUTF16( |
| 1058 IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS); | 1097 IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS); |
| 1059 bool isRTL = base::i18n::RIGHT_TO_LEFT == | |
| 1060 base::i18n::GetStringDirection(sectionTitle); | |
| 1061 NSTextField* header = [self addText:sectionTitle | |
| 1062 withSize:[NSFont smallSystemFontSize] | |
| 1063 bold:YES | |
| 1064 toView:permissionsView_ | |
| 1065 atPoint:controlOrigin]; | |
| 1066 [header sizeToFit]; | |
| 1067 if (isRTL) { | |
| 1068 controlOrigin.x = NSWidth([permissionsView_ frame]) - kFramePadding - | |
| 1069 NSWidth([header frame]); | |
| 1070 [header setFrameOrigin:controlOrigin]; | |
| 1071 } | |
| 1072 controlOrigin.y += NSHeight([header frame]) + kPermissionsHeadlineSpacing; | |
| 1073 | 1098 |
| 1074 for (const auto& permission : permissionInfoList) { | 1099 for (const auto& permission : permissionInfoList) { |
| 1075 controlOrigin.y += kPermissionsTabSpacing; | 1100 controlOrigin.y += kPermissionsVerticalSpacing; |
| 1076 NSPoint rowBottomRight = [self addPermission:permission | 1101 NSPoint rowBottomRight = [self addPermission:permission |
| 1077 toView:permissionsView_ | 1102 toView:permissionsView_ |
| 1078 atPoint:controlOrigin]; | 1103 atPoint:controlOrigin]; |
| 1079 controlOrigin.y = rowBottomRight.y; | 1104 controlOrigin.y = rowBottomRight.y; |
| 1080 } | 1105 } |
| 1081 | 1106 |
| 1082 for (auto object : chosenObjectInfoList) { | 1107 for (auto object : chosenObjectInfoList) { |
| 1083 controlOrigin.y += kPermissionsTabSpacing; | 1108 controlOrigin.y += kPermissionsVerticalSpacing; |
| 1084 NSPoint rowBottomRight = [self addChosenObject:base::WrapUnique(object) | 1109 NSPoint rowBottomRight = [self addChosenObject:base::WrapUnique(object) |
| 1085 toView:permissionsView_ | 1110 toView:permissionsView_ |
| 1086 atPoint:controlOrigin]; | 1111 atPoint:controlOrigin]; |
| 1087 controlOrigin.y = rowBottomRight.y; | 1112 controlOrigin.y = rowBottomRight.y; |
| 1088 } | 1113 } |
| 1089 | 1114 |
| 1090 controlOrigin.y += kFramePadding; | 1115 controlOrigin.y += kSectionHorizontalPadding; |
| 1091 } | 1116 } |
| 1092 | 1117 |
| 1093 [permissionsView_ setFrameSize: | 1118 [permissionsView_ setFrameSize: |
| 1094 NSMakeSize(NSWidth([permissionsView_ frame]), controlOrigin.y)]; | 1119 NSMakeSize(NSWidth([permissionsView_ frame]), controlOrigin.y)]; |
| 1095 [self performLayout]; | 1120 [self performLayout]; |
| 1096 } | 1121 } |
| 1097 | 1122 |
| 1098 @end | 1123 @end |
| 1099 | 1124 |
| 1100 WebsiteSettingsUIBridge::WebsiteSettingsUIBridge( | 1125 WebsiteSettingsUIBridge::WebsiteSettingsUIBridge( |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 void WebsiteSettingsUIBridge::SetPermissionInfo( | 1215 void WebsiteSettingsUIBridge::SetPermissionInfo( |
| 1191 const PermissionInfoList& permission_info_list, | 1216 const PermissionInfoList& permission_info_list, |
| 1192 const ChosenObjectInfoList& chosen_object_info_list) { | 1217 const ChosenObjectInfoList& chosen_object_info_list) { |
| 1193 [bubble_controller_ setPermissionInfo:permission_info_list | 1218 [bubble_controller_ setPermissionInfo:permission_info_list |
| 1194 andChosenObjects:chosen_object_info_list]; | 1219 andChosenObjects:chosen_object_info_list]; |
| 1195 } | 1220 } |
| 1196 | 1221 |
| 1197 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | 1222 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { |
| 1198 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) | 1223 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) |
| 1199 } | 1224 } |
| OLD | NEW |