OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/widget_extension/widget_view.h" | 5 #import "ios/chrome/search_widget_extension/search_widget_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 #if !defined(__has_feature) || !__has_feature(objc_arc) | 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
10 #error "This file requires ARC support." | 10 #error "This file requires ARC support." |
11 #endif | 11 #endif |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 const CGFloat kCursorHeight = 40; | 15 const CGFloat kCursorHeight = 40; |
16 const CGFloat kCursorWidth = 2; | 16 const CGFloat kCursorWidth = 2; |
17 const CGFloat kCursorHorizontalPadding = 10; | 17 const CGFloat kCursorHorizontalPadding = 10; |
18 const CGFloat kCursorVerticalPadding = 10; | 18 const CGFloat kCursorVerticalPadding = 10; |
19 const CGFloat kFakeboxHorizontalPadding = 40; | 19 const CGFloat kFakeboxHorizontalPadding = 40; |
20 const CGFloat kFakeboxVerticalPadding = 40; | 20 const CGFloat kFakeboxVerticalPadding = 40; |
21 | 21 |
22 } // namespace | 22 } // namespace |
23 | 23 |
24 @interface WidgetView () { | 24 @interface SearchWidgetView () { |
25 __weak id<WidgetViewActionTarget> _target; | 25 __weak id<SearchWidgetViewActionTarget> _target; |
26 } | 26 } |
27 | 27 |
28 @property(nonatomic, copy) NSString* copiedURL; | 28 @property(nonatomic, copy) NSString* copiedURL; |
29 @property(nonatomic, strong) UILabel* copiedURLLabel; | 29 @property(nonatomic, strong) UILabel* copiedURLLabel; |
30 @property(nonatomic, weak) UIView* cursor; | 30 @property(nonatomic, weak) UIView* cursor; |
31 | 31 |
32 // Creates and adds a fake omnibox with blinking cursor to the view and sets the | 32 // Creates and adds a fake omnibox with blinking cursor to the view and sets the |
33 // class cursor property. | 33 // class cursor property. |
34 - (void)addFakebox; | 34 - (void)addFakebox; |
35 | 35 |
36 @end | 36 @end |
37 | 37 |
38 @implementation WidgetView | 38 @implementation SearchWidgetView |
39 | 39 |
40 @synthesize copiedURL = _copiedURL; | 40 @synthesize copiedURL = _copiedURL; |
41 @synthesize copiedURLLabel = _copiedURLLabel; | 41 @synthesize copiedURLLabel = _copiedURLLabel; |
42 | 42 |
43 @synthesize cursor = _cursor; | 43 @synthesize cursor = _cursor; |
44 | 44 |
45 - (instancetype)initWithActionTarget:(id<WidgetViewActionTarget>)target { | 45 - (instancetype)initWithActionTarget:(id<SearchWidgetViewActionTarget>)target { |
46 self = [super initWithFrame:CGRectZero]; | 46 self = [super initWithFrame:CGRectZero]; |
47 if (self) { | 47 if (self) { |
48 DCHECK(target); | 48 DCHECK(target); |
49 _target = target; | 49 _target = target; |
50 [self addFakebox]; | 50 [self addFakebox]; |
51 } | 51 } |
52 return self; | 52 return self; |
53 } | 53 } |
54 | 54 |
55 - (void)addFakebox { | 55 - (void)addFakebox { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 completion:nil]; | 98 completion:nil]; |
99 } | 99 } |
100 | 100 |
101 - (void)updateCopiedURL:(NSString*)copiedURL { | 101 - (void)updateCopiedURL:(NSString*)copiedURL { |
102 self.copiedURL = copiedURL; | 102 self.copiedURL = copiedURL; |
103 self.copiedURLLabel.text = copiedURL; | 103 self.copiedURLLabel.text = copiedURL; |
104 } | 104 } |
105 | 105 |
106 @end | 106 @end |
OLD | NEW |