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

Unified Diff: chrome/browser/android/webapk/webapk_installer.h

Issue 2676863002: Update WebApkInstaller to support badge icon in installation. (Closed)
Patch Set: Revert git cl format Created 3 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/webapk/webapk_installer.h
diff --git a/chrome/browser/android/webapk/webapk_installer.h b/chrome/browser/android/webapk/webapk_installer.h
index bfb925f0d7c94f63eb2d7b84d07cb2affb65d77f..dd51109fd5a8cf2d4d0661416f3c3ccbedda7073 100644
--- a/chrome/browser/android/webapk/webapk_installer.h
+++ b/chrome/browser/android/webapk/webapk_installer.h
@@ -53,7 +53,8 @@ class WebApkInstaller : public net::URLFetcherDelegate {
// or failed.
static void InstallAsync(content::BrowserContext* context,
const ShortcutInfo& shortcut_info,
- const SkBitmap& shortcut_icon,
+ const SkBitmap& primary_icon,
+ const SkBitmap& badge_icon,
const FinishCallback& finish_callback);
// Creates a self-owned WebApkInstaller instance and talks to the Chrome
@@ -63,7 +64,7 @@ class WebApkInstaller : public net::URLFetcherDelegate {
static void UpdateAsync(
content::BrowserContext* context,
const ShortcutInfo& shortcut_info,
- const SkBitmap& shortcut_icon,
+ const SkBitmap& primary_icon,
const std::string& webapk_package,
int webapk_version,
const std::map<std::string, std::string>& icon_url_to_murmur2_hash,
@@ -95,6 +96,7 @@ class WebApkInstaller : public net::URLFetcherDelegate {
// Creates a WebApk install or update request.
// Should be used only for testing.
+ // TODO
dominickn 2017/02/23 02:08:52 TODO what?
F 2017/03/30 18:20:12 Oops.
void BuildWebApkProtoInBackgroundForTesting(
const base::Callback<void(std::unique_ptr<webapk::WebApk>)>& callback,
const std::map<std::string, std::string>& icon_url_to_murmur2_hash,
@@ -106,7 +108,8 @@ class WebApkInstaller : public net::URLFetcherDelegate {
protected:
WebApkInstaller(content::BrowserContext* browser_context,
const ShortcutInfo& shortcut_info,
- const SkBitmap& shortcut_icon);
+ const SkBitmap& primary_icon,
+ const SkBitmap& badge_icon);
// Starts installation of the downloaded WebAPK. Returns whether the install
// could be started. The installation may still fail if true is returned.
@@ -168,11 +171,20 @@ class WebApkInstaller : public net::URLFetcherDelegate {
// net::URLFetcherDelegate:
void OnURLFetchComplete(const net::URLFetcher* source) override;
- // Downloads app icon in order to compute Murmur2 hash.
- void DownloadAppIconAndComputeMurmur2Hash();
+ // Downloads primary icon and computes its Murmur2 hash.
+ void DownloadPrimaryIconAndComputeMurmur2Hash();
- // Called with the computed Murmur2 hash for the app icon.
- void OnGotIconMurmur2Hash(const std::string& icon_murmur2_hash);
+ // Called with the computed Murmur2 hash for the primary icon.
+ void OnGotPrimaryIconMurmur2Hash(const std::string& primary_icon_hash);
+
+ // Downloads badge icon and computes its Murmur2 hash.
+ void DownloadBadgeIconAndComputeMurmur2Hash();
+
+ // Called with the computed Murmur2 hash for the badge icon.
+ void OnGotBadgeIconMurmur2Hash(const std::string& badge_icon_hash);
+
+ // Maps icon URLs to Murmur2 hashes.
+ void MapIconUrlToMurmur2Hash();
// Sends request to WebAPK server to create WebAPK. During a successful
// request the WebAPK server responds with the URL of the generated WebAPK.
@@ -254,8 +266,13 @@ class WebApkInstaller : public net::URLFetcherDelegate {
// Web Manifest info.
const ShortcutInfo shortcut_info_;
- // WebAPK app icon.
- const SkBitmap shortcut_icon_;
+ // WebAPK primary icon & its Murmur2 hash.
+ const SkBitmap primary_icon_;
+ std::string primary_icon_hash_;
+
+ // WebAPK badge icon & its Murmur2 hash.
+ const SkBitmap badge_icon_;
+ std::string badge_icon_hash_;
// WebAPK server URL.
GURL server_url_;

Powered by Google App Engine
This is Rietveld 408576698