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

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

Issue 1354323003: Fix up _some_web app directory StrictMode violations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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.app.Activity; 7 import android.app.Activity;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.net.Uri; 9 import android.net.Uri;
10 import android.os.Build;
10 import android.os.Bundle; 11 import android.os.Bundle;
11 import android.util.Base64; 12 import android.util.Base64;
12 13
13 import org.chromium.base.ApiCompatibilityUtils; 14 import org.chromium.base.ApiCompatibilityUtils;
14 import org.chromium.base.ApplicationStatus; 15 import org.chromium.base.ApplicationStatus;
15 import org.chromium.base.Log; 16 import org.chromium.base.Log;
16 import org.chromium.chrome.browser.ShortcutHelper; 17 import org.chromium.chrome.browser.ShortcutHelper;
17 import org.chromium.chrome.browser.WebappAuthenticator; 18 import org.chromium.chrome.browser.WebappAuthenticator;
18 import org.chromium.chrome.browser.document.ChromeLauncherActivity; 19 import org.chromium.chrome.browser.document.ChromeLauncherActivity;
19 import org.chromium.chrome.browser.metrics.LaunchMetrics; 20 import org.chromium.chrome.browser.metrics.LaunchMetrics;
20 import org.chromium.chrome.browser.tab.Tab; 21 import org.chromium.chrome.browser.tab.Tab;
21 import org.chromium.chrome.browser.util.FeatureUtilities;
22 import org.chromium.chrome.browser.util.IntentUtils; 22 import org.chromium.chrome.browser.util.IntentUtils;
23 23
24 import java.lang.ref.WeakReference; 24 import java.lang.ref.WeakReference;
25 25
26 /** 26 /**
27 * Launches web apps. This was separated from the ChromeLauncherActivity becaus e the 27 * Launches web apps. This was separated from the ChromeLauncherActivity becaus e the
28 * ChromeLauncherActivity is not allowed to be excluded from Android's Recents: crbug.com/517426. 28 * ChromeLauncherActivity is not allowed to be excluded from Android's Recents: crbug.com/517426.
29 */ 29 */
30 public class WebappLauncherActivity extends Activity { 30 public class WebappLauncherActivity extends Activity {
31 /** 31 /**
(...skipping 19 matching lines...) Expand all
51 String webappMacString = IntentUtils.safeGetStringExtra( 51 String webappMacString = IntentUtils.safeGetStringExtra(
52 intent, ShortcutHelper.EXTRA_MAC); 52 intent, ShortcutHelper.EXTRA_MAC);
53 byte[] webappMac = 53 byte[] webappMac =
54 webappMacString == null ? null : Base64.decode(webappMacStri ng, Base64.DEFAULT); 54 webappMacString == null ? null : Base64.decode(webappMacStri ng, Base64.DEFAULT);
55 55
56 Intent launchIntent = null; 56 Intent launchIntent = null;
57 if (webappMac != null && WebappAuthenticator.isUrlValid(this, webapp Url, webappMac)) { 57 if (webappMac != null && WebappAuthenticator.isUrlValid(this, webapp Url, webappMac)) {
58 LaunchMetrics.recordHomeScreenLaunchIntoStandaloneActivity(webap pUrl, webappSource); 58 LaunchMetrics.recordHomeScreenLaunchIntoStandaloneActivity(webap pUrl, webappSource);
59 59
60 String activityName = WebappActivity.class.getName(); 60 String activityName = WebappActivity.class.getName();
61 if (!FeatureUtilities.isDocumentModeEligible(this)) { 61 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
62 // Specifically assign the app to a particular WebappActivit y instance. 62 // Specifically assign the app to a particular WebappActivit y instance.
63 int activityIndex = ActivityAssigner.instance(this).assign(w ebappId); 63 int activityIndex = ActivityAssigner.instance(this).assign(w ebappId);
64 activityName += String.valueOf(activityIndex); 64 activityName += String.valueOf(activityIndex);
65 } 65 }
66 66
67 // Create an intent to launch the Webapp in an unmapped WebappAc tivity. 67 // Create an intent to launch the Webapp in an unmapped WebappAc tivity.
68 launchIntent = new Intent(); 68 launchIntent = new Intent();
69 launchIntent.setClassName(this, activityName); 69 launchIntent.setClassName(this, activityName);
70 webappInfo.setWebappIntentExtras(launchIntent); 70 webappInfo.setWebappIntentExtras(launchIntent);
71 71
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 && webappActivity.getActivityTab().getId() == tabId) { 109 && webappActivity.getActivityTab().getId() == tabId) {
110 Tab tab = webappActivity.getActivityTab(); 110 Tab tab = webappActivity.getActivityTab();
111 tab.getChromeWebContentsDelegateAndroid().activateContents(); 111 tab.getChromeWebContentsDelegateAndroid().activateContents();
112 return true; 112 return true;
113 } 113 }
114 } 114 }
115 115
116 return false; 116 return false;
117 } 117 }
118 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698