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

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

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Adds an about:webapks page with information about all installed Web APKs on the device Created 3 years, 11 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.Intent; 7 import android.content.Intent;
8 import android.content.pm.ApplicationInfo; 8 import android.content.pm.ApplicationInfo;
9 import android.content.pm.PackageManager; 9 import android.content.pm.PackageManager;
10 import android.content.res.Resources; 10 import android.content.res.Resources;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 /** 44 /**
45 * Constructs a WebApkInfo from the passed in Intent and <meta-data> in the WebAPK's Android 45 * Constructs a WebApkInfo from the passed in Intent and <meta-data> in the WebAPK's Android
46 * manifest. 46 * manifest.
47 * @param intent Intent containing info about the app. 47 * @param intent Intent containing info about the app.
48 */ 48 */
49 public static WebApkInfo create(Intent intent) { 49 public static WebApkInfo create(Intent intent) {
50 String webApkPackageName = 50 String webApkPackageName =
51 IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_WEBA PK_PACKAGE_NAME); 51 IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_WEBA PK_PACKAGE_NAME);
52 if (TextUtils.isEmpty(webApkPackageName)) { 52 if (TextUtils.isEmpty(webApkPackageName)) {
53 return null; 53 return null;
54 } 54 }
dominickn 2017/01/23 00:48:07 Nit: don't remove this newline
gonzalon 2017/01/23 16:58:51 Done.
55
56 String url = urlFromIntent(intent); 55 String url = urlFromIntent(intent);
57 int source = sourceFromIntent(intent); 56 int source = sourceFromIntent(intent);
57 return create(webApkPackageName, url, source);
58 }
58 59
60 /**
61 * Constructs a WebApkInfo from the passed in parameters and <meta-data> in the WebAPK's Android
62 * manifest.
63 *
64 * @param webApkPackageName The package name of the WebAPK.
65 * @param url Url that the WebAPK should navigate to when launched.
66 * @param source Source that the WebAPK was launched from.
67 */
68 public static WebApkInfo create(String webApkPackageName, String url, int so urce) {
59 // Unlike non-WebAPK web apps, WebAPK ids are predictable. A malicious a ctor may send an 69 // Unlike non-WebAPK web apps, WebAPK ids are predictable. A malicious a ctor may send an
60 // intent with a valid start URL and arbitrary other data. Only use the start URL, the 70 // intent with a valid start URL and arbitrary other data. Only use the start URL, the
61 // package name and the ShortcutSource from the launch intent and extrac t the remaining data 71 // package name and the ShortcutSource from the launch intent and extrac t the remaining data
62 // from the <meta-data> in the WebAPK's Android manifest. 72 // from the <meta-data> in the WebAPK's Android manifest.
63 73
64 Bundle bundle = extractWebApkMetaData(webApkPackageName); 74 Bundle bundle = extractWebApkMetaData(webApkPackageName);
65 if (bundle == null) { 75 if (bundle == null) {
66 return null; 76 return null;
67 } 77 }
68 78
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return ScreenOrientationValues.PORTRAIT; 349 return ScreenOrientationValues.PORTRAIT;
340 } else if (orientation.equals("portrait-primary")) { 350 } else if (orientation.equals("portrait-primary")) {
341 return ScreenOrientationValues.PORTRAIT_PRIMARY; 351 return ScreenOrientationValues.PORTRAIT_PRIMARY;
342 } else if (orientation.equals("portrait-secondary")) { 352 } else if (orientation.equals("portrait-secondary")) {
343 return ScreenOrientationValues.PORTRAIT_SECONDARY; 353 return ScreenOrientationValues.PORTRAIT_SECONDARY;
344 } else { 354 } else {
345 return ScreenOrientationValues.DEFAULT; 355 return ScreenOrientationValues.DEFAULT;
346 } 356 }
347 } 357 }
348 } 358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698