OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ |
6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ | 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ |
7 | 7 |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "chrome/browser/banners/app_banner_manager.h" | 12 #include "chrome/browser/banners/app_banner_manager.h" |
13 #include "components/infobars/core/confirm_infobar_delegate.h" | 13 #include "components/infobars/core/confirm_infobar_delegate.h" |
14 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class WebContents; | 18 class WebContents; |
19 } | 19 } |
20 | 20 |
21 namespace infobars { | 21 namespace infobars { |
22 class InfoBarManager; | 22 class InfoBarManager; |
23 } | 23 } |
24 | 24 |
25 class AppBannerInfoBar; | 25 class AppBannerInfoBar; |
26 struct ShortcutInfo; | 26 struct ShortcutInfo; |
27 | 27 |
28 namespace banners { | 28 namespace banners { |
29 | 29 |
30 // The states of WebAPK installation process. These states are tracked to | |
31 // record dismiss events for WebAPK installation. | |
32 enum InstallState { | |
dominickn
2016/09/05 07:34:31
This enum should be in webapk_metrics.h
Xi Han
2016/09/07 20:58:52
Done.
| |
33 WAIT_FOR_START, | |
34 INSTALLING, | |
35 INSTALLED, | |
36 }; | |
37 | |
30 // Manages installation of an app being promoted by a page. | 38 // Manages installation of an app being promoted by a page. |
31 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { | 39 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
32 public: | 40 public: |
33 // Delegate for promoting a web app. | 41 // Delegate for promoting a web app. |
34 AppBannerInfoBarDelegateAndroid( | 42 AppBannerInfoBarDelegateAndroid( |
35 base::WeakPtr<AppBannerManager> weak_manager, | 43 base::WeakPtr<AppBannerManager> weak_manager, |
36 const base::string16& app_title, | 44 const base::string16& app_title, |
37 const GURL& manifest_url, | 45 const GURL& manifest_url, |
38 std::unique_ptr<ShortcutInfo> info, | 46 std::unique_ptr<ShortcutInfo> info, |
39 const GURL& icon_url, | 47 const GURL& icon_url, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 GURL icon_url_; | 114 GURL icon_url_; |
107 std::unique_ptr<SkBitmap> icon_; | 115 std::unique_ptr<SkBitmap> icon_; |
108 | 116 |
109 std::string native_app_package_; | 117 std::string native_app_package_; |
110 std::string referrer_; | 118 std::string referrer_; |
111 int event_request_id_; | 119 int event_request_id_; |
112 bool has_user_interaction_; | 120 bool has_user_interaction_; |
113 | 121 |
114 std::string webapk_package_name_; | 122 std::string webapk_package_name_; |
115 bool is_webapk_; | 123 bool is_webapk_; |
124 // Indicates the current state of a WebAPK installation. | |
125 InstallState install_state_; | |
116 | 126 |
117 base::WeakPtrFactory<AppBannerInfoBarDelegateAndroid> weak_ptr_factory_; | 127 base::WeakPtrFactory<AppBannerInfoBarDelegateAndroid> weak_ptr_factory_; |
118 | 128 |
119 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); | 129 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); |
120 }; // AppBannerInfoBarDelegateAndroid | 130 }; // AppBannerInfoBarDelegateAndroid |
121 | 131 |
122 // Register native methods. | 132 // Register native methods. |
123 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); | 133 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); |
124 | 134 |
125 } // namespace banners | 135 } // namespace banners |
126 | 136 |
127 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ | 137 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ |
OLD | NEW |