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