OLD | NEW |
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.graphics.Bitmap; | 7 import android.graphics.Bitmap; |
8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
9 | 9 |
10 import org.chromium.base.annotations.CalledByNative; | 10 import org.chromium.base.annotations.CalledByNative; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 protected void onDataAvailable(String manifestStartUrl, String scopeUrl, Str
ing name, | 101 protected void onDataAvailable(String manifestStartUrl, String scopeUrl, Str
ing name, |
102 String shortName, String bestIconUrl, String bestIconMurmur2Hash, Bi
tmap bestIconBitmap, | 102 String shortName, String bestIconUrl, String bestIconMurmur2Hash, Bi
tmap bestIconBitmap, |
103 String[] iconUrls, int displayMode, int orientation, long themeColor
, | 103 String[] iconUrls, int displayMode, int orientation, long themeColor
, |
104 long backgroundColor) { | 104 long backgroundColor) { |
105 HashMap<String, String> iconUrlToMurmur2HashMap = new HashMap<String, St
ring>(); | 105 HashMap<String, String> iconUrlToMurmur2HashMap = new HashMap<String, St
ring>(); |
106 for (String iconUrl : iconUrls) { | 106 for (String iconUrl : iconUrls) { |
107 String murmur2Hash = (iconUrl.equals(bestIconUrl)) ? bestIconMurmur2
Hash : null; | 107 String murmur2Hash = (iconUrl.equals(bestIconUrl)) ? bestIconMurmur2
Hash : null; |
108 iconUrlToMurmur2HashMap.put(iconUrl, murmur2Hash); | 108 iconUrlToMurmur2HashMap.put(iconUrl, murmur2Hash); |
109 } | 109 } |
110 | 110 |
111 WebApkInfo info = WebApkInfo.create(mOldInfo.id(), mOldInfo.uri().toStri
ng(), scopeUrl, | 111 WebApkInfo info = WebApkInfo.create(mOldInfo.id(), mOldInfo.uri().toStri
ng(), |
112 new WebApkInfo.Icon(bestIconBitmap), name, shortName, displayMod
e, orientation, | 112 mOldInfo.shouldForceNavigation(), scopeUrl, new WebApkInfo.Icon(
bestIconBitmap), |
113 mOldInfo.source(), themeColor, backgroundColor, mOldInfo.webApkP
ackageName(), | 113 name, shortName, displayMode, orientation, mOldInfo.source(), th
emeColor, |
114 mOldInfo.shellApkVersion(), mOldInfo.manifestUrl(), manifestStar
tUrl, | 114 backgroundColor, mOldInfo.webApkPackageName(), mOldInfo.shellApk
Version(), |
115 iconUrlToMurmur2HashMap); | 115 mOldInfo.manifestUrl(), manifestStartUrl, iconUrlToMurmur2HashMa
p); |
116 mObserver.onGotManifestData(info, bestIconUrl); | 116 mObserver.onGotManifestData(info, bestIconUrl); |
117 } | 117 } |
118 | 118 |
119 /** | 119 /** |
120 * Called when the initial URL load has completed and the page has no Web Ma
nifest or the | 120 * Called when the initial URL load has completed and the page has no Web Ma
nifest or the |
121 * Web Manifest is not WebAPK compatible. | 121 * Web Manifest is not WebAPK compatible. |
122 */ | 122 */ |
123 @CalledByNative | 123 @CalledByNative |
124 private void onWebManifestForInitialUrlNotWebApkCompatible() { | 124 private void onWebManifestForInitialUrlNotWebApkCompatible() { |
125 mObserver.onWebManifestForInitialUrlNotWebApkCompatible(); | 125 mObserver.onWebManifestForInitialUrlNotWebApkCompatible(); |
126 } | 126 } |
127 | 127 |
128 private native long nativeInitialize(String scope, String webManifestUrl); | 128 private native long nativeInitialize(String scope, String webManifestUrl); |
129 private native void nativeReplaceWebContents( | 129 private native void nativeReplaceWebContents( |
130 long nativeWebApkUpdateDataFetcher, WebContents webContents); | 130 long nativeWebApkUpdateDataFetcher, WebContents webContents); |
131 private native void nativeDestroy(long nativeWebApkUpdateDataFetcher); | 131 private native void nativeDestroy(long nativeWebApkUpdateDataFetcher); |
132 private native void nativeStart(long nativeWebApkUpdateDataFetcher, WebConte
nts webContents); | 132 private native void nativeStart(long nativeWebApkUpdateDataFetcher, WebConte
nts webContents); |
133 } | 133 } |
OLD | NEW |