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

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

Issue 2760103002: Merge WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME and ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME (Closed)
Patch Set: Merge branch 'master' into package_name Created 3 years, 9 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 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.Intent; 8 import android.content.Intent;
9 import android.content.SharedPreferences; 9 import android.content.SharedPreferences;
10 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
11 import android.os.AsyncTask; 11 import android.os.AsyncTask;
12 12
13 import org.chromium.base.ContextUtils; 13 import org.chromium.base.ContextUtils;
14 import org.chromium.base.ThreadUtils; 14 import org.chromium.base.ThreadUtils;
15 import org.chromium.base.VisibleForTesting; 15 import org.chromium.base.VisibleForTesting;
16 import org.chromium.blink_public.platform.WebDisplayMode; 16 import org.chromium.blink_public.platform.WebDisplayMode;
17 import org.chromium.chrome.browser.ShortcutHelper; 17 import org.chromium.chrome.browser.ShortcutHelper;
18 import org.chromium.chrome.browser.ShortcutSource; 18 import org.chromium.chrome.browser.ShortcutSource;
19 import org.chromium.chrome.browser.util.IntentUtils; 19 import org.chromium.chrome.browser.util.IntentUtils;
20 import org.chromium.content_public.common.ScreenOrientationValues; 20 import org.chromium.content_public.common.ScreenOrientationValues;
21 import org.chromium.webapk.lib.common.WebApkConstants;
21 22
22 import java.util.concurrent.TimeUnit; 23 import java.util.concurrent.TimeUnit;
23 24
24 /** 25 /**
25 * Stores data about an installed web app. Uses SharedPreferences to persist the data to disk. 26 * Stores data about an installed web app. Uses SharedPreferences to persist the data to disk.
26 * This class must only be accessed via {@link WebappRegistry}, which is used to register and keep 27 * This class must only be accessed via {@link WebappRegistry}, which is used to register and keep
27 * track of web app data known to Chrome. 28 * track of web app data known to Chrome.
28 */ 29 */
29 public class WebappDataStorage { 30 public class WebappDataStorage {
30 31
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING)); 270 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING));
270 editor.putLong(KEY_BACKGROUND_COLOR, IntentUtils.safeGetLongExtra( 271 editor.putLong(KEY_BACKGROUND_COLOR, IntentUtils.safeGetLongExtra(
271 shortcutIntent, ShortcutHelper.EXTRA_BACKGROUND_COLOR, 272 shortcutIntent, ShortcutHelper.EXTRA_BACKGROUND_COLOR,
272 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING)); 273 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING));
273 editor.putBoolean(KEY_IS_ICON_GENERATED, IntentUtils.safeGetBooleanE xtra( 274 editor.putBoolean(KEY_IS_ICON_GENERATED, IntentUtils.safeGetBooleanE xtra(
274 shortcutIntent, ShortcutHelper.EXTRA_IS_ICON_GENERATED, false)); 275 shortcutIntent, ShortcutHelper.EXTRA_IS_ICON_GENERATED, false));
275 editor.putString(KEY_ACTION, shortcutIntent.getAction()); 276 editor.putString(KEY_ACTION, shortcutIntent.getAction());
276 editor.putInt(KEY_SOURCE, IntentUtils.safeGetIntExtra( 277 editor.putInt(KEY_SOURCE, IntentUtils.safeGetIntExtra(
277 shortcutIntent, ShortcutHelper.EXTRA_SOURCE, 278 shortcutIntent, ShortcutHelper.EXTRA_SOURCE,
278 ShortcutSource.UNKNOWN)); 279 ShortcutSource.UNKNOWN));
279 editor.putString(KEY_WEBAPK_PACKAGE_NAME, IntentUtils.safeGetStringE xtra( 280 editor.putString(KEY_WEBAPK_PACKAGE_NAME,
280 shortcutIntent, ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME)); 281 IntentUtils.safeGetStringExtra(
282 shortcutIntent, WebApkConstants.EXTRA_WEBAPK_PACKAGE _NAME));
281 updated = true; 283 updated = true;
282 } 284 }
283 if (updated) editor.apply(); 285 if (updated) editor.apply();
284 } 286 }
285 287
286 /** 288 /**
287 * Returns true if this web app has been launched from home screen recently (within 289 * Returns true if this web app has been launched from home screen recently (within
288 * WEBAPP_LAST_OPEN_MAX_TIME milliseconds). 290 * WEBAPP_LAST_OPEN_MAX_TIME milliseconds).
289 */ 291 */
290 public boolean wasLaunchedRecently() { 292 public boolean wasLaunchedRecently() {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 protected WebappDataStorage(String webappId) { 477 protected WebappDataStorage(String webappId) {
476 mId = webappId; 478 mId = webappId;
477 mPreferences = ContextUtils.getApplicationContext().getSharedPreferences ( 479 mPreferences = ContextUtils.getApplicationContext().getSharedPreferences (
478 SHARED_PREFS_FILE_PREFIX + webappId, Context.MODE_PRIVATE); 480 SHARED_PREFS_FILE_PREFIX + webappId, Context.MODE_PRIVATE);
479 } 481 }
480 482
481 private boolean isEmpty() { 483 private boolean isEmpty() {
482 return mPreferences.getAll().isEmpty(); 484 return mPreferences.getAll().isEmpty();
483 } 485 }
484 } 486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698