OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.app.ActivityManager; | 7 import android.app.ActivityManager; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 Toast toast = Toast.makeText(applicationContext, toastText, Toas
t.LENGTH_SHORT); | 166 Toast toast = Toast.makeText(applicationContext, toastText, Toas
t.LENGTH_SHORT); |
167 toast.show(); | 167 toast.show(); |
168 } | 168 } |
169 }); | 169 }); |
170 } | 170 } |
171 | 171 |
172 /** | 172 /** |
173 * Creates a storage location and stores the data for a web app using {@link
WebappDataStorage}. | 173 * Creates a storage location and stores the data for a web app using {@link
WebappDataStorage}. |
174 * @param context Context to open the WebappDataStorage with. | 174 * @param context Context to open the WebappDataStorage with. |
175 * @param id ID of the webapp which is storing data. | 175 * @param id ID of the webapp which is storing data. |
| 176 * @param scope scope of the webapp which is storing data. |
176 * @param splashImage Image which should be displayed on the splash screen o
f | 177 * @param splashImage Image which should be displayed on the splash screen o
f |
177 * the webapp. This can be null of there is no image to s
how. | 178 * the webapp. This can be null of there is no image to s
how. |
178 */ | 179 */ |
179 @SuppressWarnings("unused") | 180 @SuppressWarnings("unused") |
180 @CalledByNative | 181 @CalledByNative |
181 private static void storeWebappData(Context context, String id, Bitmap splas
hImage) { | 182 private static void storeWebappData(Context context, String id, String scope
, |
182 WebappRegistry.registerWebapp(context, id); | 183 Bitmap splashImage) { |
| 184 WebappRegistry.registerWebapp(context, id, scope); |
183 WebappDataStorage.open(context, id).updateSplashScreenImage(splashImage)
; | 185 WebappDataStorage.open(context, id).updateSplashScreenImage(splashImage)
; |
184 } | 186 } |
185 | 187 |
186 /** | 188 /** |
187 * Creates an intent that will add a shortcut to the home screen. | 189 * Creates an intent that will add a shortcut to the home screen. |
188 * @param shortcutIntent Intent to fire when the shortcut is activated. | 190 * @param shortcutIntent Intent to fire when the shortcut is activated. |
189 * @param url URL of the shortcut. | 191 * @param url URL of the shortcut. |
190 * @param title Title of the shortcut. | 192 * @param title Title of the shortcut. |
191 * @param icon Image that represents the shortcut. | 193 * @param icon Image that represents the shortcut. |
192 * @return Intent for the shortcut. | 194 * @return Intent for the shortcut. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 context.getResources(), id, density); | 455 context.getResources(), id, density); |
454 | 456 |
455 if (drawable instanceof BitmapDrawable) { | 457 if (drawable instanceof BitmapDrawable) { |
456 BitmapDrawable bd = (BitmapDrawable) drawable; | 458 BitmapDrawable bd = (BitmapDrawable) drawable; |
457 return bd.getBitmap(); | 459 return bd.getBitmap(); |
458 } | 460 } |
459 assert false : "The drawable was not a bitmap drawable as expected"; | 461 assert false : "The drawable was not a bitmap drawable as expected"; |
460 return null; | 462 return null; |
461 } | 463 } |
462 } | 464 } |
OLD | NEW |