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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java

Issue 2263673003: Pass icon and icon murmur2 hash to WebApkInstaller when updating WebAPKs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pkotwicz@'s comments. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 package org.chromium.chrome.browser.webapps; 5 package org.chromium.chrome.browser.webapps;
6 6
7 import android.content.pm.PackageInfo; 7 import android.content.pm.PackageInfo;
8 import android.content.pm.PackageManager; 8 import android.content.pm.PackageManager;
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 storage.updateTimeOfLastCheckForUpdatedWebManife st(); 59 storage.updateTimeOfLastCheckForUpdatedWebManife st();
60 } 60 }
61 } 61 }
62 } 62 }
63 }; 63 };
64 WebappRegistry.getWebappDataStorage( 64 WebappRegistry.getWebappDataStorage(
65 ContextUtils.getApplicationContext(), info.id(), callback); 65 ContextUtils.getApplicationContext(), info.id(), callback);
66 } 66 }
67 67
68 @Override 68 @Override
69 public void onUpgradeNeededCheckFinished(boolean needsUpgrade, WebappInfo ne wInfo) { 69 public void onUpgradeNeededCheckFinished(boolean needsUpgrade,
70 if (needsUpgrade) updateAsync(newInfo); 70 ManifestUpgradeDetector.FetchedManifestData data) {
71 if (needsUpgrade) updateAsync(data);
71 if (mUpgradeDetector != null) { 72 if (mUpgradeDetector != null) {
72 mUpgradeDetector.destroy(); 73 mUpgradeDetector.destroy();
73 } 74 }
74 mUpgradeDetector = null; 75 mUpgradeDetector = null;
75 } 76 }
76 77
77 /** 78 /**
78 * Sends request to WebAPK Server to update WebAPK. 79 * Sends request to WebAPK Server to update WebAPK.
79 * @param webappInfo The new fetched Web Manifest data of the WebAPK.
80 */ 80 */
81 public void updateAsync(WebappInfo webappInfo) { 81 public void updateAsync(ManifestUpgradeDetector.FetchedManifestData data) {
82 int webApkVersion = getVersionFromMetaData(webappInfo.webApkPackageName( )); 82 String packageName = mUpgradeDetector.getWebApkPackageName();
83 nativeUpdateAsync(webappInfo.uri().toString(), webappInfo.scopeUri().toS tring(), 83 int webApkVersion = getVersionFromMetaData(packageName);
84 webappInfo.name(), webappInfo.shortName(), "", webappInfo.icon() , 84 nativeUpdateAsync(data.startUrl, data.scopeUrl, data.name, data.shortNam e, data.iconUrl,
85 webappInfo.displayMode(), webappInfo.orientation(), webappInfo.t hemeColor(), 85 Long.toString(data.iconMurmur2Hash), data.icon, data.displayMode , data.orientation,
86 webappInfo.backgroundColor(), mUpgradeDetector.getManifestUrl(), 86 data.themeColor, data.backgroundColor, mUpgradeDetector.getManif estUrl(),
87 webappInfo.webApkPackageName(), webApkVersion); 87 packageName, webApkVersion);
88 } 88 }
89 89
90 public void destroy() { 90 public void destroy() {
91 if (mUpgradeDetector != null) { 91 if (mUpgradeDetector != null) {
92 mUpgradeDetector.destroy(); 92 mUpgradeDetector.destroy();
93 } 93 }
94 mUpgradeDetector = null; 94 mUpgradeDetector = null;
95 } 95 }
96 96
97 private static int getVersionFromMetaData(String webApkPackage) { 97 private static int getVersionFromMetaData(String webApkPackage) {
(...skipping 21 matching lines...) Expand all
119 public void onWebappDataStorageRetrieved(WebappDataStorage s torage) { 119 public void onWebappDataStorageRetrieved(WebappDataStorage s torage) {
120 // Update the request time and result together. It preve nts getting a 120 // Update the request time and result together. It preve nts getting a
121 // correct request time but a result from the previous r equest. 121 // correct request time but a result from the previous r equest.
122 storage.updateTimeOfLastWebApkUpdateRequestCompletion(); 122 storage.updateTimeOfLastWebApkUpdateRequestCompletion();
123 storage.updateDidLastWebApkUpdateRequestSucceed(success) ; 123 storage.updateDidLastWebApkUpdateRequestSucceed(success) ;
124 } 124 }
125 }); 125 });
126 } 126 }
127 127
128 private static native void nativeUpdateAsync(String startUrl, String scope, String name, 128 private static native void nativeUpdateAsync(String startUrl, String scope, String name,
129 String shortName, String iconUrl, Bitmap icon, int displayMode, int orientation, 129 String shortName, String iconUrl, String iconMurmur2Hash, Bitmap ico n, int displayMode,
130 long themeColor, long backgroundColor, String manifestUrl, String we bApkPackage, 130 int orientation, long themeColor, long backgroundColor, String manif estUrl,
131 int webApkVersion); 131 String webApkPackage, int webApkVersion);
132 } 132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698