Chromium Code Reviews| 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/19 01:38:39
Nit: call this WebApkInstallState, and change the
Xi Han
2016/09/20 18:25:18
Done.
| |
| 33 WAIT_FOR_START, | |
|
dominickn
2016/09/19 01:38:39
Nit: "INSTALL_NOT_STARTED"?
Xi Han
2016/09/20 18:25:18
Done.
| |
| 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 // Creates an infobar and delegate for promoting the installation of a web | 41 // Creates an infobar and delegate for promoting the installation of a web |
| 34 // app, and adds the infobar to the InfoBarManager for |web_contents|. | 42 // app, and adds the infobar to the InfoBarManager for |web_contents|. |
| 35 static bool Create( | 43 static bool Create( |
| 36 content::WebContents* web_contents, | 44 content::WebContents* web_contents, |
| 37 base::WeakPtr<AppBannerManager> weak_manager, | 45 base::WeakPtr<AppBannerManager> weak_manager, |
| 38 const base::string16& app_title, | 46 const base::string16& app_title, |
| 39 std::unique_ptr<ShortcutInfo> info, | 47 std::unique_ptr<ShortcutInfo> info, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 | 133 |
| 126 std::unique_ptr<SkBitmap> icon_; | 134 std::unique_ptr<SkBitmap> icon_; |
| 127 | 135 |
| 128 std::string native_app_package_; | 136 std::string native_app_package_; |
| 129 std::string referrer_; | 137 std::string referrer_; |
| 130 int event_request_id_; | 138 int event_request_id_; |
| 131 bool has_user_interaction_; | 139 bool has_user_interaction_; |
| 132 | 140 |
| 133 std::string webapk_package_name_; | 141 std::string webapk_package_name_; |
| 134 bool is_webapk_; | 142 bool is_webapk_; |
| 143 // Indicates the current state of a WebAPK installation. | |
|
dominickn
2016/09/19 01:38:39
Nit: add a newline above the comment.
Xi Han
2016/09/20 18:25:18
Done.
| |
| 144 InstallState install_state_; | |
| 135 | 145 |
| 136 base::WeakPtrFactory<AppBannerInfoBarDelegateAndroid> weak_ptr_factory_; | 146 base::WeakPtrFactory<AppBannerInfoBarDelegateAndroid> weak_ptr_factory_; |
| 137 | 147 |
| 138 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); | 148 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); |
| 139 }; | 149 }; |
| 140 | 150 |
| 141 // Register native methods. | 151 // Register native methods. |
| 142 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); | 152 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); |
| 143 | 153 |
| 144 } // namespace banners | 154 } // namespace banners |
| 145 | 155 |
| 146 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ | 156 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ |
| OLD | NEW |