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

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: Use new Enums, Feedback 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..349a5bdfcf2ac95e0ced90ff598a0136e44df827
--- /dev/null
+++ b/ios/public/provider/chrome/browser/native_app_launcher/native_app_metadata.h
@@ -0,0 +1,99 @@
+// 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_PUBLIC_PROVIDER_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_METADATA_H_
+#define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_METADATA_H_
+
+#import <Foundation/Foundation.h>
+
+#import "ios/public/provider/chrome/browser/native_app_launcher/native_app_types.h"
+
+@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;
+
+// Method to set shouldAutoOpenLinks property to "not set".
+- (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 Launcher infobar.
+- (void)updateCounterWithAppInstallation;
+
+// Returns any of the schemes that the app has registered.
+- (NSString*)anyScheme;
+
+// This method needs to be called whenever the metadata info is displayed by an
+// infobar.
+- (void)willBeShownInInfobarOfType:(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:(NativeAppActionType)userAction;
+
+@end
+
+#endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_METADATA_H_

Powered by Google App Engine
This is Rietveld 408576698