OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.Context; | 7 import android.content.Context; |
8 import android.content.SharedPreferences; | 8 import android.content.SharedPreferences; |
9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
10 import android.os.AsyncTask; | 10 import android.os.AsyncTask; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 /* | 126 /* |
127 * Update the information associated with the web app with the specified dat
a. | 127 * Update the information associated with the web app with the specified dat
a. |
128 * @param splashScreenImage The image which should be shown on the splash sc
reen of the web app. | 128 * @param splashScreenImage The image which should be shown on the splash sc
reen of the web app. |
129 */ | 129 */ |
130 public void updateSplashScreenImage(Bitmap splashScreenImage) { | 130 public void updateSplashScreenImage(Bitmap splashScreenImage) { |
131 new UpdateTask(splashScreenImage).execute(); | 131 new UpdateTask(splashScreenImage).execute(); |
132 } | 132 } |
133 | 133 |
134 /** Package private for use by WebappRegistry */ | |
135 void updateLastUsedTime() { | 134 void updateLastUsedTime() { |
136 assert !ThreadUtils.runningOnUiThread(); | 135 assert !ThreadUtils.runningOnUiThread(); |
137 mPreferences.edit().putLong(KEY_LAST_USED, System.currentTimeMillis()).c
ommit(); | 136 mPreferences.edit().putLong(KEY_LAST_USED, System.currentTimeMillis()).c
ommit(); |
138 } | 137 } |
139 | 138 |
140 private long getLastUsedTime() { | 139 long getLastUsedTime() { |
141 assert !ThreadUtils.runningOnUiThread(); | 140 assert !ThreadUtils.runningOnUiThread(); |
142 return mPreferences.getLong(KEY_LAST_USED, INVALID_LAST_USED); | 141 return mPreferences.getLong(KEY_LAST_USED, INVALID_LAST_USED); |
143 } | 142 } |
144 | 143 |
145 private Map<String, ?> getAllData() { | 144 private Map<String, ?> getAllData() { |
146 return mPreferences.getAll(); | 145 return mPreferences.getAll(); |
147 } | 146 } |
148 | 147 |
149 /** | 148 /** |
150 * Called after data has been retrieved from storage. | 149 * Called after data has been retrieved from storage. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 198 |
200 @Override | 199 @Override |
201 protected Void doInBackground(Void... nothing) { | 200 protected Void doInBackground(Void... nothing) { |
202 mPreferences.edit() | 201 mPreferences.edit() |
203 .putString(KEY_SPLASH_ICON, ShortcutHelper.encodeBitmapAsStr
ing(mSplashImage)) | 202 .putString(KEY_SPLASH_ICON, ShortcutHelper.encodeBitmapAsStr
ing(mSplashImage)) |
204 .commit(); | 203 .commit(); |
205 return null; | 204 return null; |
206 } | 205 } |
207 } | 206 } |
208 } | 207 } |
OLD | NEW |