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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 securityDetailsField_ = [self addText:base::string16() | 339 securityDetailsField_ = [self addText:base::string16() |
340 withSize:[NSFont smallSystemFontSize] | 340 withSize:[NSFont smallSystemFontSize] |
341 bold:NO | 341 bold:NO |
342 toView:securitySectionView | 342 toView:securitySectionView |
343 atPoint:controlOrigin]; | 343 atPoint:controlOrigin]; |
344 | 344 |
345 // These will be created only if necessary. | 345 // These will be created only if necessary. |
346 resetDecisionsField_ = nil; | 346 resetDecisionsField_ = nil; |
347 resetDecisionsButton_ = nil; | 347 resetDecisionsButton_ = nil; |
348 | 348 |
349 NSString* connectionHelpButtonText = | 349 NSString* connectionHelpButtonText = l10n_util::GetNSString(IDS_LEARN_MORE); |
350 l10n_util::GetNSString(IDS_LEARN_MORE); | |
351 connectionHelpButton_ = [self addLinkButtonWithText:connectionHelpButtonText | 350 connectionHelpButton_ = [self addLinkButtonWithText:connectionHelpButtonText |
352 toView:securitySectionView]; | 351 toView:securitySectionView]; |
353 [connectionHelpButton_ setTarget:self]; | 352 [connectionHelpButton_ setTarget:self]; |
354 [connectionHelpButton_ setAction:@selector(openConnectionHelp:)]; | 353 [connectionHelpButton_ setAction:@selector(openConnectionHelp:)]; |
355 | 354 |
355 if (base::i18n::IsRTL()) { | |
356 securitySummaryField_.alignment = NSRightTextAlignment; | |
357 securityDetailsField_.alignment = NSRightTextAlignment; | |
lgrey
2017/02/24 22:11:56
Would an unconditional NSNaturalTextAlignment work
Avi (use Gerrit)
2017/02/27 16:51:42
No; when I try it out it keeps left aligning the t
| |
358 } | |
359 | |
356 return securitySectionView.get(); | 360 return securitySectionView.get(); |
357 } | 361 } |
358 | 362 |
359 // Create and return a subview for the site settings and add it to the given | 363 // Create and return a subview for the site settings and add it to the given |
360 // |superview|. |superview| retains the new view. | 364 // |superview|. |superview| retains the new view. |
361 - (NSView*)addSiteSettingsSectionToView:(NSView*)superview { | 365 - (NSView*)addSiteSettingsSectionToView:(NSView*)superview { |
362 base::scoped_nsobject<NSView> siteSettingsSectionView( | 366 base::scoped_nsobject<NSView> siteSettingsSectionView( |
363 [[FlippedView alloc] initWithFrame:[superview frame]]); | 367 [[FlippedView alloc] initWithFrame:[superview frame]]); |
364 [superview addSubview:siteSettingsSectionView]; | 368 [superview addSubview:siteSettingsSectionView]; |
365 | 369 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
500 CGFloat yPos = 0; | 504 CGFloat yPos = 0; |
501 | 505 |
502 [self sizeTextFieldHeightToFit:securitySummaryField_]; | 506 [self sizeTextFieldHeightToFit:securitySummaryField_]; |
503 yPos = [self setYPositionOfView:securitySummaryField_ | 507 yPos = [self setYPositionOfView:securitySummaryField_ |
504 to:yPos + kSectionVerticalPadding]; | 508 to:yPos + kSectionVerticalPadding]; |
505 | 509 |
506 [self sizeTextFieldHeightToFit:securityDetailsField_]; | 510 [self sizeTextFieldHeightToFit:securityDetailsField_]; |
507 yPos = [self setYPositionOfView:securityDetailsField_ | 511 yPos = [self setYPositionOfView:securityDetailsField_ |
508 to:yPos + kSecurityParagraphSpacing]; | 512 to:yPos + kSecurityParagraphSpacing]; |
509 | 513 |
510 [connectionHelpButton_ | 514 NSPoint helpOrigin = |
511 setFrameOrigin:NSMakePoint( | 515 NSMakePoint(kSectionHorizontalPadding - kLinkButtonXAdjustment, yPos); |
512 kSectionHorizontalPadding - kLinkButtonXAdjustment, | 516 if (base::i18n::IsRTL()) { |
513 yPos)]; | 517 helpOrigin.x = NSWidth([contentView_ frame]) - helpOrigin.x - |
518 NSWidth(connectionHelpButton_.frame); | |
519 } | |
520 [connectionHelpButton_ setFrameOrigin:helpOrigin]; | |
514 yPos = NSMaxY([connectionHelpButton_ frame]); | 521 yPos = NSMaxY([connectionHelpButton_ frame]); |
515 | 522 |
516 if (resetDecisionsButton_) { | 523 if (resetDecisionsButton_) { |
517 DCHECK(resetDecisionsField_); | 524 DCHECK(resetDecisionsField_); |
518 yPos = [self setYPositionOfView:resetDecisionsField_ | 525 yPos = [self setYPositionOfView:resetDecisionsField_ |
519 to:yPos + kSecurityParagraphSpacing]; | 526 to:yPos + kSecurityParagraphSpacing]; |
520 [resetDecisionsButton_ | 527 [resetDecisionsButton_ |
521 setFrameOrigin:NSMakePoint(NSMinX([resetDecisionsButton_ frame]) - | 528 setFrameOrigin:NSMakePoint(NSMinX([resetDecisionsButton_ frame]) - |
522 kLinkButtonXAdjustment, | 529 kLinkButtonXAdjustment, |
523 yPos)]; | 530 yPos)]; |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1209 const CookieInfoList& cookie_info_list) { | 1216 const CookieInfoList& cookie_info_list) { |
1210 [bubble_controller_ setCookieInfo:cookie_info_list]; | 1217 [bubble_controller_ setCookieInfo:cookie_info_list]; |
1211 } | 1218 } |
1212 | 1219 |
1213 void WebsiteSettingsUIBridge::SetPermissionInfo( | 1220 void WebsiteSettingsUIBridge::SetPermissionInfo( |
1214 const PermissionInfoList& permission_info_list, | 1221 const PermissionInfoList& permission_info_list, |
1215 ChosenObjectInfoList chosen_object_info_list) { | 1222 ChosenObjectInfoList chosen_object_info_list) { |
1216 [bubble_controller_ setPermissionInfo:permission_info_list | 1223 [bubble_controller_ setPermissionInfo:permission_info_list |
1217 andChosenObjects:std::move(chosen_object_info_list)]; | 1224 andChosenObjects:std::move(chosen_object_info_list)]; |
1218 } | 1225 } |
OLD | NEW |