| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/overscroll_actions/overscroll_actions_view.h" | 5 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/objc_property_releaser.h" | 10 #include "base/mac/objc_property_releaser.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 12 #include "ios/chrome/browser/ui/rtl_geometry.h" | 12 #include "ios/chrome/browser/ui/rtl_geometry.h" |
| 13 #include "ios/chrome/browser/ui/uikit_ui_util.h" |
| 13 #include "ios/chrome/grit/ios_theme_resources.h" | 14 #include "ios/chrome/grit/ios_theme_resources.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 // Actions images. | 17 // Actions images. |
| 18 NSString* const kNewTabActionImage = @"ptr_new_tab"; | 18 NSString* const kNewTabActionImage = @"ptr_new_tab"; |
| 19 NSString* const kNewTabActionActiveImage = @"ptr_new_tab_active"; | 19 NSString* const kNewTabActionActiveImage = @"ptr_new_tab_active"; |
| 20 NSString* const kRefreshActionImage = @"ptr_reload"; | 20 NSString* const kRefreshActionImage = @"ptr_reload"; |
| 21 NSString* const kRefreshActionActiveImage = @"ptr_reload_active"; | 21 NSString* const kRefreshActionActiveImage = @"ptr_reload_active"; |
| 22 NSString* const kCloseActionImage = @"ptr_close"; | 22 NSString* const kCloseActionImage = @"ptr_close"; |
| 23 NSString* const kCloseActionActiveImage = @"ptr_close_active"; | 23 NSString* const kCloseActionActiveImage = @"ptr_close_active"; |
| 24 | 24 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 _refreshActionImageViewHighlighted = [[UIImageView alloc] init]; | 278 _refreshActionImageViewHighlighted = [[UIImageView alloc] init]; |
| 279 if (UseRTLLayout()) { | 279 if (UseRTLLayout()) { |
| 280 [_refreshActionImageViewHighlighted | 280 [_refreshActionImageViewHighlighted |
| 281 setTransform:CGAffineTransformMakeScale(-1, 1)]; | 281 setTransform:CGAffineTransformMakeScale(-1, 1)]; |
| 282 } | 282 } |
| 283 _closeTabActionImageViewHighlighted = [[UIImageView alloc] init]; | 283 _closeTabActionImageViewHighlighted = [[UIImageView alloc] init]; |
| 284 [_highlightMaskLayer addSublayer:_addTabActionImageViewHighlighted.layer]; | 284 [_highlightMaskLayer addSublayer:_addTabActionImageViewHighlighted.layer]; |
| 285 [_highlightMaskLayer addSublayer:_refreshActionImageViewHighlighted.layer]; | 285 [_highlightMaskLayer addSublayer:_refreshActionImageViewHighlighted.layer]; |
| 286 [_highlightMaskLayer addSublayer:_closeTabActionImageViewHighlighted.layer]; | 286 [_highlightMaskLayer addSublayer:_closeTabActionImageViewHighlighted.layer]; |
| 287 | 287 |
| 288 _shadowView = [[UIImageView alloc] initWithFrame:CGRectZero]; | 288 _shadowView = |
| 289 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 289 [[UIImageView alloc] initWithImage:NativeImage(IDR_IOS_TOOLBAR_SHADOW)]; |
| 290 gfx::Image shadow = rb.GetNativeImageNamed(IDR_IOS_TOOLBAR_SHADOW); | |
| 291 [_shadowView setImage:shadow.ToUIImage()]; | |
| 292 [self addSubview:_shadowView]; | 290 [self addSubview:_shadowView]; |
| 293 | 291 |
| 294 _backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; | 292 _backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; |
| 295 [self addSubview:_backgroundView]; | 293 [self addSubview:_backgroundView]; |
| 296 | 294 |
| 297 if (UseRTLLayout()) | 295 if (UseRTLLayout()) |
| 298 [self setTransform:CGAffineTransformMakeScale(-1, 1)]; | 296 [self setTransform:CGAffineTransformMakeScale(-1, 1)]; |
| 299 | 297 |
| 300 _tapGesture.reset([[UITapGestureRecognizer alloc] | 298 _tapGesture.reset([[UITapGestureRecognizer alloc] |
| 301 initWithTarget:self | 299 initWithTarget:self |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 CGPoint tapLocation = [tapRecognizer locationInView:self]; | 990 CGPoint tapLocation = [tapRecognizer locationInView:self]; |
| 993 ios_internal::OverscrollAction action = [self actionAtLocation:tapLocation]; | 991 ios_internal::OverscrollAction action = [self actionAtLocation:tapLocation]; |
| 994 if (action != ios_internal::OverscrollAction::NONE) { | 992 if (action != ios_internal::OverscrollAction::NONE) { |
| 995 [self updateSelectionForTouchedAction:action]; | 993 [self updateSelectionForTouchedAction:action]; |
| 996 [self setSelectedAction:action]; | 994 [self setSelectedAction:action]; |
| 997 [self.delegate overscrollActionsViewDidTapTriggerAction:self]; | 995 [self.delegate overscrollActionsViewDidTapTriggerAction:self]; |
| 998 } | 996 } |
| 999 } | 997 } |
| 1000 | 998 |
| 1001 @end | 999 @end |
| OLD | NEW |