| 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 "ios/chrome/browser/ui/omnibox/page_info_view_controller.h" | 5 #import "ios/chrome/browser/ui/omnibox/page_info_view_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| 11 #include "base/mac/objc_property_releaser.h" | |
| 12 #include "base/mac/scoped_nsobject.h" | |
| 13 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 14 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "components/strings/grit/components_strings.h" | 15 #include "components/strings/grit/components_strings.h" |
| 18 #import "ios/chrome/browser/ui/animation_util.h" | 16 #import "ios/chrome/browser/ui/animation_util.h" |
| 19 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 17 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 20 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 18 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 21 #import "ios/chrome/browser/ui/fancy_ui/bidi_container_view.h" | 19 #import "ios/chrome/browser/ui/fancy_ui/bidi_container_view.h" |
| 22 #include "ios/chrome/browser/ui/omnibox/page_info_model.h" | 20 #include "ios/chrome/browser/ui/omnibox/page_info_model.h" |
| 23 #import "ios/chrome/browser/ui/popup_menu/popup_menu_view.h" | 21 #import "ios/chrome/browser/ui/popup_menu/popup_menu_view.h" |
| 24 #include "ios/chrome/browser/ui/rtl_geometry.h" | 22 #include "ios/chrome/browser/ui/rtl_geometry.h" |
| 25 #include "ios/chrome/browser/ui/ui_util.h" | 23 #include "ios/chrome/browser/ui/ui_util.h" |
| 26 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 24 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 27 #import "ios/chrome/common/material_timing.h" | 25 #import "ios/chrome/common/material_timing.h" |
| 28 #include "ios/chrome/grit/ios_strings.h" | 26 #include "ios/chrome/grit/ios_strings.h" |
| 29 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 27 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 30 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 28 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 32 #include "ui/base/l10n/l10n_util_mac.h" | 30 #include "ui/base/l10n/l10n_util_mac.h" |
| 33 #import "ui/gfx/ios/NSString+CrStringDrawing.h" | 31 #import "ui/gfx/ios/NSString+CrStringDrawing.h" |
| 34 #import "ui/gfx/ios/uikit_util.h" | 32 #import "ui/gfx/ios/uikit_util.h" |
| 35 | 33 |
| 34 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 35 #error "This file requires ARC support." |
| 36 #endif |
| 37 |
| 36 using ios::material::TimingFunction; | 38 using ios::material::TimingFunction; |
| 37 | 39 |
| 38 namespace { | 40 namespace { |
| 39 | 41 |
| 40 // The width of the view. | 42 // The width of the view. |
| 41 const CGFloat kViewWidthRegular = 600.0; | 43 const CGFloat kViewWidthRegular = 600.0; |
| 42 const CGFloat kViewWidthCompact = 288.0; | 44 const CGFloat kViewWidthCompact = 288.0; |
| 43 const CGFloat kViewWidthiPhoneLandscape = 400.0; | 45 const CGFloat kViewWidthiPhoneLandscape = 400.0; |
| 44 // Spacing in between sections. | 46 // Spacing in between sections. |
| 45 const CGFloat kVerticalSpacing = 20.0; | 47 const CGFloat kVerticalSpacing = 20.0; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // can be delivered. | 124 // can be delivered. |
| 123 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 125 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 124 FROM_HERE, base::Bind(&PageInfoModelBubbleBridge::PerformLayout, | 126 FROM_HERE, base::Bind(&PageInfoModelBubbleBridge::PerformLayout, |
| 125 weak_ptr_factory_.GetWeakPtr()), | 127 weak_ptr_factory_.GetWeakPtr()), |
| 126 base::TimeDelta::FromMilliseconds(1000 /* milliseconds */)); | 128 base::TimeDelta::FromMilliseconds(1000 /* milliseconds */)); |
| 127 } | 129 } |
| 128 | 130 |
| 129 @interface PageInfoViewController ()<UIGestureRecognizerDelegate> { | 131 @interface PageInfoViewController ()<UIGestureRecognizerDelegate> { |
| 130 // Scroll View inside the PageInfoView used to display content that exceeds | 132 // Scroll View inside the PageInfoView used to display content that exceeds |
| 131 // the available space. | 133 // the available space. |
| 132 base::scoped_nsobject<UIScrollView> scrollView_; | 134 UIScrollView* scrollView_; |
| 133 // Container View added inside the Scroll View. All content is added to this | 135 // Container View added inside the Scroll View. All content is added to this |
| 134 // view instead of PopupMenuController.containerView_. | 136 // view instead of PopupMenuController.containerView_. |
| 135 base::scoped_nsobject<BidiContainerView> innerContainerView_; | 137 BidiContainerView* innerContainerView_; |
| 136 | 138 |
| 137 // Origin of the arrow at the top of the popup window. | 139 // Origin of the arrow at the top of the popup window. |
| 138 CGPoint origin_; | 140 CGPoint origin_; |
| 139 | 141 |
| 140 // Model for the data to display. | 142 // Model for the data to display. |
| 141 std::unique_ptr<PageInfoModel> model_; | 143 std::unique_ptr<PageInfoModel> model_; |
| 142 | 144 |
| 143 // Thin bridge that pushes model-changed notifications from C++ to Cocoa. | 145 // Thin bridge that pushes model-changed notifications from C++ to Cocoa. |
| 144 std::unique_ptr<PageInfoModelObserver> bridge_; | 146 std::unique_ptr<PageInfoModelObserver> bridge_; |
| 145 | 147 |
| 146 // Width of the view. Depends on the device (iPad/iPhone). | 148 // Width of the view. Depends on the device (iPad/iPhone). |
| 147 CGFloat viewWidth_; | 149 CGFloat viewWidth_; |
| 148 | 150 |
| 149 // Width of the text fields. | 151 // Width of the text fields. |
| 150 CGFloat textWidth_; | 152 CGFloat textWidth_; |
| 151 | 153 |
| 152 // YES when the popup has finished animating in. NO otherwise. | 154 // YES when the popup has finished animating in. NO otherwise. |
| 153 BOOL animateInCompleted_; | 155 BOOL animateInCompleted_; |
| 154 | |
| 155 base::mac::ObjCPropertyReleaser propertyReleaser_PageInfoViewController_; | |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Adds the state image at a pre-determined x position and the given y. This | 158 // Adds the state image at a pre-determined x position and the given y. This |
| 159 // does not affect the next Y position because the image is placed next to | 159 // does not affect the next Y position because the image is placed next to |
| 160 // a text field that is larger and accounts for the image's size. | 160 // a text field that is larger and accounts for the image's size. |
| 161 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info | 161 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info |
| 162 toSubviews:(NSMutableArray*)subviews | 162 toSubviews:(NSMutableArray*)subviews |
| 163 atOffset:(CGFloat)offset; | 163 atOffset:(CGFloat)offset; |
| 164 | 164 |
| 165 // Adds the title text field at the given x,y position, and returns the y | 165 // Adds the title text field at the given x,y position, and returns the y |
| (...skipping 10 matching lines...) Expand all Loading... |
| 176 | 176 |
| 177 // Returns a button with title and action configured for |buttonAction|. | 177 // Returns a button with title and action configured for |buttonAction|. |
| 178 - (UIButton*)buttonForAction:(PageInfoModel::ButtonAction)buttonAction; | 178 - (UIButton*)buttonForAction:(PageInfoModel::ButtonAction)buttonAction; |
| 179 | 179 |
| 180 // Adds the the button |buttonAction| that explains the icons. Returns the y | 180 // Adds the the button |buttonAction| that explains the icons. Returns the y |
| 181 // position delta for the next offset. | 181 // position delta for the next offset. |
| 182 - (CGFloat)addButton:(PageInfoModel::ButtonAction)buttonAction | 182 - (CGFloat)addButton:(PageInfoModel::ButtonAction)buttonAction |
| 183 toSubviews:(NSMutableArray*)subviews | 183 toSubviews:(NSMutableArray*)subviews |
| 184 atOffset:(CGFloat)offset; | 184 atOffset:(CGFloat)offset; |
| 185 | 185 |
| 186 @property(nonatomic, retain) UIView* containerView; | 186 @property(nonatomic, strong) UIView* containerView; |
| 187 @property(nonatomic, retain) UIView* popupContainer; | 187 @property(nonatomic, strong) UIView* popupContainer; |
| 188 @end | 188 @end |
| 189 | 189 |
| 190 @implementation PageInfoViewController | 190 @implementation PageInfoViewController |
| 191 | 191 |
| 192 @synthesize containerView = containerView_; | 192 @synthesize containerView = containerView_; |
| 193 @synthesize popupContainer = popupContainer_; | 193 @synthesize popupContainer = popupContainer_; |
| 194 | 194 |
| 195 - (id)initWithModel:(PageInfoModel*)model | 195 - (id)initWithModel:(PageInfoModel*)model |
| 196 bridge:(PageInfoModelObserver*)bridge | 196 bridge:(PageInfoModelObserver*)bridge |
| 197 sourceFrame:(CGRect)source | 197 sourceFrame:(CGRect)source |
| 198 parentView:(UIView*)parent { | 198 parentView:(UIView*)parent { |
| 199 DCHECK(parent); | 199 DCHECK(parent); |
| 200 self = [super init]; | 200 self = [super init]; |
| 201 if (self) { | 201 if (self) { |
| 202 propertyReleaser_PageInfoViewController_.Init( | 202 scrollView_ = |
| 203 self, [PageInfoViewController class]); | 203 [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 240, 128)]; |
| 204 | |
| 205 scrollView_.reset( | |
| 206 [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 240, 128)]); | |
| 207 [scrollView_ setMultipleTouchEnabled:YES]; | 204 [scrollView_ setMultipleTouchEnabled:YES]; |
| 208 [scrollView_ setClipsToBounds:YES]; | 205 [scrollView_ setClipsToBounds:YES]; |
| 209 [scrollView_ setShowsHorizontalScrollIndicator:NO]; | 206 [scrollView_ setShowsHorizontalScrollIndicator:NO]; |
| 210 [scrollView_ setIndicatorStyle:UIScrollViewIndicatorStyleBlack]; | 207 [scrollView_ setIndicatorStyle:UIScrollViewIndicatorStyleBlack]; |
| 211 [scrollView_ | 208 [scrollView_ |
| 212 setAutoresizingMask:(UIViewAutoresizingFlexibleTrailingMargin() | | 209 setAutoresizingMask:(UIViewAutoresizingFlexibleTrailingMargin() | |
| 213 UIViewAutoresizingFlexibleTopMargin)]; | 210 UIViewAutoresizingFlexibleTopMargin)]; |
| 214 | 211 |
| 215 innerContainerView_.reset( | 212 innerContainerView_ = |
| 216 [[BidiContainerView alloc] initWithFrame:CGRectMake(0, 0, 194, 327)]); | 213 [[BidiContainerView alloc] initWithFrame:CGRectMake(0, 0, 194, 327)]; |
| 217 [innerContainerView_ setBackgroundColor:[UIColor clearColor]]; | 214 [innerContainerView_ setBackgroundColor:[UIColor clearColor]]; |
| 218 [innerContainerView_ | 215 [innerContainerView_ |
| 219 setAccessibilityLabel:@"Page Security Info Scroll Container"]; | 216 setAccessibilityLabel:@"Page Security Info Scroll Container"]; |
| 220 [innerContainerView_ | 217 [innerContainerView_ |
| 221 setAutoresizingMask:(UIViewAutoresizingFlexibleTrailingMargin() | | 218 setAutoresizingMask:(UIViewAutoresizingFlexibleTrailingMargin() | |
| 222 UIViewAutoresizingFlexibleBottomMargin)]; | 219 UIViewAutoresizingFlexibleBottomMargin)]; |
| 223 | 220 |
| 224 model_.reset(model); | 221 model_.reset(model); |
| 225 bridge_.reset(bridge); | 222 bridge_.reset(bridge); |
| 226 origin_ = CGPointMake(CGRectGetMidX(source), CGRectGetMaxY(source)); | 223 origin_ = CGPointMake(CGRectGetMidX(source), CGRectGetMaxY(source)); |
| 227 | 224 |
| 228 UIInterfaceOrientation orientation = | 225 UIInterfaceOrientation orientation = |
| 229 [[UIApplication sharedApplication] statusBarOrientation]; | 226 [[UIApplication sharedApplication] statusBarOrientation]; |
| 230 viewWidth_ = IsCompact() ? kViewWidthCompact : kViewWidthRegular; | 227 viewWidth_ = IsCompact() ? kViewWidthCompact : kViewWidthRegular; |
| 231 // Special case iPhone landscape. | 228 // Special case iPhone landscape. |
| 232 if (!IsIPadIdiom() && UIInterfaceOrientationIsLandscape(orientation)) | 229 if (!IsIPadIdiom() && UIInterfaceOrientationIsLandscape(orientation)) |
| 233 viewWidth_ = kViewWidthiPhoneLandscape; | 230 viewWidth_ = kViewWidthiPhoneLandscape; |
| 234 | 231 |
| 235 textWidth_ = viewWidth_ - (kImageSize + kImageSpacing + kFramePadding * 2 + | 232 textWidth_ = viewWidth_ - (kImageSize + kImageSpacing + kFramePadding * 2 + |
| 236 kScrollViewInset * 2); | 233 kScrollViewInset * 2); |
| 237 | 234 |
| 238 base::scoped_nsobject<UILongPressGestureRecognizer> touchDownRecognizer( | 235 UILongPressGestureRecognizer* touchDownRecognizer = |
| 239 [[UILongPressGestureRecognizer alloc] | 236 [[UILongPressGestureRecognizer alloc] |
| 240 initWithTarget:self | 237 initWithTarget:self |
| 241 action:@selector(rootViewTapped:)]); | 238 action:@selector(rootViewTapped:)]; |
| 242 // Setting the duration to .001 makes this similar to a control event | 239 // Setting the duration to .001 makes this similar to a control event |
| 243 // UIControlEventTouchDown. | 240 // UIControlEventTouchDown. |
| 244 [touchDownRecognizer setMinimumPressDuration:.001]; | 241 [touchDownRecognizer setMinimumPressDuration:.001]; |
| 245 [touchDownRecognizer setDelegate:self]; | 242 [touchDownRecognizer setDelegate:self]; |
| 246 | 243 |
| 247 containerView_ = [[UIView alloc] initWithFrame:[parent bounds]]; | 244 containerView_ = [[UIView alloc] initWithFrame:[parent bounds]]; |
| 248 [containerView_ addGestureRecognizer:touchDownRecognizer]; | 245 [containerView_ addGestureRecognizer:touchDownRecognizer]; |
| 249 [containerView_ | 246 [containerView_ |
| 250 setBackgroundColor:[UIColor colorWithWhite:0 alpha:kShieldAlpha]]; | 247 setBackgroundColor:[UIColor colorWithWhite:0 alpha:kShieldAlpha]]; |
| 251 [containerView_ setTag:IDC_HIDE_PAGE_INFO]; | 248 [containerView_ setTag:IDC_HIDE_PAGE_INFO]; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 385 |
| 389 for (UIView* view in [innerContainerView_ subviews]) { | 386 for (UIView* view in [innerContainerView_ subviews]) { |
| 390 [view removeFromSuperview]; | 387 [view removeFromSuperview]; |
| 391 } | 388 } |
| 392 | 389 |
| 393 for (UIView* view in subviews) { | 390 for (UIView* view in subviews) { |
| 394 [innerContainerView_ addSubview:view]; | 391 [innerContainerView_ addSubview:view]; |
| 395 [innerContainerView_ setSubviewNeedsAdjustmentForRTL:view]; | 392 [innerContainerView_ setSubviewNeedsAdjustmentForRTL:view]; |
| 396 } | 393 } |
| 397 | 394 |
| 398 [scrollView_ setContentSize:innerContainerView_.get().frame.size]; | 395 [scrollView_ setContentSize:innerContainerView_.frame.size]; |
| 399 } | 396 } |
| 400 | 397 |
| 401 - (void)dismiss { | 398 - (void)dismiss { |
| 402 [self animatePageInfoViewOut]; | 399 [self animatePageInfoViewOut]; |
| 403 UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, | 400 UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, |
| 404 nil); | 401 nil); |
| 405 } | 402 } |
| 406 | 403 |
| 407 #pragma mark - Helper methods to create subviews. | 404 #pragma mark - Helper methods to create subviews. |
| 408 | 405 |
| 409 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info | 406 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info |
| 410 toSubviews:(NSMutableArray*)subviews | 407 toSubviews:(NSMutableArray*)subviews |
| 411 atOffset:(CGFloat)offset { | 408 atOffset:(CGFloat)offset { |
| 412 CGRect frame = CGRectMake(kFramePadding, offset, kImageSize, kImageSize); | 409 CGRect frame = CGRectMake(kFramePadding, offset, kImageSize, kImageSize); |
| 413 base::scoped_nsobject<UIImageView> imageView( | 410 UIImageView* imageView = [[UIImageView alloc] initWithFrame:frame]; |
| 414 [[UIImageView alloc] initWithFrame:frame]); | |
| 415 [imageView setImage:model_->GetIconImage(info.icon_id)->ToUIImage()]; | 411 [imageView setImage:model_->GetIconImage(info.icon_id)->ToUIImage()]; |
| 416 [subviews addObject:imageView.get()]; | 412 [subviews addObject:imageView]; |
| 417 } | 413 } |
| 418 | 414 |
| 419 - (CGFloat)addHeadlineViewForInfo:(const PageInfoModel::SectionInfo&)info | 415 - (CGFloat)addHeadlineViewForInfo:(const PageInfoModel::SectionInfo&)info |
| 420 toSubviews:(NSMutableArray*)subviews | 416 toSubviews:(NSMutableArray*)subviews |
| 421 atPoint:(CGPoint)point { | 417 atPoint:(CGPoint)point { |
| 422 CGRect frame = CGRectMake(point.x, point.y, textWidth_, kHeadlineHeight); | 418 CGRect frame = CGRectMake(point.x, point.y, textWidth_, kHeadlineHeight); |
| 423 base::scoped_nsobject<UILabel> label([[UILabel alloc] initWithFrame:frame]); | 419 UILabel* label = [[UILabel alloc] initWithFrame:frame]; |
| 424 [label setTextAlignment:NSTextAlignmentNatural]; | 420 [label setTextAlignment:NSTextAlignmentNatural]; |
| 425 [label setText:base::SysUTF16ToNSString(info.headline)]; | 421 [label setText:base::SysUTF16ToNSString(info.headline)]; |
| 426 [label setTextColor:PageInfoTextColor()]; | 422 [label setTextColor:PageInfoTextColor()]; |
| 427 [label setFont:PageInfoHeadlineFont()]; | 423 [label setFont:PageInfoHeadlineFont()]; |
| 428 [label setBackgroundColor:[UIColor clearColor]]; | 424 [label setBackgroundColor:[UIColor clearColor]]; |
| 429 [label setFrame:frame]; | 425 [label setFrame:frame]; |
| 430 [label setLineBreakMode:NSLineBreakByTruncatingHead]; | 426 [label setLineBreakMode:NSLineBreakByTruncatingHead]; |
| 431 [subviews addObject:label.get()]; | 427 [subviews addObject:label]; |
| 432 return CGRectGetHeight(frame); | 428 return CGRectGetHeight(frame); |
| 433 } | 429 } |
| 434 | 430 |
| 435 - (CGFloat)addDescriptionViewForInfo:(const PageInfoModel::SectionInfo&)info | 431 - (CGFloat)addDescriptionViewForInfo:(const PageInfoModel::SectionInfo&)info |
| 436 toSubviews:(NSMutableArray*)subviews | 432 toSubviews:(NSMutableArray*)subviews |
| 437 atPoint:(CGPoint)point { | 433 atPoint:(CGPoint)point { |
| 438 CGRect frame = CGRectMake(point.x, point.y, textWidth_, kImageSize); | 434 CGRect frame = CGRectMake(point.x, point.y, textWidth_, kImageSize); |
| 439 base::scoped_nsobject<UILabel> label([[UILabel alloc] initWithFrame:frame]); | 435 UILabel* label = [[UILabel alloc] initWithFrame:frame]; |
| 440 [label setTextAlignment:NSTextAlignmentNatural]; | 436 [label setTextAlignment:NSTextAlignmentNatural]; |
| 441 NSString* description = base::SysUTF16ToNSString(info.description); | 437 NSString* description = base::SysUTF16ToNSString(info.description); |
| 442 UIFont* font = [MDCTypography captionFont]; | 438 UIFont* font = [MDCTypography captionFont]; |
| 443 [label setTextColor:PageInfoTextColor()]; | 439 [label setTextColor:PageInfoTextColor()]; |
| 444 [label setText:description]; | 440 [label setText:description]; |
| 445 [label setFont:font]; | 441 [label setFont:font]; |
| 446 [label setNumberOfLines:0]; | 442 [label setNumberOfLines:0]; |
| 447 [label setBackgroundColor:[UIColor clearColor]]; | 443 [label setBackgroundColor:[UIColor clearColor]]; |
| 448 | 444 |
| 449 // If the text is oversized, resize the text field. | 445 // If the text is oversized, resize the text field. |
| 450 CGSize constraintSize = CGSizeMake(textWidth_, CGFLOAT_MAX); | 446 CGSize constraintSize = CGSizeMake(textWidth_, CGFLOAT_MAX); |
| 451 CGSize sizeToFit = | 447 CGSize sizeToFit = |
| 452 [description cr_boundingSizeWithSize:constraintSize font:font]; | 448 [description cr_boundingSizeWithSize:constraintSize font:font]; |
| 453 frame.size.height = sizeToFit.height; | 449 frame.size.height = sizeToFit.height; |
| 454 [label setFrame:frame]; | 450 [label setFrame:frame]; |
| 455 [subviews addObject:label.get()]; | 451 [subviews addObject:label]; |
| 456 return CGRectGetHeight(frame); | 452 return CGRectGetHeight(frame); |
| 457 } | 453 } |
| 458 | 454 |
| 459 - (UIButton*)buttonForAction:(PageInfoModel::ButtonAction)buttonAction { | 455 - (UIButton*)buttonForAction:(PageInfoModel::ButtonAction)buttonAction { |
| 460 if (buttonAction == PageInfoModel::BUTTON_NONE) { | 456 if (buttonAction == PageInfoModel::BUTTON_NONE) { |
| 461 return nil; | 457 return nil; |
| 462 } | 458 } |
| 463 UIButton* button = [[[UIButton alloc] initWithFrame:CGRectZero] autorelease]; | 459 UIButton* button = [[UIButton alloc] initWithFrame:CGRectZero]; |
| 464 int messageId = IDS_IOS_PAGE_INFO_RELOAD; | 460 int messageId = IDS_IOS_PAGE_INFO_RELOAD; |
| 465 NSInteger tag = IDC_RELOAD; | 461 NSInteger tag = IDC_RELOAD; |
| 466 NSString* accessibilityID = @"Reload button"; | 462 NSString* accessibilityID = @"Reload button"; |
| 467 switch (buttonAction) { | 463 switch (buttonAction) { |
| 468 case PageInfoModel::BUTTON_NONE: | 464 case PageInfoModel::BUTTON_NONE: |
| 469 NOTREACHED(); | 465 NOTREACHED(); |
| 470 return nil; | 466 return nil; |
| 471 case PageInfoModel::BUTTON_SHOW_SECURITY_HELP: | 467 case PageInfoModel::BUTTON_SHOW_SECURITY_HELP: |
| 472 messageId = IDS_LEARN_MORE; | 468 messageId = IDS_LEARN_MORE; |
| 473 tag = IDC_SHOW_SECURITY_HELP; | 469 tag = IDC_SHOW_SECURITY_HELP; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 [opacityAnimation setFromValue:@1]; | 624 [opacityAnimation setFromValue:@1]; |
| 629 [opacityAnimation setToValue:@0]; | 625 [opacityAnimation setToValue:@0]; |
| 630 [[containerView_ layer] addAnimation:opacityAnimation forKey:@"animateOut"]; | 626 [[containerView_ layer] addAnimation:opacityAnimation forKey:@"animateOut"]; |
| 631 | 627 |
| 632 [popupContainer_ setAlpha:0]; | 628 [popupContainer_ setAlpha:0]; |
| 633 [containerView_ setAlpha:0]; | 629 [containerView_ setAlpha:0]; |
| 634 [CATransaction commit]; | 630 [CATransaction commit]; |
| 635 } | 631 } |
| 636 | 632 |
| 637 @end | 633 @end |
| OLD | NEW |