Chromium Code Reviews| 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 #ifndef IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_H_ | 5 #ifndef IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_H_ |
| 6 #define IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_H_ | 6 #define IOS_CHROME_WIDGET_EXTENSION_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 widget | 10 // Protocol to be implemented by targets for user actions coming from the widget |
| 11 // view. | 11 // view. |
| 12 @protocol WidgetViewActionTarget | 12 @protocol WidgetViewActionTarget |
| 13 | 13 |
| 14 // Called when the user taps the fake omnibox. | 14 // Called when the user taps the Search button. |
| 15 - (void)openApp:(id)sender; | 15 - (void)openSearch:(id)sender; |
| 16 // Called when the user taps the Incognito Search button. | |
| 17 - (void)openIncognito:(id)sender; | |
| 18 // Called when the user taps the Voice Search button. | |
| 19 - (void)openVoice:(id)sender; | |
| 20 // Called when the user taps the QR Code button. | |
| 21 - (void)openQRCode:(id)sender; | |
| 22 // Called when the user taps the Open Copied Link section. | |
| 23 - (void)openCopiedLink:(id)sender; | |
| 16 | 24 |
| 17 @end | 25 @end |
| 18 | 26 |
| 19 // View for the widget. Shows a blinking cursor for a fake omnibox and calls the | 27 // View for the widget. Shows a set of buttons to open the main application in |
| 20 // target when tapped. | 28 // various search modes (regular, incognito, voice, qr code) and optionally a |
| 29 // larger area to open the currently copied URL. | |
|
lody
2017/04/11 12:56:01
This is a premature comment! I'll revert it in a p
lody
2017/04/11 14:38:18
Done.
| |
| 21 @interface WidgetView : UIView | 30 @interface WidgetView : UIView |
| 22 | 31 |
| 23 // Designated initializer, creates the widget view with a |target| for user | 32 // Designated initializer, creates the widget view with a |target| for user |
| 24 // actions. | 33 // actions. |
| 25 - (instancetype)initWithActionTarget:(id<WidgetViewActionTarget>)target | 34 - (instancetype)initWithActionTarget:(id<WidgetViewActionTarget>)target |
| 26 NS_DESIGNATED_INITIALIZER; | 35 NS_DESIGNATED_INITIALIZER; |
| 27 - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; | 36 - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; |
| 28 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; | 37 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| 29 | 38 |
| 39 // Updates the copied URL. | |
|
lpromero
2017/04/11 13:24:03
Above you call it Copied Link. Is it the same conc
lody
2017/04/11 14:38:18
Done.
| |
| 40 - (void)updateCopiedURL:(NSString*)copiedURL; | |
|
lpromero
2017/04/11 13:24:03
Can you add unit tests?
You could also add Earl Gr
lody
2017/04/11 14:38:18
I will look at adding unit tests in a patch set (f
| |
| 41 | |
| 30 @end | 42 @end |
| 31 | 43 |
| 32 #endif // IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_H_ | 44 #endif // IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_H_ |
| OLD | NEW |