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

Unified Diff: ios/public/provider/chrome/browser/native_app_launcher/native_app_metadata.h

Issue 2464963004: [ios] Adds protocols for native app launching (Closed)
Patch Set: Downstream compatibility Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ios/public/provider/chrome/browser/native_app_launcher/native_app_metadata.h
diff --git a/ios/public/provider/chrome/browser/native_app_launcher/native_app_metadata.h b/ios/public/provider/chrome/browser/native_app_launcher/native_app_metadata.h
new file mode 100644
index 0000000000000000000000000000000000000000..c7f1f55051a0f3addcd9b79c8cb7e5efd9f3d357
--- /dev/null
+++ b/ios/public/provider/chrome/browser/native_app_launcher/native_app_metadata.h
@@ -0,0 +1,103 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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.
+#define IOS_INTERNAL_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_METADATA_H_
+
+#import <Foundation/Foundation.h>
+
+//#include
+// 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
+// native_app_launcher lands upstream.
+
+@class ChromeIdentity;
+class GURL;
+@class UIImage;
+
+namespace net {
+class URLRequestContextGetter;
+}
+
+// Protocol todo describe
+@protocol NativeAppMetadata<NSObject>
+
+// Defines whether the app should be opened automatically upon Link Navigation.
+// This is a tri-state value internally: Yes, No, not set. However, externally,
+// only the Yes/No state is returned via the property getter. If the internal
+// value is "not set", then it is up to the current implementation to decide
+// whether it should be treated as a YES or a NO. The property setter can set
+// the value to either YES or NO. To set the value to "not set", use
+// -unsetShouldAutoOpenLinks.
+@property(nonatomic, assign) BOOL shouldAutoOpenLinks;
+- (void)unsetShouldAutoOpenLinks;
+
+// Defines whether infobars for this app should be bypassed.
+@property(nonatomic, assign) BOOL shouldBypassInfoBars;
+// Stores the number of times a banner is dismissed or ignored.
+@property(nonatomic, assign) NSInteger numberOfDismissedInfoBars;
+
+// Returns the application name for this native app. If there is a localized
+// name for the current locale, return the localized name. Otherwise, return
+// the default application name.
+- (NSString*)appName;
+
+// Returns the App Store application id for this native app or |nil| if
+// app does not have an AppStore ID.
+- (NSString*)appId;
+
+// Returns whether this native app is a Google App.
+- (BOOL)isGoogleOwnedApp;
+
+// Returns whether this native app is installed.
+- (BOOL)isInstalled;
+
+// Returns the URL string that launches Apple AppStore for this app.
+- (NSString*)appStoreURL;
+
+// Returns the URL to test if the app is installed.
+- (NSURL*)appURLforURL:(NSURL*)url;
+
+// Calls |block| with the application icon. |contextGetter| must not be nil.
+- (void)fetchSmallIconWithContext:(net::URLRequestContextGetter*)contextGetter
+ completionBlock:(void (^)(UIImage*))block;
+
+// Returns whether this native application can open the |url|.
+- (BOOL)canOpenURL:(const GURL&)url;
+
+// Returns the launch URL with which the application can be opened. |gurl| is
+// the URL of the content in the web app. If |identity| is not nil, the
+// returned URL contains a hash associated with |identity|.
+- (GURL)launchURLWithURL:(const GURL&)gurl identity:(ChromeIdentity*)identity;
+
+// Resets values of shouldBypassInfobars and numberOfDismissedInfoBarsKey.
+- (void)resetInfobarHistory;
+
+// Enumerates the app's registered schemes. The block can be called multiple
+// times for the same scheme.
+- (void)enumerateSchemesWithBlock:(void (^)(NSString* scheme, BOOL* stop))block;
+
+// Informs the metadata that user has requested the application to be installed
+// 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.
+- (void)updateCounterWithAppInstallation;
+
+// Returns any of the schemes that the app has registered.
+- (NSString*)anyScheme;
+
+// 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.
+- (NSDictionary*)additionalData;
+
+// 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?
+// This method needs to be called whenever the metadata info is displayed by an
+// infobar.
+//- (void)willBeShownInInfobarOfType:
+// (NativeAppInfoBarDelegate::NativeAppControllerType)type;
+//
+//// Informs the metadata on what user action on the infobar has been taken.
+//// Requires to have previously send the message -[NativeAppMetadata
+//// willBeShownInInfobarOfType:].
+//- (void)updateWithUserAction:(NativeAppInfoBarDelegate::UserAction)userAction;
+
+@end
+
+#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.

Powered by Google App Engine
This is Rietveld 408576698