| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/toolbar/toolbar_controller.h" | 5 #import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" |
| 6 | 6 |
| 7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // Macros for creating CGRects of height H, origin (0,0), with the portrait | 70 // Macros for creating CGRects of height H, origin (0,0), with the portrait |
| 71 // width of phone/pad devices. | 71 // width of phone/pad devices. |
| 72 // clang-format off | 72 // clang-format off |
| 73 #define IPHONE_FRAME(H) { { 0, 0 }, { kPortraitWidth[IPHONE_IDIOM], H } } | 73 #define IPHONE_FRAME(H) { { 0, 0 }, { kPortraitWidth[IPHONE_IDIOM], H } } |
| 74 #define IPAD_FRAME(H) { { 0, 0 }, { kPortraitWidth[IPAD_IDIOM], H } } | 74 #define IPAD_FRAME(H) { { 0, 0 }, { kPortraitWidth[IPAD_IDIOM], H } } |
| 75 | 75 |
| 76 // Makes a two-element C array of CGRects as described above, one for each | 76 // Makes a two-element C array of CGRects as described above, one for each |
| 77 // device idiom. | 77 // device idiom. |
| 78 #define FRAME_PAIR(H) { IPHONE_FRAME(H), IPAD_FRAME(H) } | 78 #define FRAME_PAIR(H) { IPHONE_FRAME(H), IPAD_FRAME(H) } |
| 79 | |
| 80 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 81 #error "This file requires ARC support." | |
| 82 #endif | |
| 83 // clang-format on | 79 // clang-format on |
| 84 | 80 |
| 85 const CGRect kToolbarFrame[INTERFACE_IDIOM_COUNT] = FRAME_PAIR(56); | 81 const CGRect kToolbarFrame[INTERFACE_IDIOM_COUNT] = FRAME_PAIR(56); |
| 86 | 82 |
| 87 namespace { | 83 namespace { |
| 88 | 84 |
| 89 // Color constants for the stack button text, normal and pressed states. These | 85 // Color constants for the stack button text, normal and pressed states. These |
| 90 // arrays are indexed by ToolbarControllerStyle enum values. | 86 // arrays are indexed by ToolbarControllerStyle enum values. |
| 91 const CGFloat kStackButtonNormalColors[] = { | 87 const CGFloat kStackButtonNormalColors[] = { |
| 92 85.0 / 255.0, // ToolbarControllerStyleLightMode | 88 85.0 / 255.0, // ToolbarControllerStyleLightMode |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // Don't allow UIView block-based animations if we're already performing | 193 // Don't allow UIView block-based animations if we're already performing |
| 198 // explicit transition animations. | 194 // explicit transition animations. |
| 199 if (self.animatingTransition) | 195 if (self.animatingTransition) |
| 200 return (id<CAAction>)[NSNull null]; | 196 return (id<CAAction>)[NSNull null]; |
| 201 return [super actionForLayer:layer forKey:event]; | 197 return [super actionForLayer:layer forKey:event]; |
| 202 } | 198 } |
| 203 | 199 |
| 204 @end | 200 @end |
| 205 | 201 |
| 206 @interface ToolbarController () { | 202 @interface ToolbarController () { |
| 207 // The shadow view. Only used on iPhone. | 203 // The top-level toolbar view. |
| 208 UIImageView* fullBleedShadowView_; | 204 base::scoped_nsobject<ToolbarView> view_; |
| 205 // The view for the toolbar background image. |
| 206 base::scoped_nsobject<UIImageView> backgroundView_; |
| 207 base::scoped_nsobject<UIImageView> shadowView_; |
| 208 base::scoped_nsobject<UIImageView> fullBleedShadowView_; |
| 209 | 209 |
| 210 // The backing object for |self.transitionLayers|. | 210 // The backing object for |self.transitionLayers|. |
| 211 NSMutableArray* transitionLayers_; | 211 base::scoped_nsobject<NSMutableArray> transitionLayers_; |
| 212 | 212 |
| 213 ToolbarToolsMenuButton* toolsMenuButton_; | 213 base::scoped_nsobject<ToolbarToolsMenuButton> toolsMenuButton_; |
| 214 UIButton* stackButton_; | 214 base::scoped_nsobject<UIButton> stackButton_; |
| 215 UIButton* shareButton_; | 215 base::scoped_nsobject<UIButton> shareButton_; |
| 216 NSArray* standardButtons_; | 216 base::scoped_nsobject<NSArray> standardButtons_; |
| 217 ToolsMenuButtonObserverBridge* toolsMenuButtonObserverBridge_; | 217 base::scoped_nsobject<ToolsMenuButtonObserverBridge> |
| 218 toolsMenuButtonObserverBridge_; |
| 218 ToolbarControllerStyle style_; | 219 ToolbarControllerStyle style_; |
| 219 | 220 |
| 220 // The following is nil if not visible. | 221 // The following is nil if not visible. |
| 221 ToolsPopupController* toolsPopupController_; | 222 base::scoped_nsobject<ToolsPopupController> toolsPopupController_; |
| 222 } | 223 } |
| 223 | 224 |
| 224 // Returns the background image that should be used for |style|. | 225 // Returns the background image that should be used for |style|. |
| 225 - (UIImage*)getBackgroundImageForStyle:(ToolbarControllerStyle)style; | 226 - (UIImage*)getBackgroundImageForStyle:(ToolbarControllerStyle)style; |
| 226 | 227 |
| 227 // Whether the share button should be visible in the toolbar. | 228 // Whether the share button should be visible in the toolbar. |
| 228 - (BOOL)shareButtonShouldBeVisible; | 229 - (BOOL)shareButtonShouldBeVisible; |
| 229 | 230 |
| 230 // Update share button visibility and |standardButtons_| array. | 231 // Update share button visibility and |standardButtons_| array. |
| 231 - (void)updateStandardButtons; | 232 - (void)updateStandardButtons; |
| 232 | 233 |
| 233 // Returns an animation for |button| for a toolbar transition animation with | 234 // Returns an animation for |button| for a toolbar transition animation with |
| 234 // |style|. |button|'s frame will be interpolated between its layout in the | 235 // |style|. |button|'s frame will be interpolated between its layout in the |
| 235 // screen toolbar to the card's tab frame, and will be faded in for | 236 // screen toolbar to the card's tab frame, and will be faded in for |
| 236 // ToolbarTransitionStyleToStackView and faded out for | 237 // ToolbarTransitionStyleToStackView and faded out for |
| 237 // ToolbarTransitionStyleToBVC. | 238 // ToolbarTransitionStyleToBVC. |
| 238 - (CAAnimation*)transitionAnimationForButton:(UIButton*)button | 239 - (CAAnimation*)transitionAnimationForButton:(UIButton*)button |
| 239 containerBeginBounds:(CGRect)containerBeginBounds | 240 containerBeginBounds:(CGRect)containerBeginBounds |
| 240 containerEndBounds:(CGRect)containerEndBounds | 241 containerEndBounds:(CGRect)containerEndBounds |
| 241 withStyle:(ToolbarTransitionStyle)style; | 242 withStyle:(ToolbarTransitionStyle)style; |
| 242 @end | 243 @end |
| 243 | 244 |
| 244 @implementation ToolbarController | 245 @implementation ToolbarController |
| 245 | 246 |
| 246 @synthesize readingListModel = readingListModel_; | 247 @synthesize readingListModel = readingListModel_; |
| 247 @synthesize view = view_; | 248 |
| 248 @synthesize backgroundView = backgroundView_; | |
| 249 @synthesize shadowView = shadowView_; | |
| 250 @synthesize toolsPopupController = toolsPopupController_; | |
| 251 @synthesize style = style_; | 249 @synthesize style = style_; |
| 252 | 250 |
| 253 - (void)setReadingListModel:(ReadingListModel*)readingListModel { | 251 - (void)setReadingListModel:(ReadingListModel*)readingListModel { |
| 254 readingListModel_ = readingListModel; | 252 readingListModel_ = readingListModel; |
| 255 if (readingListModel_) { | 253 if (readingListModel_) { |
| 256 toolsMenuButtonObserverBridge_ = | 254 toolsMenuButtonObserverBridge_.reset([[ToolsMenuButtonObserverBridge alloc] |
| 257 [[ToolsMenuButtonObserverBridge alloc] initWithModel:readingListModel_ | 255 initWithModel:readingListModel_ |
| 258 toolbarButton:toolsMenuButton_]; | 256 toolbarButton:toolsMenuButton_]); |
| 259 } | 257 } |
| 260 } | 258 } |
| 261 | 259 |
| 262 - (instancetype)initWithStyle:(ToolbarControllerStyle)style { | 260 - (instancetype)initWithStyle:(ToolbarControllerStyle)style { |
| 263 self = [super init]; | 261 self = [super init]; |
| 264 if (self) { | 262 if (self) { |
| 265 style_ = style; | 263 style_ = style; |
| 266 DCHECK_LT(style_, ToolbarControllerStyleMaxStyles); | 264 DCHECK_LT(style_, ToolbarControllerStyleMaxStyles); |
| 267 | 265 |
| 268 InterfaceIdiom idiom = IsIPadIdiom() ? IPAD_IDIOM : IPHONE_IDIOM; | 266 InterfaceIdiom idiom = IsIPadIdiom() ? IPAD_IDIOM : IPHONE_IDIOM; |
| 269 CGRect viewFrame = kToolbarFrame[idiom]; | 267 CGRect viewFrame = kToolbarFrame[idiom]; |
| 270 CGRect backgroundFrame = kBackgroundViewFrame[idiom]; | 268 CGRect backgroundFrame = kBackgroundViewFrame[idiom]; |
| 271 CGRect stackButtonFrame = LayoutRectGetRect(kStackButtonFrame); | 269 CGRect stackButtonFrame = LayoutRectGetRect(kStackButtonFrame); |
| 272 CGRect toolsMenuButtonFrame = | 270 CGRect toolsMenuButtonFrame = |
| 273 LayoutRectGetRect(kToolsMenuButtonFrame[idiom]); | 271 LayoutRectGetRect(kToolsMenuButtonFrame[idiom]); |
| 274 | 272 |
| 275 if (idiom == IPHONE_IDIOM) { | 273 if (idiom == IPHONE_IDIOM) { |
| 276 CGFloat statusBarOffset = [self statusBarOffset]; | 274 CGFloat statusBarOffset = [self statusBarOffset]; |
| 277 viewFrame.size.height += statusBarOffset; | 275 viewFrame.size.height += statusBarOffset; |
| 278 backgroundFrame.size.height += statusBarOffset; | 276 backgroundFrame.size.height += statusBarOffset; |
| 279 stackButtonFrame.origin.y += statusBarOffset; | 277 stackButtonFrame.origin.y += statusBarOffset; |
| 280 toolsMenuButtonFrame.origin.y += statusBarOffset; | 278 toolsMenuButtonFrame.origin.y += statusBarOffset; |
| 281 } | 279 } |
| 282 | 280 |
| 283 view_ = [[ToolbarView alloc] initWithFrame:viewFrame]; | 281 view_.reset([[ToolbarView alloc] initWithFrame:viewFrame]); |
| 284 backgroundView_ = [[UIImageView alloc] initWithFrame:backgroundFrame]; | 282 backgroundView_.reset([[UIImageView alloc] initWithFrame:backgroundFrame]); |
| 285 toolsMenuButton_ = | 283 toolsMenuButton_.reset([[ToolbarToolsMenuButton alloc] |
| 286 [[ToolbarToolsMenuButton alloc] initWithFrame:toolsMenuButtonFrame | 284 initWithFrame:toolsMenuButtonFrame |
| 287 style:style_]; | 285 style:style_]); |
| 288 [toolsMenuButton_ setTag:IDC_SHOW_TOOLS_MENU]; | 286 [toolsMenuButton_ setTag:IDC_SHOW_TOOLS_MENU]; |
| 289 [toolsMenuButton_ | 287 [toolsMenuButton_ |
| 290 setAutoresizingMask:UIViewAutoresizingFlexibleLeadingMargin() | | 288 setAutoresizingMask:UIViewAutoresizingFlexibleLeadingMargin() | |
| 291 UIViewAutoresizingFlexibleBottomMargin]; | 289 UIViewAutoresizingFlexibleBottomMargin]; |
| 292 | 290 |
| 293 [view_ addSubview:backgroundView_]; | 291 [view_ addSubview:backgroundView_]; |
| 294 [view_ addSubview:toolsMenuButton_]; | 292 [view_ addSubview:toolsMenuButton_]; |
| 295 [view_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; | 293 [view_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; |
| 296 [backgroundView_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth | | 294 [backgroundView_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth | |
| 297 UIViewAutoresizingFlexibleHeight]; | 295 UIViewAutoresizingFlexibleHeight]; |
| 298 | 296 |
| 299 if (idiom == IPAD_IDIOM) { | 297 if (idiom == IPAD_IDIOM) { |
| 300 CGRect shareButtonFrame = LayoutRectGetRect(kShareMenuButtonFrame); | 298 CGRect shareButtonFrame = LayoutRectGetRect(kShareMenuButtonFrame); |
| 301 shareButton_ = [[UIButton alloc] initWithFrame:shareButtonFrame]; | 299 shareButton_.reset([[UIButton alloc] initWithFrame:shareButtonFrame]); |
| 302 [shareButton_ setTag:IDC_SHARE_PAGE]; | 300 [shareButton_ setTag:IDC_SHARE_PAGE]; |
| 303 [shareButton_ | 301 [shareButton_ |
| 304 setAutoresizingMask:UIViewAutoresizingFlexibleLeadingMargin() | | 302 setAutoresizingMask:UIViewAutoresizingFlexibleLeadingMargin() | |
| 305 UIViewAutoresizingFlexibleBottomMargin]; | 303 UIViewAutoresizingFlexibleBottomMargin]; |
| 306 [self setUpButton:shareButton_ | 304 [self setUpButton:shareButton_ |
| 307 withImageEnum:ToolbarButtonNameShare | 305 withImageEnum:ToolbarButtonNameShare |
| 308 forInitialState:UIControlStateNormal | 306 forInitialState:UIControlStateNormal |
| 309 hasDisabledImage:YES | 307 hasDisabledImage:YES |
| 310 synchronously:NO]; | 308 synchronously:NO]; |
| 311 SetA11yLabelAndUiAutomationName(shareButton_, IDS_IOS_TOOLS_MENU_SHARE, | 309 SetA11yLabelAndUiAutomationName(shareButton_, IDS_IOS_TOOLS_MENU_SHARE, |
| 312 kToolbarShareButtonIdentifier); | 310 kToolbarShareButtonIdentifier); |
| 313 [view_ addSubview:shareButton_]; | 311 [view_ addSubview:shareButton_]; |
| 314 } | 312 } |
| 315 | 313 |
| 316 CGRect shadowFrame = kShadowViewFrame[idiom]; | 314 CGRect shadowFrame = kShadowViewFrame[idiom]; |
| 317 shadowFrame.origin.y = CGRectGetMaxY(backgroundFrame); | 315 shadowFrame.origin.y = CGRectGetMaxY(backgroundFrame); |
| 318 shadowView_ = [[UIImageView alloc] initWithFrame:shadowFrame]; | 316 shadowView_.reset([[UIImageView alloc] initWithFrame:shadowFrame]); |
| 319 [shadowView_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; | 317 [shadowView_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; |
| 320 [shadowView_ setUserInteractionEnabled:NO]; | 318 [shadowView_ setUserInteractionEnabled:NO]; |
| 321 [view_ addSubview:shadowView_]; | 319 [view_ addSubview:shadowView_]; |
| 322 [shadowView_ setImage:NativeImage(IDR_IOS_TOOLBAR_SHADOW)]; | 320 [shadowView_ setImage:NativeImage(IDR_IOS_TOOLBAR_SHADOW)]; |
| 323 | 321 |
| 324 if (idiom == IPHONE_IDIOM) { | 322 if (idiom == IPHONE_IDIOM) { |
| 325 // iPad omnibox does not expand to full bleed. | 323 // iPad omnibox does not expand to full bleed. |
| 326 CGRect fullBleedShadowFrame = kFullBleedShadowViewFrame; | 324 CGRect fullBleedShadowFrame = kFullBleedShadowViewFrame; |
| 327 fullBleedShadowFrame.origin.y = shadowFrame.origin.y; | 325 fullBleedShadowFrame.origin.y = shadowFrame.origin.y; |
| 328 fullBleedShadowView_ = | 326 fullBleedShadowView_.reset( |
| 329 [[UIImageView alloc] initWithFrame:fullBleedShadowFrame]; | 327 [[UIImageView alloc] initWithFrame:fullBleedShadowFrame]); |
| 330 [fullBleedShadowView_ | 328 [fullBleedShadowView_ |
| 331 setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; | 329 setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; |
| 332 [fullBleedShadowView_ setUserInteractionEnabled:NO]; | 330 [fullBleedShadowView_ setUserInteractionEnabled:NO]; |
| 333 [fullBleedShadowView_ setAlpha:0]; | 331 [fullBleedShadowView_ setAlpha:0]; |
| 334 [view_ addSubview:fullBleedShadowView_]; | 332 [view_ addSubview:fullBleedShadowView_]; |
| 335 [fullBleedShadowView_ | 333 [fullBleedShadowView_ |
| 336 setImage:NativeImage(IDR_IOS_TOOLBAR_SHADOW_FULL_BLEED)]; | 334 setImage:NativeImage(IDR_IOS_TOOLBAR_SHADOW_FULL_BLEED)]; |
| 337 } | 335 } |
| 338 | 336 |
| 339 transitionLayers_ = | 337 transitionLayers_.reset( |
| 340 [[NSMutableArray alloc] initWithCapacity:kTransitionLayerCapacity]; | 338 [[NSMutableArray alloc] initWithCapacity:kTransitionLayerCapacity]); |
| 341 | 339 |
| 342 // UIImageViews do not default to userInteractionEnabled:YES. | 340 // UIImageViews do not default to userInteractionEnabled:YES. |
| 343 [view_ setUserInteractionEnabled:YES]; | 341 [view_ setUserInteractionEnabled:YES]; |
| 344 [backgroundView_ setUserInteractionEnabled:YES]; | 342 [backgroundView_ setUserInteractionEnabled:YES]; |
| 345 | 343 |
| 346 UIImage* tile = [self getBackgroundImageForStyle:style]; | 344 UIImage* tile = [self getBackgroundImageForStyle:style]; |
| 347 [[self backgroundView] | 345 [[self backgroundView] |
| 348 setImage:StretchableImageFromUIImage(tile, 0.0, 3.0)]; | 346 setImage:StretchableImageFromUIImage(tile, 0.0, 3.0)]; |
| 349 | 347 |
| 350 if (idiom == IPHONE_IDIOM) { | 348 if (idiom == IPHONE_IDIOM) { |
| 351 stackButton_ = | 349 stackButton_.reset( |
| 352 [[ToolbarCenteredButton alloc] initWithFrame:stackButtonFrame]; | 350 [[ToolbarCenteredButton alloc] initWithFrame:stackButtonFrame]); |
| 353 [stackButton_ setTag:IDC_TOGGLE_TAB_SWITCHER]; | 351 [stackButton_ setTag:IDC_TOGGLE_TAB_SWITCHER]; |
| 354 [[stackButton_ titleLabel] | 352 [[stackButton_ titleLabel] |
| 355 setFont:[self fontForSize:kFontSizeFewerThanTenTabs]]; | 353 setFont:[self fontForSize:kFontSizeFewerThanTenTabs]]; |
| 356 [stackButton_ | 354 [stackButton_ |
| 357 setTitleColor:[UIColor colorWithWhite:kStackButtonNormalColors[style_] | 355 setTitleColor:[UIColor colorWithWhite:kStackButtonNormalColors[style_] |
| 358 alpha:1.0] | 356 alpha:1.0] |
| 359 forState:UIControlStateNormal]; | 357 forState:UIControlStateNormal]; |
| 360 UIColor* highlightColor = | 358 UIColor* highlightColor = |
| 361 UIColorFromRGB(kStackButtonHighlightedColors[style_], 1.0); | 359 UIColorFromRGB(kStackButtonHighlightedColors[style_], 1.0); |
| 362 [stackButton_ setTitleColor:highlightColor | 360 [stackButton_ setTitleColor:highlightColor |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 return nil; | 400 return nil; |
| 403 } | 401 } |
| 404 | 402 |
| 405 - (UIFont*)fontForSize:(NSInteger)size { | 403 - (UIFont*)fontForSize:(NSInteger)size { |
| 406 return [[MDFRobotoFontLoader sharedInstance] boldFontOfSize:size]; | 404 return [[MDFRobotoFontLoader sharedInstance] boldFontOfSize:size]; |
| 407 } | 405 } |
| 408 | 406 |
| 409 - (void)dealloc { | 407 - (void)dealloc { |
| 410 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 408 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 411 [toolsPopupController_ setDelegate:nil]; | 409 [toolsPopupController_ setDelegate:nil]; |
| 410 [super dealloc]; |
| 411 } |
| 412 |
| 413 - (UIImageView*)view { |
| 414 return view_.get(); |
| 415 } |
| 416 |
| 417 - (UIImageView*)backgroundView { |
| 418 return backgroundView_.get(); |
| 412 } | 419 } |
| 413 | 420 |
| 414 - (CGFloat)statusBarOffset { | 421 - (CGFloat)statusBarOffset { |
| 415 return StatusBarHeight(); | 422 return StatusBarHeight(); |
| 416 } | 423 } |
| 417 | 424 |
| 425 - (UIImageView*)shadowView { |
| 426 return shadowView_.get(); |
| 427 } |
| 428 |
| 418 - (NSMutableArray*)transitionLayers { | 429 - (NSMutableArray*)transitionLayers { |
| 419 return transitionLayers_; | 430 return transitionLayers_.get(); |
| 420 } | 431 } |
| 421 | 432 |
| 422 - (BOOL)imageShouldFlipForRightToLeftLayoutDirection:(int)imageEnum { | 433 - (BOOL)imageShouldFlipForRightToLeftLayoutDirection:(int)imageEnum { |
| 423 // None of the images this class knows about should flip. | 434 // None of the images this class knows about should flip. |
| 424 return NO; | 435 return NO; |
| 425 } | 436 } |
| 426 | 437 |
| 427 - (void)updateStandardButtons { | 438 - (void)updateStandardButtons { |
| 428 BOOL shareButtonShouldBeVisible = [self shareButtonShouldBeVisible]; | 439 BOOL shareButtonShouldBeVisible = [self shareButtonShouldBeVisible]; |
| 429 [shareButton_ setHidden:!shareButtonShouldBeVisible]; | 440 [shareButton_ setHidden:!shareButtonShouldBeVisible]; |
| 430 NSMutableArray* standardButtons = [NSMutableArray array]; | 441 NSMutableArray* standardButtons = [NSMutableArray array]; |
| 431 [standardButtons addObject:toolsMenuButton_]; | 442 [standardButtons addObject:toolsMenuButton_]; |
| 432 if (stackButton_) | 443 if (stackButton_) |
| 433 [standardButtons addObject:stackButton_]; | 444 [standardButtons addObject:stackButton_]; |
| 434 if (shareButtonShouldBeVisible) | 445 if (shareButtonShouldBeVisible) |
| 435 [standardButtons addObject:shareButton_]; | 446 [standardButtons addObject:shareButton_]; |
| 436 standardButtons_ = standardButtons; | 447 standardButtons_.reset([standardButtons retain]); |
| 437 } | 448 } |
| 438 | 449 |
| 439 - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { | 450 - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { |
| 440 [self updateStandardButtons]; | 451 [self updateStandardButtons]; |
| 441 } | 452 } |
| 442 | 453 |
| 454 - (ToolsPopupController*)toolsPopupController { |
| 455 return toolsPopupController_.get(); |
| 456 } |
| 457 |
| 443 - (void)applicationDidEnterBackground:(NSNotification*)notify { | 458 - (void)applicationDidEnterBackground:(NSNotification*)notify { |
| 444 if (toolsPopupController_) { | 459 if (toolsPopupController_.get()) { |
| 445 // Dismiss the tools popup menu without animation. | 460 // Dismiss the tools popup menu without animation. |
| 446 [toolsMenuButton_ setToolsMenuIsVisible:NO]; | 461 [toolsMenuButton_ setToolsMenuIsVisible:NO]; |
| 447 toolsPopupController_ = nil; | 462 toolsPopupController_.reset(nil); |
| 448 [[NSNotificationCenter defaultCenter] | 463 [[NSNotificationCenter defaultCenter] |
| 449 postNotificationName:kMenuWillHideNotification | 464 postNotificationName:kMenuWillHideNotification |
| 450 object:nil]; | 465 object:nil]; |
| 451 } | 466 } |
| 452 } | 467 } |
| 453 | 468 |
| 454 - (BOOL)shareButtonShouldBeVisible { | 469 - (BOOL)shareButtonShouldBeVisible { |
| 455 // The share button only exists on iPad, and when some tabs are visible | 470 // The share button only exists on iPad, and when some tabs are visible |
| 456 // (i.e. when not in DarkMode), and when the width is greater than | 471 // (i.e. when not in DarkMode), and when the width is greater than |
| 457 // the tablet mini view. | 472 // the tablet mini view. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 468 | 483 |
| 469 - (UIImage*)imageForImageEnum:(int)imageEnum | 484 - (UIImage*)imageForImageEnum:(int)imageEnum |
| 470 forState:(ToolbarButtonUIState)state { | 485 forState:(ToolbarButtonUIState)state { |
| 471 int imageID = | 486 int imageID = |
| 472 [self imageIdForImageEnum:imageEnum style:[self style] forState:state]; | 487 [self imageIdForImageEnum:imageEnum style:[self style] forState:state]; |
| 473 return NativeReversableImage( | 488 return NativeReversableImage( |
| 474 imageID, [self imageShouldFlipForRightToLeftLayoutDirection:imageEnum]); | 489 imageID, [self imageShouldFlipForRightToLeftLayoutDirection:imageEnum]); |
| 475 } | 490 } |
| 476 | 491 |
| 477 - (int)imageEnumForButton:(UIButton*)button { | 492 - (int)imageEnumForButton:(UIButton*)button { |
| 478 if (button == stackButton_) | 493 if (button == stackButton_.get()) |
| 479 return ToolbarButtonNameStack; | 494 return ToolbarButtonNameStack; |
| 480 return NumberOfToolbarButtonNames; | 495 return NumberOfToolbarButtonNames; |
| 481 } | 496 } |
| 482 | 497 |
| 483 - (int)imageIdForImageEnum:(int)index | 498 - (int)imageIdForImageEnum:(int)index |
| 484 style:(ToolbarControllerStyle)style | 499 style:(ToolbarControllerStyle)style |
| 485 forState:(ToolbarButtonUIState)state { | 500 forState:(ToolbarButtonUIState)state { |
| 486 DCHECK(index < NumberOfToolbarButtonNames); | 501 DCHECK(index < NumberOfToolbarButtonNames); |
| 487 DCHECK(style < ToolbarControllerStyleMaxStyles); | 502 DCHECK(style < ToolbarControllerStyleMaxStyles); |
| 488 DCHECK(state < NumberOfToolbarButtonUIStates); | 503 DCHECK(state < NumberOfToolbarButtonUIStates); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 if (synchronously || initialState == UIControlStateDisabled) { | 556 if (synchronously || initialState == UIControlStateDisabled) { |
| 542 disabledImageBlock(); | 557 disabledImageBlock(); |
| 543 } else { | 558 } else { |
| 544 dispatch_after(addImageDelay, dispatch_get_main_queue(), | 559 dispatch_after(addImageDelay, dispatch_get_main_queue(), |
| 545 disabledImageBlock); | 560 disabledImageBlock); |
| 546 } | 561 } |
| 547 } | 562 } |
| 548 } | 563 } |
| 549 | 564 |
| 550 - (void)registerEventsForButton:(UIButton*)button { | 565 - (void)registerEventsForButton:(UIButton*)button { |
| 551 if (button != toolsMenuButton_) { | 566 if (button != toolsMenuButton_.get()) { |
| 552 // |target| must be |self| (as opposed to |nil|) because |self| isn't in the | 567 // |target| must be |self| (as opposed to |nil|) because |self| isn't in the |
| 553 // responder chain. | 568 // responder chain. |
| 554 [button addTarget:self | 569 [button addTarget:self |
| 555 action:@selector(standardButtonPressed:) | 570 action:@selector(standardButtonPressed:) |
| 556 forControlEvents:UIControlEventTouchUpInside]; | 571 forControlEvents:UIControlEventTouchUpInside]; |
| 557 } | 572 } |
| 558 [button addTarget:self | 573 [button addTarget:self |
| 559 action:@selector(recordUserMetrics:) | 574 action:@selector(recordUserMetrics:) |
| 560 forControlEvents:UIControlEventTouchUpInside]; | 575 forControlEvents:UIControlEventTouchUpInside]; |
| 561 [button addTarget:button | 576 [button addTarget:button |
| 562 action:@selector(chromeExecuteCommand:) | 577 action:@selector(chromeExecuteCommand:) |
| 563 forControlEvents:UIControlEventTouchUpInside]; | 578 forControlEvents:UIControlEventTouchUpInside]; |
| 564 } | 579 } |
| 565 | 580 |
| 566 - (CGRect)shareButtonAnchorRect { | 581 - (CGRect)shareButtonAnchorRect { |
| 567 // Shrink the padding around the shareButton so the popovers are anchored | 582 // Shrink the padding around the shareButton so the popovers are anchored |
| 568 // correctly. | 583 // correctly. |
| 569 return CGRectInset([shareButton_ bounds], 10, 0); | 584 return CGRectInset([shareButton_ bounds], 10, 0); |
| 570 } | 585 } |
| 571 | 586 |
| 572 - (UIView*)shareButtonView { | 587 - (UIView*)shareButtonView { |
| 573 return shareButton_; | 588 return shareButton_.get(); |
| 574 } | 589 } |
| 575 | 590 |
| 576 - (void)showToolsMenuPopupWithConfiguration: | 591 - (void)showToolsMenuPopupWithConfiguration: |
| 577 (ToolsMenuConfiguration*)configuration { | 592 (ToolsMenuConfiguration*)configuration { |
| 578 // Because an animation hides and shows the tools popup menu it is possible to | 593 // Because an animation hides and shows the tools popup menu it is possible to |
| 579 // tap the tools button multiple times before the tools menu is shown. Ignore | 594 // tap the tools button multiple times before the tools menu is shown. Ignore |
| 580 // repeated taps between animations. | 595 // repeated taps between animations. |
| 581 if (toolsPopupController_) | 596 if (toolsPopupController_) |
| 582 return; | 597 return; |
| 583 | 598 |
| 584 base::RecordAction(UserMetricsAction("ShowAppMenu")); | 599 base::RecordAction(UserMetricsAction("ShowAppMenu")); |
| 585 | 600 |
| 586 // Keep the button pressed. | 601 // Keep the button pressed. |
| 587 [toolsMenuButton_ setToolsMenuIsVisible:YES]; | 602 [toolsMenuButton_ setToolsMenuIsVisible:YES]; |
| 588 | 603 |
| 589 [configuration setToolsMenuButton:toolsMenuButton_]; | 604 [configuration setToolsMenuButton:toolsMenuButton_]; |
| 590 toolsPopupController_ = | 605 toolsPopupController_.reset( |
| 591 [[ToolsPopupController alloc] initWithConfiguration:configuration]; | 606 [[ToolsPopupController alloc] initWithConfiguration:configuration]); |
| 592 | 607 |
| 593 [toolsPopupController_ setDelegate:self]; | 608 [toolsPopupController_ setDelegate:self]; |
| 594 | 609 |
| 595 [[NSNotificationCenter defaultCenter] | 610 [[NSNotificationCenter defaultCenter] |
| 596 postNotificationName:kMenuWillShowNotification | 611 postNotificationName:kMenuWillShowNotification |
| 597 object:nil]; | 612 object:nil]; |
| 598 } | 613 } |
| 599 | 614 |
| 600 - (void)dismissToolsMenuPopup { | 615 - (void)dismissToolsMenuPopup { |
| 601 if (!toolsPopupController_) | 616 if (!toolsPopupController_.get()) |
| 602 return; | 617 return; |
| 603 ToolsPopupController* tempTPC = toolsPopupController_; | 618 ToolsPopupController* tempTPC = toolsPopupController_.get(); |
| 604 [tempTPC containerView].userInteractionEnabled = NO; | 619 [tempTPC containerView].userInteractionEnabled = NO; |
| 605 [tempTPC dismissAnimatedWithCompletion:^{ | 620 [tempTPC dismissAnimatedWithCompletion:^{ |
| 606 // Unpress the tools menu button by restoring the normal and | 621 // Unpress the tools menu button by restoring the normal and |
| 607 // highlighted images to their usual state. | 622 // highlighted images to their usual state. |
| 608 [toolsMenuButton_ setToolsMenuIsVisible:NO]; | 623 [toolsMenuButton_ setToolsMenuIsVisible:NO]; |
| 609 // Reference tempTPC so the block retains it. | 624 // Reference tempTPC so the block retains it. |
| 610 [tempTPC self]; | 625 [tempTPC self]; |
| 611 }]; | 626 }]; |
| 612 // reset tabHistoryPopupController_ to prevent -applicationDidEnterBackground | 627 // reset tabHistoryPopupController_ to prevent -applicationDidEnterBackground |
| 613 // from posting another kMenuWillHideNotification. | 628 // from posting another kMenuWillHideNotification. |
| 614 toolsPopupController_ = nil; | 629 toolsPopupController_.reset(); |
| 615 | 630 |
| 616 [[NSNotificationCenter defaultCenter] | 631 [[NSNotificationCenter defaultCenter] |
| 617 postNotificationName:kMenuWillHideNotification | 632 postNotificationName:kMenuWillHideNotification |
| 618 object:nil]; | 633 object:nil]; |
| 619 } | 634 } |
| 620 | 635 |
| 621 - (UIImage*)getBackgroundImageForStyle:(ToolbarControllerStyle)style { | 636 - (UIImage*)getBackgroundImageForStyle:(ToolbarControllerStyle)style { |
| 622 int backgroundImageID; | 637 int backgroundImageID; |
| 623 if (style == ToolbarControllerStyleLightMode) | 638 if (style == ToolbarControllerStyleLightMode) |
| 624 backgroundImageID = IDR_IOS_TOOLBAR_LIGHT_BACKGROUND; | 639 backgroundImageID = IDR_IOS_TOOLBAR_LIGHT_BACKGROUND; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 // Animate the opacity of the buttons to 0. | 678 // Animate the opacity of the buttons to 0. |
| 664 [CATransaction begin]; | 679 [CATransaction begin]; |
| 665 [CATransaction setAnimationDuration:ios::material::kDuration2]; | 680 [CATransaction setAnimationDuration:ios::material::kDuration2]; |
| 666 [CATransaction | 681 [CATransaction |
| 667 setAnimationTimingFunction:TimingFunction(ios::material::CurveEaseIn)]; | 682 setAnimationTimingFunction:TimingFunction(ios::material::CurveEaseIn)]; |
| 668 CABasicAnimation* fadeButtons = | 683 CABasicAnimation* fadeButtons = |
| 669 [CABasicAnimation animationWithKeyPath:@"opacity"]; | 684 [CABasicAnimation animationWithKeyPath:@"opacity"]; |
| 670 fadeButtons.fromValue = @1; | 685 fadeButtons.fromValue = @1; |
| 671 fadeButtons.toValue = @0; | 686 fadeButtons.toValue = @0; |
| 672 | 687 |
| 673 for (UIButton* button in standardButtons_) { | 688 for (UIButton* button in standardButtons_.get()) { |
| 674 if (![button isHidden]) { | 689 if (![button isHidden]) { |
| 675 [button layer].opacity = 0; | 690 [button layer].opacity = 0; |
| 676 [[button layer] addAnimation:fadeButtons forKey:@"fade"]; | 691 [[button layer] addAnimation:fadeButtons forKey:@"fade"]; |
| 677 } | 692 } |
| 678 } | 693 } |
| 679 [CATransaction commit]; | 694 [CATransaction commit]; |
| 680 | 695 |
| 681 // Animate the buttons 10 pixels in the leading-to-trailing direction | 696 // Animate the buttons 10 pixels in the leading-to-trailing direction |
| 682 [CATransaction begin]; | 697 [CATransaction begin]; |
| 683 [CATransaction setAnimationDuration:ios::material::kDuration1]; | 698 [CATransaction setAnimationDuration:ios::material::kDuration1]; |
| 684 [CATransaction | 699 [CATransaction |
| 685 setAnimationTimingFunction:TimingFunction(ios::material::CurveEaseIn)]; | 700 setAnimationTimingFunction:TimingFunction(ios::material::CurveEaseIn)]; |
| 686 | 701 |
| 687 for (UIButton* button in standardButtons_) { | 702 for (UIButton* button in standardButtons_.get()) { |
| 688 CABasicAnimation* shiftButton = | 703 CABasicAnimation* shiftButton = |
| 689 [CABasicAnimation animationWithKeyPath:@"position"]; | 704 [CABasicAnimation animationWithKeyPath:@"position"]; |
| 690 CGPoint startPosition = [button layer].position; | 705 CGPoint startPosition = [button layer].position; |
| 691 CGPoint endPosition = | 706 CGPoint endPosition = |
| 692 CGPointLayoutOffset(startPosition, kButtonFadeOutXOffset); | 707 CGPointLayoutOffset(startPosition, kButtonFadeOutXOffset); |
| 693 shiftButton.fromValue = [NSValue valueWithCGPoint:startPosition]; | 708 shiftButton.fromValue = [NSValue valueWithCGPoint:startPosition]; |
| 694 shiftButton.toValue = [NSValue valueWithCGPoint:endPosition]; | 709 shiftButton.toValue = [NSValue valueWithCGPoint:endPosition]; |
| 695 [[button layer] addAnimation:shiftButton forKey:@"shiftButton"]; | 710 [[button layer] addAnimation:shiftButton forKey:@"shiftButton"]; |
| 696 } | 711 } |
| 697 | 712 |
| 698 [CATransaction commit]; | 713 [CATransaction commit]; |
| 699 | 714 |
| 700 // Fade to the full bleed shadow. | 715 // Fade to the full bleed shadow. |
| 701 [UIView animateWithDuration:ios::material::kDuration1 | 716 [UIView animateWithDuration:ios::material::kDuration1 |
| 702 animations:^{ | 717 animations:^{ |
| 703 [shadowView_ setAlpha:0]; | 718 [shadowView_ setAlpha:0]; |
| 704 [fullBleedShadowView_ setAlpha:1]; | 719 [fullBleedShadowView_ setAlpha:1]; |
| 705 }]; | 720 }]; |
| 706 } | 721 } |
| 707 | 722 |
| 708 - (void)fadeInStandardControls { | 723 - (void)fadeInStandardControls { |
| 709 for (UIButton* button in standardButtons_) { | 724 for (UIButton* button in standardButtons_.get()) { |
| 710 [self fadeInView:button | 725 [self fadeInView:button |
| 711 fromLeadingOffset:10 | 726 fromLeadingOffset:10 |
| 712 withDuration:ios::material::kDuration2 | 727 withDuration:ios::material::kDuration2 |
| 713 afterDelay:ios::material::kDuration1]; | 728 afterDelay:ios::material::kDuration1]; |
| 714 } | 729 } |
| 715 | 730 |
| 716 // Fade to the normal shadow. | 731 // Fade to the normal shadow. |
| 717 [UIView animateWithDuration:ios::material::kDuration1 | 732 [UIView animateWithDuration:ios::material::kDuration1 |
| 718 animations:^{ | 733 animations:^{ |
| 719 [shadowView_ setAlpha:self.backgroundView.alpha]; | 734 [shadowView_ setAlpha:self.backgroundView.alpha]; |
| 720 [fullBleedShadowView_ setAlpha:0]; | 735 [fullBleedShadowView_ setAlpha:0]; |
| 721 }]; | 736 }]; |
| 722 } | 737 } |
| 723 | 738 |
| 724 - (void)animationDidStart:(CAAnimation*)anim { | 739 - (void)animationDidStart:(CAAnimation*)anim { |
| 725 // Once the buttons start fading in, set their opacity to 1 so there's no | 740 // Once the buttons start fading in, set their opacity to 1 so there's no |
| 726 // flicker at the end of the animation. | 741 // flicker at the end of the animation. |
| 727 for (UIButton* button in standardButtons_) { | 742 for (UIButton* button in standardButtons_.get()) { |
| 728 if (anim == [[button layer] animationForKey:@"fadeIn"]) { | 743 if (anim == [[button layer] animationForKey:@"fadeIn"]) { |
| 729 [button layer].opacity = 1; | 744 [button layer].opacity = 1; |
| 730 return; | 745 return; |
| 731 } | 746 } |
| 732 } | 747 } |
| 733 } | 748 } |
| 734 | 749 |
| 735 - (void)fadeInView:(UIView*)view | 750 - (void)fadeInView:(UIView*)view |
| 736 fromLeadingOffset:(LayoutOffset)leadingOffset | 751 fromLeadingOffset:(LayoutOffset)leadingOffset |
| 737 withDuration:(NSTimeInterval)duration | 752 withDuration:(NSTimeInterval)duration |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 transitionStyle:style]; | 926 transitionStyle:style]; |
| 912 } | 927 } |
| 913 | 928 |
| 914 - (void)hideViewsForNewTabPage:(BOOL)hide { | 929 - (void)hideViewsForNewTabPage:(BOOL)hide { |
| 915 DCHECK(!IsIPadIdiom()); | 930 DCHECK(!IsIPadIdiom()); |
| 916 [shadowView_ setHidden:hide]; | 931 [shadowView_ setHidden:hide]; |
| 917 } | 932 } |
| 918 | 933 |
| 919 - (void)setStandardControlsVisible:(BOOL)visible { | 934 - (void)setStandardControlsVisible:(BOOL)visible { |
| 920 if (visible) { | 935 if (visible) { |
| 921 for (UIButton* button in standardButtons_) { | 936 for (UIButton* button in standardButtons_.get()) { |
| 922 [button setAlpha:1.0]; | 937 [button setAlpha:1.0]; |
| 923 } | 938 } |
| 924 } else { | 939 } else { |
| 925 for (UIButton* button in standardButtons_) { | 940 for (UIButton* button in standardButtons_.get()) { |
| 926 [button setAlpha:0.0]; | 941 [button setAlpha:0.0]; |
| 927 } | 942 } |
| 928 } | 943 } |
| 929 } | 944 } |
| 930 | 945 |
| 931 - (void)setStandardControlsAlpha:(CGFloat)alpha { | 946 - (void)setStandardControlsAlpha:(CGFloat)alpha { |
| 932 for (UIButton* button in standardButtons_) { | 947 for (UIButton* button in standardButtons_.get()) { |
| 933 if (![button isHidden]) | 948 if (![button isHidden]) |
| 934 [button setAlpha:alpha]; | 949 [button setAlpha:alpha]; |
| 935 } | 950 } |
| 936 } | 951 } |
| 937 | 952 |
| 938 - (void)setBackgroundAlpha:(CGFloat)alpha { | 953 - (void)setBackgroundAlpha:(CGFloat)alpha { |
| 939 [backgroundView_ setAlpha:alpha]; | 954 [backgroundView_ setAlpha:alpha]; |
| 940 [shadowView_ setAlpha:alpha]; | 955 [shadowView_ setAlpha:alpha]; |
| 941 } | 956 } |
| 942 | 957 |
| 943 - (void)setStandardControlsTransform:(CGAffineTransform)transform { | 958 - (void)setStandardControlsTransform:(CGAffineTransform)transform { |
| 944 for (UIButton* button in standardButtons_) { | 959 for (UIButton* button in standardButtons_.get()) { |
| 945 [button setTransform:transform]; | 960 [button setTransform:transform]; |
| 946 } | 961 } |
| 947 } | 962 } |
| 948 | 963 |
| 949 - (void)standardButtonPressed:(UIButton*)sender { | 964 - (void)standardButtonPressed:(UIButton*)sender { |
| 950 // This check for valid button images assumes that the buttons all have a | 965 // This check for valid button images assumes that the buttons all have a |
| 951 // different image for the highlighted state as for the normal state. | 966 // different image for the highlighted state as for the normal state. |
| 952 // Currently, that assumption is true. | 967 // Currently, that assumption is true. |
| 953 if ([sender imageForState:UIControlStateHighlighted] == | 968 if ([sender imageForState:UIControlStateHighlighted] == |
| 954 [sender imageForState:UIControlStateNormal]) { | 969 [sender imageForState:UIControlStateNormal]) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 [[stackButton_ titleLabel] | 1007 [[stackButton_ titleLabel] |
| 993 setFont:[self fontForSize:kFontSizeTenTabsOrMore]]; | 1008 setFont:[self fontForSize:kFontSizeTenTabsOrMore]]; |
| 994 } | 1009 } |
| 995 } | 1010 } |
| 996 | 1011 |
| 997 [stackButton_ setTitle:stackButtonTitle forState:UIControlStateNormal]; | 1012 [stackButton_ setTitle:stackButtonTitle forState:UIControlStateNormal]; |
| 998 [stackButton_ setAccessibilityValue:stackButtonValue]; | 1013 [stackButton_ setAccessibilityValue:stackButtonValue]; |
| 999 } | 1014 } |
| 1000 | 1015 |
| 1001 - (IBAction)recordUserMetrics:(id)sender { | 1016 - (IBAction)recordUserMetrics:(id)sender { |
| 1002 if (sender == toolsMenuButton_) | 1017 if (sender == toolsMenuButton_.get()) |
| 1003 base::RecordAction(UserMetricsAction("MobileToolbarShowMenu")); | 1018 base::RecordAction(UserMetricsAction("MobileToolbarShowMenu")); |
| 1004 else if (sender == stackButton_) | 1019 else if (sender == stackButton_.get()) |
| 1005 base::RecordAction(UserMetricsAction("MobileToolbarShowStackView")); | 1020 base::RecordAction(UserMetricsAction("MobileToolbarShowStackView")); |
| 1006 else if (sender == shareButton_) | 1021 else if (sender == shareButton_.get()) |
| 1007 base::RecordAction(UserMetricsAction("MobileToolbarShareMenu")); | 1022 base::RecordAction(UserMetricsAction("MobileToolbarShareMenu")); |
| 1008 else | 1023 else |
| 1009 NOTREACHED(); | 1024 NOTREACHED(); |
| 1010 } | 1025 } |
| 1011 | 1026 |
| 1012 - (IBAction)stackButtonTouchDown:(id)sender { | 1027 - (IBAction)stackButtonTouchDown:(id)sender { |
| 1013 // Exists only for override by subclasses. | 1028 // Exists only for override by subclasses. |
| 1014 } | 1029 } |
| 1015 | 1030 |
| 1016 + (CGFloat)toolbarDropShadowHeight { | 1031 + (CGFloat)toolbarDropShadowHeight { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1033 #pragma mark - | 1048 #pragma mark - |
| 1034 #pragma mark PopupMenuDelegate methods. | 1049 #pragma mark PopupMenuDelegate methods. |
| 1035 | 1050 |
| 1036 - (void)dismissPopupMenu:(PopupMenuController*)controller { | 1051 - (void)dismissPopupMenu:(PopupMenuController*)controller { |
| 1037 if ([controller isKindOfClass:[ToolsPopupController class]] && | 1052 if ([controller isKindOfClass:[ToolsPopupController class]] && |
| 1038 (ToolsPopupController*)controller == toolsPopupController_) | 1053 (ToolsPopupController*)controller == toolsPopupController_) |
| 1039 [self dismissToolsMenuPopup]; | 1054 [self dismissToolsMenuPopup]; |
| 1040 } | 1055 } |
| 1041 | 1056 |
| 1042 @end | 1057 @end |
| OLD | NEW |