Chromium Code Reviews| Index: ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_metadata.mm |
| diff --git a/ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_metadata.mm b/ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_metadata.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b02ef65d3df1bd4b86c4cd192933b1605734afce |
| --- /dev/null |
| +++ b/ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_metadata.mm |
| @@ -0,0 +1,122 @@ |
| +// 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. |
| + |
| +#import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_metadata.h" |
| + |
| +#include "base/mac/scoped_nsobject.h" |
| +#include "base/strings/sys_string_conversions.h" |
| +#include "url/gurl.h" |
| + |
| +@interface FakeNativeAppMetadata () { |
|
sdefresne
2016/11/25 08:41:57
Move to @implementation
|
| + base::scoped_nsobject<NSString> _appName; |
| + base::scoped_nsobject<NSString> _appId; |
| +} |
| +@end |
| + |
| +@implementation FakeNativeAppMetadata |
| + |
| +@synthesize shouldBypassInfoBars = _shouldBypassInfoBars; |
| +@synthesize shouldAutoOpenLinks = _shouldAutoOpenLinks; |
| +@synthesize numberOfDismissedInfoBars = _numberOfDismissedInfoBars; |
| +@synthesize googleOwnedApp = _googleOwnedApp; |
| +@synthesize installed = _installed; |
| + |
| +- (void)unsetShouldAutoOpenLinks { |
| + return; |
| +} |
| + |
| +- (NSString*)appName { |
| + return _appName; |
| +} |
| + |
| +- (void)setAppName:(NSString*)name { |
| + _appName.reset([name copy]); |
| +} |
| + |
| +- (NSString*)appId { |
| + return _appId; |
| +} |
| + |
| +- (void)setAppId:(NSString*)appId { |
| + _appId.reset([appId copy]); |
| +} |
| + |
| +- (BOOL)isGoogleOwnedApp { |
| + return _googleOwnedApp; |
| +} |
| + |
| +- (void)setGoogleOwnedApp:(BOOL)googleOwnedApp { |
|
rohitrao (ping after 24h)
2016/11/25 00:34:38
@synthesize will create this getter and setter for
sdefresne
2016/11/25 08:41:57
And since this is new code, it is recommended that
|
| + _googleOwnedApp = googleOwnedApp; |
| +} |
| + |
| +- (BOOL)isInstalled { |
| + return _installed; |
| +} |
| + |
| +- (void)setInstalled:(BOOL)installed { |
|
rohitrao (ping after 24h)
2016/11/25 00:34:38
Can leave out this getter and setter.
|
| + _installed = installed; |
| +} |
| + |
| +- (NSString*)appStoreURL { |
| + return nil; |
| +} |
| + |
| +- (NSURL*)appURLforURL:(NSURL*)url { |
| + return nil; |
| +} |
| + |
| +- (void)fetchSmallIconWithContext:(net::URLRequestContextGetter*)contextGetter |
| + completionBlock:(void (^)(UIImage*))block { |
| + return; |
|
rohitrao (ping after 24h)
2016/11/25 00:34:38
We should probably call the completion block with
sczs1
2016/11/26 04:10:18
Done.
|
| +} |
| + |
| +- (BOOL)canOpenURL:(const GURL&)url { |
|
rohitrao (ping after 24h)
2016/11/25 00:34:38
How did you come up with the implementation for th
|
| + if (!url.is_valid()) |
| + return YES; |
| + GURL appUrl(base::SysNSStringToUTF8(_appName) + ":"); |
| + if (url.spec() == appUrl.spec()) { |
| + return YES; |
| + } else { |
| + return NO; |
| + } |
| +} |
| + |
| +- (GURL)launchURLWithURL:(const GURL&)gurl identity:(ChromeIdentity*)identity { |
| + return GURL(); |
| +} |
| + |
| +- (void)resetInfobarHistory { |
| + return; |
|
rohitrao (ping after 24h)
2016/11/25 00:34:38
No need to write "return;" for methods that return
sczs1
2016/11/26 04:10:18
Done.
|
| +} |
| + |
| +- (void)enumerateSchemesWithBlock:(void (^)(NSString* scheme, |
| + BOOL* stop))block { |
| + return; |
| +} |
| + |
| +- (void)updateCounterWithAppInstallation { |
| + return; |
| +} |
| + |
| +- (NSString*)anyScheme { |
| + return nil; |
| +} |
| + |
| +- (void)willBeShownInInfobarOfType:(NativeAppControllerType)type { |
| + return; |
| +} |
| + |
| +- (void)updateWithUserAction:(NativeAppActionType)userAction { |
| + return; |
| +} |
| + |
| +- (BOOL)shouldAutoOpenLinks { |
|
rohitrao (ping after 24h)
2016/11/25 00:34:38
Consider ordering these methods to match the order
sdefresne
2016/11/25 08:41:57
This is a property, so you propably don't need to
|
| + return _shouldAutoOpenLinks; |
| +} |
| + |
| +- (void)setShouldAutoOpenLinks:(BOOL)shouldAutoOpenLinks { |
| + _shouldAutoOpenLinks = shouldAutoOpenLinks; |
| +} |
| + |
| +@end |