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

Side by Side Diff: ios/chrome/browser/native_app_launcher/native_app_infobar_delegate.h

Issue 2508663002: [ios] Move NativeAppLauncher upstream (Closed)
Patch Set: CL Feedback Created 4 years 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 unified diff | Download patch
OLDNEW
(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 NativeAppNavigationController;
16 @protocol NativeAppNavigationControllerProtocol;
17 @class NSString;
18 @class UIImage;
19
20 namespace infobars {
21 class InfoBarManager;
22 } // namespace infobars
23
24 namespace net {
25 class URLRequestContextGetter;
26 } // namespace net
27
28 namespace native_app_infobar {
29 extern const CGSize kSmallIconSize;
30 } // namespace native_app_infobar
31
32 // The delegate contains the information to create a
33 // NativeAppInstallerInfoBarView, a NativeAppLauncherInfoBarView or a
34 // NativeAppOpenPolicyInfoBarView.
35 class NativeAppInfoBarDelegate : public infobars::InfoBarDelegate {
36 public:
37 NativeAppInfoBarDelegate(id<NativeAppNavigationControllerProtocol> controller,
38 const GURL& page_url,
39 NativeAppControllerType type);
40 ~NativeAppInfoBarDelegate() override;
41
42 // Creates and adds a native app info bar to |manager|.
43 static bool Create(infobars::InfoBarManager* manager,
44 id<NativeAppNavigationControllerProtocol> controller,
45 const GURL& page_url,
46 NativeAppControllerType type);
47
48 NativeAppInfoBarDelegate* AsNativeAppInfoBarDelegate() override;
49 base::string16 GetInstallText() const;
50 base::string16 GetLaunchText() const;
51 base::string16 GetOpenPolicyText() const;
52 base::string16 GetOpenOnceText() const;
53 base::string16 GetOpenAlwaysText() const;
54 const GURL& GetIconURL() const;
55 NSString* GetAppId() const;
56 infobars::InfoBarDelegate::Type GetInfoBarType() const override;
57 InfoBarIdentifier GetIdentifier() const override;
58 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override;
59 net::URLRequestContextGetter* GetRequestContextGetter();
60 void FetchSmallAppIcon(void (^block)(UIImage*));
61 // This function is made virtual for tests.
62 virtual void UserPerformedAction(NativeAppActionType userAction);
63 NativeAppControllerType GetControllerType() const;
64
65 private:
66 bool ShouldExpire(const NavigationDetails& details) const override;
67 id<NativeAppNavigationControllerProtocol> controller_;
68 net::URLRequestContextGetter* requestContextGetter_;
69 GURL page_url_;
70 NativeAppControllerType type_;
71 DISALLOW_COPY_AND_ASSIGN(NativeAppInfoBarDelegate);
72 };
73
74 #endif // IOS_CHROME_BROWSER_NATIVE_APP_LAUNCHER_NATIVE_APP_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698