Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Side by Side Diff: ios/chrome/search_widget_extension/search_widget_view.h

Issue 2858253002: Adding search widget UI and functionality. (Closed)
Patch Set: comment and naming Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_H_ 5 #ifndef IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_H_
6 #define IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_H_ 6 #define IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_H_
7 7
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 // Protocol to be implemented by targets for user actions coming from the search 10 // Protocol to be implemented by targets for user actions coming from the search
11 // widget view. 11 // widget view.
12 @protocol SearchWidgetViewActionTarget 12 @protocol SearchWidgetViewActionTarget
13 13
14 // Called when the user taps the Search button. 14 // Called when the user taps the Search button.
15 - (void)openSearch:(id)sender; 15 - (void)openSearch:(id)sender;
16 // Called when the user taps the Incognito Search button. 16 // Called when the user taps the Incognito Search button.
17 - (void)openIncognito:(id)sender; 17 - (void)openIncognito:(id)sender;
18 // Called when the user taps the Voice Search button. 18 // Called when the user taps the Voice Search button.
19 - (void)openVoice:(id)sender; 19 - (void)openVoice:(id)sender;
20 // Called when the user taps the QR Code button. 20 // Called when the user taps the QR Code button.
21 - (void)openQRCode:(id)sender; 21 - (void)openQRCode:(id)sender;
22 // Called when the user taps the Open Copied URL section. 22 // Called when the user taps the Open Copied URL section.
23 - (void)openCopiedURL:(id)sender; 23 - (void)openCopiedURL:(id)sender;
24 24
25 @end 25 @end
26 26
27 // View for the search widget. Shows a blinking cursor for a fake omnibox and 27 // View for the search widget. Shows two sections. The first section is a row of
28 // calls the target when tapped. 28 // actions to launch the app represented as a circular icon and a label. When
29 // tapped, they call the callbacks in the SearchWidgetViewActionTarget protocol.
30 // The second section shows a button with the |copiedURLString| if it has been
31 // set. When tapped, the openCopiedURL callback in SearchWidgetViewActionTarget
32 // is called. If no |copiedURLString| was set, the button is replaced by a
33 // hairline separation and placeholder text. This section can be hidden with the
34 // |copiedURLVisible| variable.
29 @interface SearchWidgetView : UIView 35 @interface SearchWidgetView : UIView
30 36
37 // Set this property to show/hide the copied URL section.
38 @property(nonatomic, assign) BOOL copiedURLVisible;
39
40 // The copied URL string to be shown in the copied URL section.
41 @property(nonatomic, copy) NSString* copiedURLString;
42
31 // Designated initializer, creates the widget view with a |target| for user 43 // Designated initializer, creates the widget view with a |target| for user
32 // actions. 44 // actions. View elements will be added to the |primaryVibrancyEffect| and
45 // |secondaryVibrancyEffect| views.
33 - (instancetype)initWithActionTarget:(id<SearchWidgetViewActionTarget>)target 46 - (instancetype)initWithActionTarget:(id<SearchWidgetViewActionTarget>)target
47 primaryVibrancyEffect:(UIVibrancyEffect*)primaryVibrancyEffect
48 secondaryVibrancyEffect:(UIVibrancyEffect*)secondaryVibrancyEffect
34 NS_DESIGNATED_INITIALIZER; 49 NS_DESIGNATED_INITIALIZER;
35 - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; 50 - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
36 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; 51 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
37 52
38 // Updates the copied URL.
39 - (void)updateCopiedURL:(NSString*)copiedURL;
40
41 @end 53 @end
42 54
43 #endif // IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_H_ 55 #endif // IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698