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

Unified Diff: chrome/browser/android/banners/app_banner_infobar_delegate.h

Issue 901203003: Redo how AppBannerInfoBars are created and stored (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving init before the early return so that restored tabs also get them Created 5 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/android/banners/app_banner_infobar_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/banners/app_banner_infobar_delegate.h
diff --git a/chrome/browser/android/banners/app_banner_infobar_delegate.h b/chrome/browser/android/banners/app_banner_infobar_delegate.h
index 01fddc6e832d1f4bc8902c744febdf2b52d3b15e..5bc2e0a8ec9ccc43bb8a0ebbc69e9d39a58d8158 100644
--- a/chrome/browser/android/banners/app_banner_infobar_delegate.h
+++ b/chrome/browser/android/banners/app_banner_infobar_delegate.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_H_
+#include "base/android/scoped_java_ref.h"
#include "base/strings/string16.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "ui/gfx/image/image.h"
@@ -14,6 +15,8 @@ namespace infobars {
class InfoBarManager;
} // namespace infobars
+class AppBannerInfoBar;
+
namespace banners {
// Displays information about an app being promoted by a webpage.
@@ -26,26 +29,29 @@ class AppBannerInfoBarDelegate : public ConfirmInfoBarDelegate {
// User has elected to block the banner from being displayed.
virtual void Block() const = 0;
- // User has requested that the app be installed.
- virtual void Install() const = 0;
+ // User has clicked the button.
+ // Returns true if the infobar should be dismissed.
+ virtual bool OnButtonClicked() const = 0;
+
+ // Called when the infobar has been destroyed.
+ virtual void OnInfoBarDestroyed() = 0;
+
+ // Returns the title of the app.
+ virtual base::string16 GetTitle() const = 0;
- // Icon to display for the app.
+ // Returns the icon to display for the app.
virtual gfx::Image GetIcon() const = 0;
};
- // Creates a banner for the current page.
+ // Creates a banner for the current page that promotes a web app.
// May return nullptr if the the infobar couldn't be created.
- static infobars::InfoBar* CreateForWebApp(
+ static AppBannerInfoBar* CreateForWebApp(
infobars::InfoBarManager* infobar_manager,
- const AppDelegate* delegate,
- const base::string16& app_title,
+ AppDelegate* delegate,
const GURL& url);
~AppBannerInfoBarDelegate() override;
- // Changes the label of the button.
- void SetButtonLabel(const std::string& button_text);
-
// InfoBarDelegate overrides.
gfx::Image GetIcon() const override;
void InfoBarDismissed() override;
@@ -53,19 +59,12 @@ class AppBannerInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate overrides.
base::string16 GetMessageText() const override;
int GetButtons() const override;
- base::string16 GetButtonLabel(InfoBarButton button) const override;
bool Accept() override;
private:
- // Constructor for a banner for web apps.
- AppBannerInfoBarDelegate(const AppDelegate* helper,
- const base::string16& app_title,
- const GURL& url);
-
- const AppDelegate* delegate_;
- base::string16 app_title_;
- GURL url_;
- base::string16 button_text_;
+ explicit AppBannerInfoBarDelegate(AppDelegate* delegate);
+
+ AppDelegate* delegate_;
DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegate);
}; // AppBannerInfoBarDelegate
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/android/banners/app_banner_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698