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 #include "ios/chrome/browser/ui/contextual_search/panel_configuration.h" | 5 #include "ios/chrome/browser/ui/contextual_search/panel_configuration.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
9 | 12 |
10 namespace { | 13 namespace { |
11 // Amount of tab that a previewing pane leaves visible, expressed as a fraction. | 14 // Amount of tab that a previewing pane leaves visible, expressed as a fraction. |
12 const CGFloat kPhonePreviewingDisplayRatio = 1.0 / 3.0; | 15 const CGFloat kPhonePreviewingDisplayRatio = 1.0 / 3.0; |
13 // Phone peeking height equals phone toolbar height. | 16 // Phone peeking height equals phone toolbar height. |
14 const CGFloat kPhonePeekingHeight = 64.0; | 17 const CGFloat kPhonePeekingHeight = 64.0; |
15 // Phone covering offset equals the status bar height; | 18 // Phone covering offset equals the status bar height; |
16 const CGFloat kPhoneCoveringHeightOffset = 20.0; | 19 const CGFloat kPhoneCoveringHeightOffset = 20.0; |
17 | 20 |
18 const CGFloat kPadPreviewingDisplayRatio = 1.0 / 3.0; | 21 const CGFloat kPadPreviewingDisplayRatio = 1.0 / 3.0; |
(...skipping 17 matching lines...) Expand all Loading... |
36 | 39 |
37 @implementation PanelConfiguration | 40 @implementation PanelConfiguration |
38 | 41 |
39 @synthesize containerSize = _containerSize; | 42 @synthesize containerSize = _containerSize; |
40 @synthesize positions = _positions; | 43 @synthesize positions = _positions; |
41 @synthesize horizontalSizeClass = _horizontalSizeClass; | 44 @synthesize horizontalSizeClass = _horizontalSizeClass; |
42 | 45 |
43 + (instancetype)configurationForContainerSize:(CGSize)containerSize | 46 + (instancetype)configurationForContainerSize:(CGSize)containerSize |
44 horizontalSizeClass: | 47 horizontalSizeClass: |
45 (UIUserInterfaceSizeClass)horizontalSizeClass { | 48 (UIUserInterfaceSizeClass)horizontalSizeClass { |
46 PanelConfiguration* config = [[[self alloc] init] autorelease]; | 49 PanelConfiguration* config = [[self alloc] init]; |
47 config.containerSize = containerSize; | 50 config.containerSize = containerSize; |
48 config.horizontalSizeClass = horizontalSizeClass; | 51 config.horizontalSizeClass = horizontalSizeClass; |
49 return config; | 52 return config; |
50 } | 53 } |
51 | 54 |
52 - (void)setContainerSize:(CGSize)containerSize { | 55 - (void)setContainerSize:(CGSize)containerSize { |
53 DCHECK(containerSize.height > self.peekingHeight); | 56 DCHECK(containerSize.height > self.peekingHeight); |
54 _containerSize = containerSize; | 57 _containerSize = containerSize; |
55 [self updatePositions]; | 58 [self updatePositions]; |
56 } | 59 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 break; | 232 break; |
230 default: | 233 default: |
231 positioningConstraint = | 234 positioningConstraint = |
232 [super constraintForPositioningGuide:guide atState:state]; | 235 [super constraintForPositioningGuide:guide atState:state]; |
233 break; | 236 break; |
234 } | 237 } |
235 return positioningConstraint; | 238 return positioningConstraint; |
236 } | 239 } |
237 | 240 |
238 @end | 241 @end |
OLD | NEW |