Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_INFOBAR_DELEGATE_H_ | |
| 6 #define IOS_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_INFOBAR_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/strings/string16.h" | |
| 10 #include "components/infobars/core/infobar_delegate.h" | |
| 11 #include "ios/chrome/browser/infobars/infobar.h" | |
| 12 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_types .h" | |
| 13 #include "url/gurl.h" | |
| 14 | |
| 15 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.
| |
| 16 @class NativeAppNavigationController; | |
| 17 @protocol NativeAppNavigationControllerProtocol; | |
| 18 @class NSString; | |
| 19 @class UIImage; | |
| 20 namespace infobars { | |
| 21 class InfoBarManager; | |
| 22 } | |
|
sdefresne
2016/11/17 06:24:26
For consistency, add "// namespace infobars" here
sczs1
2016/11/18 23:42:49
Done.
| |
| 23 namespace net { | |
| 24 class URLRequestContextGetter; | |
| 25 } // namespace net | |
| 26 | |
| 27 namespace native_app_infobar { | |
| 28 extern const CGSize kSmallIconSize; | |
| 29 } // namespace native_app_infobar | |
| 30 | |
| 31 // The delegate contains the information to create a | |
| 32 // NativeAppInstallerInfoBarView, a NativeAppLauncherInfoBarView or a | |
| 33 // NativeAppOpenPolicyInfoBarView. | |
| 34 class NativeAppInfoBarDelegate : public infobars::InfoBarDelegate { | |
| 35 public: | |
| 36 NativeAppInfoBarDelegate(id<NativeAppNavigationControllerProtocol> controller, | |
| 37 const GURL& pageURL, | |
| 38 NativeAppControllerType type); | |
| 39 ~NativeAppInfoBarDelegate() override; | |
| 40 | |
| 41 // Creates and adds a native app info bar to |manager|. | |
| 42 static bool Create(infobars::InfoBarManager* manager, | |
| 43 id<NativeAppNavigationControllerProtocol> controller, | |
| 44 const GURL& pageURL, | |
| 45 NativeAppControllerType type); | |
| 46 | |
| 47 NativeAppInfoBarDelegate* AsNativeAppInfoBarDelegate() override; | |
| 48 base::string16 GetInstallText() const; | |
| 49 base::string16 GetLaunchText() const; | |
| 50 base::string16 GetOpenPolicyText() const; | |
| 51 base::string16 GetOpenOnceText() const; | |
| 52 base::string16 GetOpenAlwaysText() const; | |
| 53 const GURL& GetIconURL() const; | |
| 54 NSString* GetAppId() const; | |
| 55 infobars::InfoBarDelegate::Type GetInfoBarType() const override; | |
| 56 InfoBarIdentifier GetIdentifier() const override; | |
| 57 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; | |
| 58 net::URLRequestContextGetter* GetRequestContextGetter(); | |
| 59 void FetchSmallAppIcon(void (^block)(UIImage*)); | |
| 60 // This function is made virtual for tests. | |
| 61 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.
| |
| 62 NativeAppControllerType GetControllerType() const; | |
| 63 | |
| 64 private: | |
| 65 bool ShouldExpire(const NavigationDetails& details) const override; | |
| 66 id<NativeAppNavigationControllerProtocol> controller_; | |
| 67 net::URLRequestContextGetter* requestContextGetter_; | |
| 68 GURL pageURL_; | |
| 69 NativeAppControllerType type_; | |
| 70 DISALLOW_COPY_AND_ASSIGN(NativeAppInfoBarDelegate); | |
| 71 }; | |
| 72 | |
| 73 #endif // IOS_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |