| 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_PUBLIC_PROVIDER_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_METADA
TA_H_ |
| 6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_METADA
TA_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_types
.h" |
| 11 |
| 12 @class ChromeIdentity; |
| 13 class GURL; |
| 14 @class UIImage; |
| 15 |
| 16 namespace net { |
| 17 class URLRequestContextGetter; |
| 18 } |
| 19 |
| 20 // Protocol todo describe |
| 21 @protocol NativeAppMetadata<NSObject> |
| 22 |
| 23 // Defines whether the app should be opened automatically upon Link Navigation. |
| 24 // This is a tri-state value internally: Yes, No, not set. However, externally, |
| 25 // only the Yes/No state is returned via the property getter. If the internal |
| 26 // value is "not set", then it is up to the current implementation to decide |
| 27 // whether it should be treated as a YES or a NO. The property setter can set |
| 28 // the value to either YES or NO. To set the value to "not set", use |
| 29 // -unsetShouldAutoOpenLinks. |
| 30 @property(nonatomic, assign) BOOL shouldAutoOpenLinks; |
| 31 |
| 32 // Method to set shouldAutoOpenLinks property to "not set". |
| 33 - (void)unsetShouldAutoOpenLinks; |
| 34 |
| 35 // Defines whether infobars for this app should be bypassed. |
| 36 @property(nonatomic, assign) BOOL shouldBypassInfoBars; |
| 37 |
| 38 // Stores the number of times a banner is dismissed or ignored. |
| 39 @property(nonatomic, assign) NSInteger numberOfDismissedInfoBars; |
| 40 |
| 41 // Returns the application name for this native app. If there is a localized |
| 42 // name for the current locale, return the localized name. Otherwise, return |
| 43 // the default application name. |
| 44 - (NSString*)appName; |
| 45 |
| 46 // Returns the App Store application id for this native app or |nil| if |
| 47 // app does not have an AppStore ID. |
| 48 - (NSString*)appId; |
| 49 |
| 50 // Returns whether this native app is a Google App. |
| 51 - (BOOL)isGoogleOwnedApp; |
| 52 |
| 53 // Returns whether this native app is installed. |
| 54 - (BOOL)isInstalled; |
| 55 |
| 56 // Returns the URL string that launches Apple AppStore for this app. |
| 57 - (NSString*)appStoreURL; |
| 58 |
| 59 // Returns the URL to test if the app is installed. |
| 60 - (NSURL*)appURLforURL:(NSURL*)url; |
| 61 |
| 62 // Calls |block| with the application icon. |contextGetter| must not be nil. |
| 63 - (void)fetchSmallIconWithContext:(net::URLRequestContextGetter*)contextGetter |
| 64 completionBlock:(void (^)(UIImage*))block; |
| 65 |
| 66 // Returns whether this native application can open the |url|. |
| 67 - (BOOL)canOpenURL:(const GURL&)url; |
| 68 |
| 69 // Returns the launch URL with which the application can be opened. |gurl| is |
| 70 // the URL of the content in the web app. If |identity| is not nil, the |
| 71 // returned URL contains a hash associated with |identity|. |
| 72 - (GURL)launchURLWithURL:(const GURL&)gurl identity:(ChromeIdentity*)identity; |
| 73 |
| 74 // Resets values of shouldBypassInfobars and numberOfDismissedInfoBarsKey. |
| 75 - (void)resetInfobarHistory; |
| 76 |
| 77 // Enumerates the app's registered schemes. The block can be called multiple |
| 78 // times for the same scheme. |
| 79 - (void)enumerateSchemesWithBlock:(void (^)(NSString* scheme, BOOL* stop))block; |
| 80 |
| 81 // Informs the metadata that user has requested the application to be installed |
| 82 // from a user interface other than a Launcher infobar. |
| 83 - (void)updateCounterWithAppInstallation; |
| 84 |
| 85 // Returns any of the schemes that the app has registered. |
| 86 - (NSString*)anyScheme; |
| 87 |
| 88 // This method needs to be called whenever the metadata info is displayed by an |
| 89 // infobar. |
| 90 - (void)willBeShownInInfobarOfType:(NativeAppControllerType)type; |
| 91 |
| 92 // Informs the metadata on what user action on the infobar has been taken. |
| 93 // Requires to have previously send the message -[NativeAppMetadata |
| 94 // willBeShownInInfobarOfType:]. |
| 95 - (void)updateWithUserAction:(NativeAppActionType)userAction; |
| 96 |
| 97 @end |
| 98 |
| 99 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_MET
ADATA_H_ |
| OLD | NEW |