Chromium Code Reviews| Index: ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.mm |
| diff --git a/ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.mm b/ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ebefcdd798fdb25679831d88fe3568ed7396b934 |
| --- /dev/null |
| +++ b/ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.mm |
| @@ -0,0 +1,53 @@ |
| +// 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_whitelist_manager.h" |
| + |
| +#include "base/mac/scoped_nsobject.h" |
| +#include "url/gurl.h" |
| + |
| +@interface FakeNativeAppWhitelistManager () { |
| + base::scoped_nsprotocol<id<NativeAppMetadata, NSObject>> _metadata; |
|
rohitrao (ping after 24h)
2016/11/25 00:34:39
Is the NSObject necessary? The NativeAppMetadata
sdefresne
2016/11/25 08:41:58
You should use ARC for new code and not use scoped
sczs1
2016/11/26 04:10:18
Without the NSObject I wasn't able to call retain
|
| + base::scoped_nsobject<NSArray> _appWhitelist; |
| +} |
| +@end |
| + |
| +@implementation FakeNativeAppWhitelistManager |
| + |
| +- (instancetype)initWithMetadata:(id<NativeAppMetadata, NSObject>)metadata { |
|
rohitrao (ping after 24h)
2016/11/25 00:34:38
Should be able to leave out the NSObject.
sczs1
2016/11/26 04:10:18
Acknowledged.
|
| + self = [super init]; |
| + if (self) { |
| + _metadata.reset([metadata retain]); |
| + } |
| + return self; |
| +} |
| + |
| +- (void)setAppList:(NSArray*)appList |
| + tldList:(NSArray*)tldList |
| + acceptStoreIDs:(NSArray*)storeIDs { |
| + _appWhitelist.reset([appList retain]); |
| +} |
| + |
| +- (id<NativeAppMetadata>)newNativeAppForURL:(const GURL&)url { |
| + return [_metadata retain]; |
| +} |
| + |
| +- (NSArray*)filteredAppsUsingBlock:(NativeAppFilter)condition { |
| + return _appWhitelist; |
| +} |
| + |
| +- (NSURL*)schemeForAppId:(NSString*)appId { |
| + return nil; |
| +} |
| + |
| +- (void)checkInstalledApps { |
| + return; |
|
rohitrao (ping after 24h)
2016/11/25 00:34:39
No need for "return;".
sczs1
2016/11/26 04:10:18
Done.
|
| +} |
| + |
| +// Metadata property getter. |
| +- (id<NativeAppMetadata, NSObject>)metadata { |
|
rohitrao (ping after 24h)
2016/11/25 00:34:38
Should be able to leave out the NSObject.
sczs1
2016/11/26 04:10:18
Acknowledged.
|
| + return _metadata; |
| +} |
| + |
| +@end |