Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_INTERNAL_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_METADATA_H_ | |
|
rohitrao (ping after 24h)
2016/11/08 12:39:18
Header guard needs to be updated.
sczs1
2016/11/09 01:14:52
Done.
| |
| 6 #define IOS_INTERNAL_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_METADATA_H_ | |
| 7 | |
| 8 #import <Foundation/Foundation.h> | |
| 9 | |
| 10 //#include | |
| 11 // TODO(sczs) Import native_app_infobar_delegate once rest of | |
|
rohitrao (ping after 24h)
2016/11/08 12:39:18
Is this cruft now? Can it be deleted?
sczs1
2016/11/09 01:14:52
We can't forward declare enumerations that are nes
| |
| 12 // native_app_launcher lands upstream. | |
| 13 | |
| 14 @class ChromeIdentity; | |
| 15 class GURL; | |
| 16 @class UIImage; | |
| 17 | |
| 18 namespace net { | |
| 19 class URLRequestContextGetter; | |
| 20 } | |
| 21 | |
| 22 // Protocol todo describe | |
| 23 @protocol NativeAppMetadata<NSObject> | |
| 24 | |
| 25 // Defines whether the app should be opened automatically upon Link Navigation. | |
| 26 // This is a tri-state value internally: Yes, No, not set. However, externally, | |
| 27 // only the Yes/No state is returned via the property getter. If the internal | |
| 28 // value is "not set", then it is up to the current implementation to decide | |
| 29 // whether it should be treated as a YES or a NO. The property setter can set | |
| 30 // the value to either YES or NO. To set the value to "not set", use | |
| 31 // -unsetShouldAutoOpenLinks. | |
| 32 @property(nonatomic, assign) BOOL shouldAutoOpenLinks; | |
| 33 - (void)unsetShouldAutoOpenLinks; | |
| 34 | |
| 35 // Defines whether infobars for this app should be bypassed. | |
| 36 @property(nonatomic, assign) BOOL shouldBypassInfoBars; | |
| 37 // Stores the number of times a banner is dismissed or ignored. | |
| 38 @property(nonatomic, assign) NSInteger numberOfDismissedInfoBars; | |
| 39 | |
| 40 // Returns the application name for this native app. If there is a localized | |
| 41 // name for the current locale, return the localized name. Otherwise, return | |
| 42 // the default application name. | |
| 43 - (NSString*)appName; | |
| 44 | |
| 45 // Returns the App Store application id for this native app or |nil| if | |
| 46 // app does not have an AppStore ID. | |
| 47 - (NSString*)appId; | |
| 48 | |
| 49 // Returns whether this native app is a Google App. | |
| 50 - (BOOL)isGoogleOwnedApp; | |
| 51 | |
| 52 // Returns whether this native app is installed. | |
| 53 - (BOOL)isInstalled; | |
| 54 | |
| 55 // Returns the URL string that launches Apple AppStore for this app. | |
| 56 - (NSString*)appStoreURL; | |
| 57 | |
| 58 // Returns the URL to test if the app is installed. | |
| 59 - (NSURL*)appURLforURL:(NSURL*)url; | |
| 60 | |
| 61 // Calls |block| with the application icon. |contextGetter| must not be nil. | |
| 62 - (void)fetchSmallIconWithContext:(net::URLRequestContextGetter*)contextGetter | |
| 63 completionBlock:(void (^)(UIImage*))block; | |
| 64 | |
| 65 // Returns whether this native application can open the |url|. | |
| 66 - (BOOL)canOpenURL:(const GURL&)url; | |
| 67 | |
| 68 // Returns the launch URL with which the application can be opened. |gurl| is | |
| 69 // the URL of the content in the web app. If |identity| is not nil, the | |
| 70 // returned URL contains a hash associated with |identity|. | |
| 71 - (GURL)launchURLWithURL:(const GURL&)gurl identity:(ChromeIdentity*)identity; | |
| 72 | |
| 73 // Resets values of shouldBypassInfobars and numberOfDismissedInfoBarsKey. | |
| 74 - (void)resetInfobarHistory; | |
| 75 | |
| 76 // Enumerates the app's registered schemes. The block can be called multiple | |
| 77 // times for the same scheme. | |
| 78 - (void)enumerateSchemesWithBlock:(void (^)(NSString* scheme, BOOL* stop))block; | |
| 79 | |
| 80 // Informs the metadata that user has requested the application to be installed | |
| 81 // from a user interface other than a Google App Launcher infobar. | |
|
rohitrao (ping after 24h)
2016/11/08 12:39:18
Remove "Google App Launcher" from this comment.
sczs1
2016/11/09 01:14:51
Done.
| |
| 82 - (void)updateCounterWithAppInstallation; | |
| 83 | |
| 84 // Returns any of the schemes that the app has registered. | |
| 85 - (NSString*)anyScheme; | |
| 86 | |
| 87 // Returns the additionalData dictionary in GIPApp for unit testing. | |
|
rohitrao (ping after 24h)
2016/11/08 12:39:18
This should not be in the public API. Remove this
sczs1
2016/11/09 01:14:52
Done.
| |
| 88 - (NSDictionary*)additionalData; | |
| 89 | |
| 90 // TODO(sczs) Remove comments once rest of native_app_launcher lands upstream. | |
|
rohitrao (ping after 24h)
2016/11/08 12:39:18
Can this be removed now?
| |
| 91 // This method needs to be called whenever the metadata info is displayed by an | |
| 92 // infobar. | |
| 93 //- (void)willBeShownInInfobarOfType: | |
| 94 // (NativeAppInfoBarDelegate::NativeAppControllerType)type; | |
| 95 // | |
| 96 //// Informs the metadata on what user action on the infobar has been taken. | |
| 97 //// Requires to have previously send the message -[NativeAppMetadata | |
| 98 //// willBeShownInInfobarOfType:]. | |
| 99 //- (void)updateWithUserAction:(NativeAppInfoBarDelegate::UserAction)userAction; | |
| 100 | |
| 101 @end | |
| 102 | |
| 103 #endif // IOS_INTERNAL_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_METADATA_H _ | |
|
rohitrao (ping after 24h)
2016/11/08 12:39:18
Update header guard.
sczs1
2016/11/09 01:14:52
Done.
| |
| OLD | NEW |