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

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

Issue 914813002: [App banners] Start addressing race conditions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing, split off the important unit tests 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
Index: chrome/browser/android/banners/app_banner_manager.h
diff --git a/chrome/browser/android/banners/app_banner_manager.h b/chrome/browser/android/banners/app_banner_manager.h
index 9a8520c269cc211d55bc5a8b3c2a3de6dd8d09e0..109b42c0fb4ffc69790821ee73145f7bd4f4cd6b 100644
--- a/chrome/browser/android/banners/app_banner_manager.h
+++ b/chrome/browser/android/banners/app_banner_manager.h
@@ -27,6 +27,8 @@ namespace infobars {
class InfoBar;
} // namspace infobars
+class BannerBitmapFetcher;
benwells 2015/02/16 01:58:43 Nit: I think it is nicer to put this inside AppBan
gone 2015/02/17 22:56:52 Done.
+
/**
* Manages when an app banner is created or dismissed.
*
@@ -67,8 +69,7 @@ class InfoBar;
namespace banners {
-class AppBannerManager : public chrome::BitmapFetcherDelegate,
- public content::WebContentsObserver {
+class AppBannerManager : public content::WebContentsObserver {
public:
AppBannerManager(JNIEnv* env, jobject obj);
~AppBannerManager() override;
@@ -94,6 +95,11 @@ class AppBannerManager : public chrome::BitmapFetcherDelegate,
// Returns |false| if this couldn't be kicked off.
bool FetchIcon(const GURL& image_url);
+ // Called when everything required to show a banner is ready.
+ void OnFetchComplete(BannerBitmapFetcher* fetcher,
+ const GURL url,
+ const SkBitmap* icon);
+
// Return how many fetchers are active.
int GetNumActiveFetchers(JNIEnv* env, jobject jobj);
@@ -108,9 +114,6 @@ class AppBannerManager : public chrome::BitmapFetcherDelegate,
const GURL& validated_url) override;
bool OnMessageReceived(const IPC::Message& message) override;
- // BitmapFetcherDelegate overrides.
- void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override;
-
private:
// Gets the preferred icon size for the banner icons.
int GetPreferredIconSize();
@@ -139,7 +142,9 @@ class AppBannerManager : public chrome::BitmapFetcherDelegate,
bool CheckIfShouldShow(const std::string& package_or_start_url);
// Fetches the icon for an app.
- scoped_ptr<chrome::BitmapFetcher> fetcher_;
+ typedef std::vector<BannerBitmapFetcher*> BitmapFetcherVector;
+ BitmapFetcherVector active_fetchers_;
+
GURL validated_url_;
GURL app_icon_url_;

Powered by Google App Engine
This is Rietveld 408576698