Chromium Code Reviews| Index: ios/chrome/browser/native_app_launcher/native_app_infobar_delegate.h |
| diff --git a/ios/chrome/browser/native_app_launcher/native_app_infobar_delegate.h b/ios/chrome/browser/native_app_launcher/native_app_infobar_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0a2e4aee0f9e11673aa5b7972f6a5c5493badb0b |
| --- /dev/null |
| +++ b/ios/chrome/browser/native_app_launcher/native_app_infobar_delegate.h |
| @@ -0,0 +1,73 @@ |
| +// Copyright 2013 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_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_INFOBAR_DELEGATE_H_ |
| +#define IOS_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_INFOBAR_DELEGATE_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/strings/string16.h" |
| +#include "components/infobars/core/infobar_delegate.h" |
| +#include "ios/chrome/browser/infobars/infobar.h" |
| +#import "ios/public/provider/chrome/browser/native_app_launcher/native_app_types.h" |
| +#include "url/gurl.h" |
| + |
| +class GURL; |
|
sdefresne
2016/11/17 06:24:26
Remove either this forward-declaration or the incl
sczs1
2016/11/18 23:42:49
Done.
|
| +@class NativeAppNavigationController; |
| +@protocol NativeAppNavigationControllerProtocol; |
| +@class NSString; |
| +@class UIImage; |
| +namespace infobars { |
| +class InfoBarManager; |
| +} |
|
sdefresne
2016/11/17 06:24:26
For consistency, add "// namespace infobars" here
sczs1
2016/11/18 23:42:49
Done.
|
| +namespace net { |
| +class URLRequestContextGetter; |
| +} // namespace net |
| + |
| +namespace native_app_infobar { |
| +extern const CGSize kSmallIconSize; |
| +} // namespace native_app_infobar |
| + |
| +// The delegate contains the information to create a |
| +// NativeAppInstallerInfoBarView, a NativeAppLauncherInfoBarView or a |
| +// NativeAppOpenPolicyInfoBarView. |
| +class NativeAppInfoBarDelegate : public infobars::InfoBarDelegate { |
| + public: |
| + NativeAppInfoBarDelegate(id<NativeAppNavigationControllerProtocol> controller, |
| + const GURL& pageURL, |
| + NativeAppControllerType type); |
| + ~NativeAppInfoBarDelegate() override; |
| + |
| + // Creates and adds a native app info bar to |manager|. |
| + static bool Create(infobars::InfoBarManager* manager, |
| + id<NativeAppNavigationControllerProtocol> controller, |
| + const GURL& pageURL, |
| + NativeAppControllerType type); |
| + |
| + NativeAppInfoBarDelegate* AsNativeAppInfoBarDelegate() override; |
| + base::string16 GetInstallText() const; |
| + base::string16 GetLaunchText() const; |
| + base::string16 GetOpenPolicyText() const; |
| + base::string16 GetOpenOnceText() const; |
| + base::string16 GetOpenAlwaysText() const; |
| + const GURL& GetIconURL() const; |
| + NSString* GetAppId() const; |
| + infobars::InfoBarDelegate::Type GetInfoBarType() const override; |
| + InfoBarIdentifier GetIdentifier() const override; |
| + bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; |
| + net::URLRequestContextGetter* GetRequestContextGetter(); |
| + void FetchSmallAppIcon(void (^block)(UIImage*)); |
| + // This function is made virtual for tests. |
| + virtual void UserPerformedAction(NativeAppActionType userAction); |
|
sdefresne
2016/11/17 06:24:26
Where are the tests? Can they also be upstreamed?
sczs1
2016/11/18 23:42:49
They have now been upstreamed.
|
| + NativeAppControllerType GetControllerType() const; |
| + |
| + private: |
| + bool ShouldExpire(const NavigationDetails& details) const override; |
| + id<NativeAppNavigationControllerProtocol> controller_; |
| + net::URLRequestContextGetter* requestContextGetter_; |
| + GURL pageURL_; |
| + NativeAppControllerType type_; |
| + DISALLOW_COPY_AND_ASSIGN(NativeAppInfoBarDelegate); |
| +}; |
| + |
| +#endif // IOS_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_INFOBAR_DELEGATE_H_ |