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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // not retain its target; if the child outlives its parent, zombies get left | 121 // not retain its target; if the child outlives its parent, zombies get left |
120 // behind (http://crbug.com/59619). This will cancel the scheduled task if | 122 // behind (http://crbug.com/59619). This will cancel the scheduled task if |
121 // the controller (and thus this bridge) get destroyed before the message | 123 // the controller (and thus this bridge) get destroyed before the message |
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 |
| 131 void PageInfoModelBubbleBridge::PerformLayout() { |
| 132 // If the window is animating closed when this is called, the |
| 133 // animation could be holding the last reference to |controller_| |
| 134 // (and thus |this|). Pin it until the task is completed. |
| 135 base::scoped_nsobject<PageInfoViewController> keep_alive(controller_); |
| 136 [controller_ performLayout]; |
| 137 } |
| 138 |
129 @interface PageInfoViewController ()<UIGestureRecognizerDelegate> { | 139 @interface PageInfoViewController ()<UIGestureRecognizerDelegate> { |
130 // Scroll View inside the PageInfoView used to display content that exceeds | 140 // Scroll View inside the PageInfoView used to display content that exceeds |
131 // the available space. | 141 // the available space. |
132 base::scoped_nsobject<UIScrollView> scrollView_; | 142 UIScrollView* scrollView_; |
133 // Container View added inside the Scroll View. All content is added to this | 143 // Container View added inside the Scroll View. All content is added to this |
134 // view instead of PopupMenuController.containerView_. | 144 // view instead of PopupMenuController.containerView_. |
135 base::scoped_nsobject<BidiContainerView> innerContainerView_; | 145 BidiContainerView* innerContainerView_; |
136 | 146 |
137 // Origin of the arrow at the top of the popup window. | 147 // Origin of the arrow at the top of the popup window. |
138 CGPoint origin_; | 148 CGPoint origin_; |
139 | 149 |
140 // Model for the data to display. | 150 // Model for the data to display. |
141 std::unique_ptr<PageInfoModel> model_; | 151 std::unique_ptr<PageInfoModel> model_; |
142 | 152 |
143 // Thin bridge that pushes model-changed notifications from C++ to Cocoa. | 153 // Thin bridge that pushes model-changed notifications from C++ to Cocoa. |
144 std::unique_ptr<PageInfoModelObserver> bridge_; | 154 std::unique_ptr<PageInfoModelObserver> bridge_; |
145 | 155 |
146 // Width of the view. Depends on the device (iPad/iPhone). | 156 // Width of the view. Depends on the device (iPad/iPhone). |
147 CGFloat viewWidth_; | 157 CGFloat viewWidth_; |
148 | 158 |
149 // Width of the text fields. | 159 // Width of the text fields. |
150 CGFloat textWidth_; | 160 CGFloat textWidth_; |
151 | 161 |
152 // YES when the popup has finished animating in. NO otherwise. | 162 // YES when the popup has finished animating in. NO otherwise. |
153 BOOL animateInCompleted_; | 163 BOOL animateInCompleted_; |
154 | |
155 base::mac::ObjCPropertyReleaser propertyReleaser_PageInfoViewController_; | |
156 } | 164 } |
157 | 165 |
158 // Adds the state image at a pre-determined x position and the given y. This | 166 // 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 | 167 // 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. | 168 // a text field that is larger and accounts for the image's size. |
161 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info | 169 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info |
162 toSubviews:(NSMutableArray*)subviews | 170 toSubviews:(NSMutableArray*)subviews |
163 atOffset:(CGFloat)offset; | 171 atOffset:(CGFloat)offset; |
164 | 172 |
165 // Adds the title text field at the given x,y position, and returns the y | 173 // Adds the title text field at the given x,y position, and returns the y |
(...skipping 13 matching lines...) Expand all Loading... |
179 | 187 |
180 // Adds the the button |buttonAction| that explains the icons. Returns the y | 188 // Adds the the button |buttonAction| that explains the icons. Returns the y |
181 // position delta for the next offset. | 189 // position delta for the next offset. |
182 - (CGFloat)addButton:(PageInfoModel::ButtonAction)buttonAction | 190 - (CGFloat)addButton:(PageInfoModel::ButtonAction)buttonAction |
183 toSubviews:(NSMutableArray*)subviews | 191 toSubviews:(NSMutableArray*)subviews |
184 atOffset:(CGFloat)offset; | 192 atOffset:(CGFloat)offset; |
185 | 193 |
186 // Sends the IDC_HIDE_PAGE_INFO command to hide the current popup. | 194 // Sends the IDC_HIDE_PAGE_INFO command to hide the current popup. |
187 - (void)close; | 195 - (void)close; |
188 | 196 |
189 @property(nonatomic, retain) UIView* containerView; | 197 @property(nonatomic, strong) UIView* containerView; |
190 @property(nonatomic, retain) UIView* popupContainer; | 198 @property(nonatomic, strong) UIView* popupContainer; |
191 @end | 199 @end |
192 | 200 |
193 @implementation PageInfoViewController | 201 @implementation PageInfoViewController |
194 | 202 |
195 @synthesize containerView = containerView_; | 203 @synthesize containerView = containerView_; |
196 @synthesize popupContainer = popupContainer_; | 204 @synthesize popupContainer = popupContainer_; |
197 | 205 |
198 - (id)initWithModel:(PageInfoModel*)model | 206 - (id)initWithModel:(PageInfoModel*)model |
199 bridge:(PageInfoModelObserver*)bridge | 207 bridge:(PageInfoModelObserver*)bridge |
200 sourceFrame:(CGRect)source | 208 sourceFrame:(CGRect)source |
201 parentView:(UIView*)parent { | 209 parentView:(UIView*)parent { |
202 DCHECK(parent); | 210 DCHECK(parent); |
203 self = [super init]; | 211 self = [super init]; |
204 if (self) { | 212 if (self) { |
205 propertyReleaser_PageInfoViewController_.Init( | 213 scrollView_ = |
206 self, [PageInfoViewController class]); | 214 [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 240, 128)]; |
207 | |
208 scrollView_.reset( | |
209 [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 240, 128)]); | |
210 [scrollView_ setMultipleTouchEnabled:YES]; | 215 [scrollView_ setMultipleTouchEnabled:YES]; |
211 [scrollView_ setClipsToBounds:YES]; | 216 [scrollView_ setClipsToBounds:YES]; |
212 [scrollView_ setShowsHorizontalScrollIndicator:NO]; | 217 [scrollView_ setShowsHorizontalScrollIndicator:NO]; |
213 [scrollView_ setIndicatorStyle:UIScrollViewIndicatorStyleBlack]; | 218 [scrollView_ setIndicatorStyle:UIScrollViewIndicatorStyleBlack]; |
214 [scrollView_ | 219 [scrollView_ |
215 setAutoresizingMask:(UIViewAutoresizingFlexibleTrailingMargin() | | 220 setAutoresizingMask:(UIViewAutoresizingFlexibleTrailingMargin() | |
216 UIViewAutoresizingFlexibleTopMargin)]; | 221 UIViewAutoresizingFlexibleTopMargin)]; |
217 | 222 |
218 innerContainerView_.reset( | 223 innerContainerView_ = |
219 [[BidiContainerView alloc] initWithFrame:CGRectMake(0, 0, 194, 327)]); | 224 [[BidiContainerView alloc] initWithFrame:CGRectMake(0, 0, 194, 327)]; |
220 [innerContainerView_ setBackgroundColor:[UIColor clearColor]]; | 225 [innerContainerView_ setBackgroundColor:[UIColor clearColor]]; |
221 [innerContainerView_ | 226 [innerContainerView_ |
222 setAccessibilityLabel:@"Page Security Info Scroll Container"]; | 227 setAccessibilityLabel:@"Page Security Info Scroll Container"]; |
223 [innerContainerView_ | 228 [innerContainerView_ |
224 setAutoresizingMask:(UIViewAutoresizingFlexibleTrailingMargin() | | 229 setAutoresizingMask:(UIViewAutoresizingFlexibleTrailingMargin() | |
225 UIViewAutoresizingFlexibleBottomMargin)]; | 230 UIViewAutoresizingFlexibleBottomMargin)]; |
226 | 231 |
227 model_.reset(model); | 232 model_.reset(model); |
228 bridge_.reset(bridge); | 233 bridge_.reset(bridge); |
229 origin_ = CGPointMake(CGRectGetMidX(source), CGRectGetMaxY(source)); | 234 origin_ = CGPointMake(CGRectGetMidX(source), CGRectGetMaxY(source)); |
230 | 235 |
231 UIInterfaceOrientation orientation = | 236 UIInterfaceOrientation orientation = |
232 [[UIApplication sharedApplication] statusBarOrientation]; | 237 [[UIApplication sharedApplication] statusBarOrientation]; |
233 viewWidth_ = IsCompact() ? kViewWidthCompact : kViewWidthRegular; | 238 viewWidth_ = IsCompact() ? kViewWidthCompact : kViewWidthRegular; |
234 // Special case iPhone landscape. | 239 // Special case iPhone landscape. |
235 if (!IsIPadIdiom() && UIInterfaceOrientationIsLandscape(orientation)) | 240 if (!IsIPadIdiom() && UIInterfaceOrientationIsLandscape(orientation)) |
236 viewWidth_ = kViewWidthiPhoneLandscape; | 241 viewWidth_ = kViewWidthiPhoneLandscape; |
237 | 242 |
238 textWidth_ = viewWidth_ - (kImageSize + kImageSpacing + kFramePadding * 2 + | 243 textWidth_ = viewWidth_ - (kImageSize + kImageSpacing + kFramePadding * 2 + |
239 kScrollViewInset * 2); | 244 kScrollViewInset * 2); |
240 | 245 |
241 base::scoped_nsobject<UILongPressGestureRecognizer> touchDownRecognizer( | 246 UILongPressGestureRecognizer* touchDownRecognizer = |
242 [[UILongPressGestureRecognizer alloc] | 247 [[UILongPressGestureRecognizer alloc] |
243 initWithTarget:self | 248 initWithTarget:self |
244 action:@selector(rootViewTapped:)]); | 249 action:@selector(rootViewTapped:)]; |
245 // Setting the duration to .001 makes this similar to a control event | 250 // Setting the duration to .001 makes this similar to a control event |
246 // UIControlEventTouchDown. | 251 // UIControlEventTouchDown. |
247 [touchDownRecognizer setMinimumPressDuration:.001]; | 252 [touchDownRecognizer setMinimumPressDuration:.001]; |
248 [touchDownRecognizer setDelegate:self]; | 253 [touchDownRecognizer setDelegate:self]; |
249 | 254 |
250 containerView_ = [[UIView alloc] initWithFrame:[parent bounds]]; | 255 containerView_ = [[UIView alloc] initWithFrame:[parent bounds]]; |
251 [containerView_ addGestureRecognizer:touchDownRecognizer]; | 256 [containerView_ addGestureRecognizer:touchDownRecognizer]; |
252 [containerView_ | 257 [containerView_ |
253 setBackgroundColor:[UIColor colorWithWhite:0 alpha:kShieldAlpha]]; | 258 setBackgroundColor:[UIColor colorWithWhite:0 alpha:kShieldAlpha]]; |
254 [containerView_ setTag:IDC_HIDE_PAGE_INFO]; | 259 [containerView_ setTag:IDC_HIDE_PAGE_INFO]; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 396 |
392 for (UIView* view in [innerContainerView_ subviews]) { | 397 for (UIView* view in [innerContainerView_ subviews]) { |
393 [view removeFromSuperview]; | 398 [view removeFromSuperview]; |
394 } | 399 } |
395 | 400 |
396 for (UIView* view in subviews) { | 401 for (UIView* view in subviews) { |
397 [innerContainerView_ addSubview:view]; | 402 [innerContainerView_ addSubview:view]; |
398 [innerContainerView_ setSubviewNeedsAdjustmentForRTL:view]; | 403 [innerContainerView_ setSubviewNeedsAdjustmentForRTL:view]; |
399 } | 404 } |
400 | 405 |
401 [scrollView_ setContentSize:innerContainerView_.get().frame.size]; | 406 [scrollView_ setContentSize:innerContainerView_.frame.size]; |
402 } | 407 } |
403 | 408 |
404 - (void)close { | 409 - (void)close { |
405 [containerView_ chromeExecuteCommand:containerView_]; | 410 [containerView_ chromeExecuteCommand:containerView_]; |
406 } | 411 } |
407 | 412 |
408 - (void)dismiss { | 413 - (void)dismiss { |
409 [self animatePageInfoViewOut]; | 414 [self animatePageInfoViewOut]; |
410 UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, | 415 UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, |
411 nil); | 416 nil); |
412 } | 417 } |
413 | 418 |
414 #pragma mark - Helper methods to create subviews. | 419 #pragma mark - Helper methods to create subviews. |
415 | 420 |
416 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info | 421 - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info |
417 toSubviews:(NSMutableArray*)subviews | 422 toSubviews:(NSMutableArray*)subviews |
418 atOffset:(CGFloat)offset { | 423 atOffset:(CGFloat)offset { |
419 CGRect frame = CGRectMake(kFramePadding, offset, kImageSize, kImageSize); | 424 CGRect frame = CGRectMake(kFramePadding, offset, kImageSize, kImageSize); |
420 base::scoped_nsobject<UIImageView> imageView( | 425 UIImageView* imageView = [[UIImageView alloc] initWithFrame:frame]; |
421 [[UIImageView alloc] initWithFrame:frame]); | |
422 [imageView setImage:model_->GetIconImage(info.icon_id)->ToUIImage()]; | 426 [imageView setImage:model_->GetIconImage(info.icon_id)->ToUIImage()]; |
423 [subviews addObject:imageView.get()]; | 427 [subviews addObject:imageView]; |
424 } | 428 } |
425 | 429 |
426 - (CGFloat)addHeadlineViewForInfo:(const PageInfoModel::SectionInfo&)info | 430 - (CGFloat)addHeadlineViewForInfo:(const PageInfoModel::SectionInfo&)info |
427 toSubviews:(NSMutableArray*)subviews | 431 toSubviews:(NSMutableArray*)subviews |
428 atPoint:(CGPoint)point { | 432 atPoint:(CGPoint)point { |
429 CGRect frame = CGRectMake(point.x, point.y, textWidth_, kHeadlineHeight); | 433 CGRect frame = CGRectMake(point.x, point.y, textWidth_, kHeadlineHeight); |
430 base::scoped_nsobject<UILabel> label([[UILabel alloc] initWithFrame:frame]); | 434 UILabel* label = [[UILabel alloc] initWithFrame:frame]; |
431 [label setTextAlignment:NSTextAlignmentNatural]; | 435 [label setTextAlignment:NSTextAlignmentNatural]; |
432 [label setText:base::SysUTF16ToNSString(info.headline)]; | 436 [label setText:base::SysUTF16ToNSString(info.headline)]; |
433 [label setTextColor:PageInfoTextColor()]; | 437 [label setTextColor:PageInfoTextColor()]; |
434 [label setFont:PageInfoHeadlineFont()]; | 438 [label setFont:PageInfoHeadlineFont()]; |
435 [label setBackgroundColor:[UIColor clearColor]]; | 439 [label setBackgroundColor:[UIColor clearColor]]; |
436 [label setFrame:frame]; | 440 [label setFrame:frame]; |
437 [label setLineBreakMode:NSLineBreakByTruncatingHead]; | 441 [label setLineBreakMode:NSLineBreakByTruncatingHead]; |
438 [subviews addObject:label.get()]; | 442 [subviews addObject:label]; |
439 return CGRectGetHeight(frame); | 443 return CGRectGetHeight(frame); |
440 } | 444 } |
441 | 445 |
442 - (CGFloat)addDescriptionViewForInfo:(const PageInfoModel::SectionInfo&)info | 446 - (CGFloat)addDescriptionViewForInfo:(const PageInfoModel::SectionInfo&)info |
443 toSubviews:(NSMutableArray*)subviews | 447 toSubviews:(NSMutableArray*)subviews |
444 atPoint:(CGPoint)point { | 448 atPoint:(CGPoint)point { |
445 CGRect frame = CGRectMake(point.x, point.y, textWidth_, kImageSize); | 449 CGRect frame = CGRectMake(point.x, point.y, textWidth_, kImageSize); |
446 base::scoped_nsobject<UILabel> label([[UILabel alloc] initWithFrame:frame]); | 450 UILabel* label = [[UILabel alloc] initWithFrame:frame]; |
447 [label setTextAlignment:NSTextAlignmentNatural]; | 451 [label setTextAlignment:NSTextAlignmentNatural]; |
448 NSString* description = base::SysUTF16ToNSString(info.description); | 452 NSString* description = base::SysUTF16ToNSString(info.description); |
449 UIFont* font = [MDCTypography captionFont]; | 453 UIFont* font = [MDCTypography captionFont]; |
450 [label setTextColor:PageInfoTextColor()]; | 454 [label setTextColor:PageInfoTextColor()]; |
451 [label setText:description]; | 455 [label setText:description]; |
452 [label setFont:font]; | 456 [label setFont:font]; |
453 [label setNumberOfLines:0]; | 457 [label setNumberOfLines:0]; |
454 [label setBackgroundColor:[UIColor clearColor]]; | 458 [label setBackgroundColor:[UIColor clearColor]]; |
455 | 459 |
456 // If the text is oversized, resize the text field. | 460 // If the text is oversized, resize the text field. |
457 CGSize constraintSize = CGSizeMake(textWidth_, CGFLOAT_MAX); | 461 CGSize constraintSize = CGSizeMake(textWidth_, CGFLOAT_MAX); |
458 CGSize sizeToFit = | 462 CGSize sizeToFit = |
459 [description cr_boundingSizeWithSize:constraintSize font:font]; | 463 [description cr_boundingSizeWithSize:constraintSize font:font]; |
460 frame.size.height = sizeToFit.height; | 464 frame.size.height = sizeToFit.height; |
461 [label setFrame:frame]; | 465 [label setFrame:frame]; |
462 [subviews addObject:label.get()]; | 466 [subviews addObject:label]; |
463 return CGRectGetHeight(frame); | 467 return CGRectGetHeight(frame); |
464 } | 468 } |
465 | 469 |
466 - (UIButton*)buttonForAction:(PageInfoModel::ButtonAction)buttonAction { | 470 - (UIButton*)buttonForAction:(PageInfoModel::ButtonAction)buttonAction { |
467 if (buttonAction == PageInfoModel::BUTTON_NONE) { | 471 if (buttonAction == PageInfoModel::BUTTON_NONE) { |
468 return nil; | 472 return nil; |
469 } | 473 } |
470 UIButton* button = [[[UIButton alloc] initWithFrame:CGRectZero] autorelease]; | 474 UIButton* button = [[UIButton alloc] initWithFrame:CGRectZero]; |
471 int messageId = IDS_IOS_PAGE_INFO_RELOAD; | 475 int messageId = IDS_IOS_PAGE_INFO_RELOAD; |
472 NSInteger tag = IDC_RELOAD; | 476 NSInteger tag = IDC_RELOAD; |
473 NSString* accessibilityID = @"Reload button"; | 477 NSString* accessibilityID = @"Reload button"; |
474 switch (buttonAction) { | 478 switch (buttonAction) { |
475 case PageInfoModel::BUTTON_NONE: | 479 case PageInfoModel::BUTTON_NONE: |
476 NOTREACHED(); | 480 NOTREACHED(); |
477 return nil; | 481 return nil; |
478 case PageInfoModel::BUTTON_SHOW_SECURITY_HELP: | 482 case PageInfoModel::BUTTON_SHOW_SECURITY_HELP: |
479 messageId = IDS_LEARN_MORE; | 483 messageId = IDS_LEARN_MORE; |
480 tag = IDC_SHOW_SECURITY_HELP; | 484 tag = IDC_SHOW_SECURITY_HELP; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 [opacityAnimation setFromValue:@1]; | 642 [opacityAnimation setFromValue:@1]; |
639 [opacityAnimation setToValue:@0]; | 643 [opacityAnimation setToValue:@0]; |
640 [[containerView_ layer] addAnimation:opacityAnimation forKey:@"animateOut"]; | 644 [[containerView_ layer] addAnimation:opacityAnimation forKey:@"animateOut"]; |
641 | 645 |
642 [popupContainer_ setAlpha:0]; | 646 [popupContainer_ setAlpha:0]; |
643 [containerView_ setAlpha:0]; | 647 [containerView_ setAlpha:0]; |
644 [CATransaction commit]; | 648 [CATransaction commit]; |
645 } | 649 } |
646 | 650 |
647 @end | 651 @end |
OLD | NEW |