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.webapk.shell_apk; | 5 package org.chromium.webapk.shell_apk; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.ActivityNotFoundException; | 8 import android.content.ActivityNotFoundException; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 } | 83 } |
84 | 84 |
85 mOverrideUrl = getOverrideUrl(); | 85 mOverrideUrl = getOverrideUrl(); |
86 mStartUrl = (mOverrideUrl != null) ? mOverrideUrl | 86 mStartUrl = (mOverrideUrl != null) ? mOverrideUrl |
87 : metadata.getString(WebApkMetaDataKe ys.START_URL); | 87 : metadata.getString(WebApkMetaDataKe ys.START_URL); |
88 if (mStartUrl == null) { | 88 if (mStartUrl == null) { |
89 finish(); | 89 finish(); |
90 return; | 90 return; |
91 } | 91 } |
92 | 92 |
93 // The WebAPK may have been launched as a result of an intent filter for a different | |
94 // scheme or top level domain. Rewrite the scheme and host name to the s cope's | |
95 // scheme and host name. | |
Yaron
2017/07/24 15:09:18
nit: there's an extra space in there :)
| |
96 String scopeUrl = metadata.getString(WebApkMetaDataKeys.SCOPE); | |
97 if (!TextUtils.isEmpty(scopeUrl)) { | |
98 Uri parsedStartUrl = Uri.parse(mStartUrl); | |
99 Uri parsedScope = Uri.parse(scopeUrl); | |
100 mStartUrl = parsedStartUrl.buildUpon() | |
101 .scheme(parsedScope.getScheme()) | |
102 .authority(parsedScope.getAuthority()) | |
103 .build() | |
104 .toString(); | |
105 } | |
106 | |
93 Log.v(TAG, "Url of the WebAPK: " + mStartUrl); | 107 Log.v(TAG, "Url of the WebAPK: " + mStartUrl); |
94 String packageName = getPackageName(); | 108 String packageName = getPackageName(); |
95 Log.v(TAG, "Package name of the WebAPK:" + packageName); | 109 Log.v(TAG, "Package name of the WebAPK:" + packageName); |
96 | 110 |
97 String runtimeHostInPreferences = WebApkUtils.getHostBrowserFromSharedPr eference(this); | 111 String runtimeHostInPreferences = WebApkUtils.getHostBrowserFromSharedPr eference(this); |
98 String runtimeHost = WebApkUtils.getHostBrowserPackageName(this); | 112 String runtimeHost = WebApkUtils.getHostBrowserPackageName(this); |
99 if (!TextUtils.isEmpty(runtimeHostInPreferences) | 113 if (!TextUtils.isEmpty(runtimeHostInPreferences) |
100 && !runtimeHostInPreferences.equals(runtimeHost)) { | 114 && !runtimeHostInPreferences.equals(runtimeHost)) { |
101 deleteSharedPref(this); | 115 deleteSharedPref(this); |
102 deleteInternalStorage(); | 116 deleteInternalStorage(); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 public void onConfirmQuit() { | 268 public void onConfirmQuit() { |
255 finish(); | 269 finish(); |
256 } | 270 } |
257 }; | 271 }; |
258 | 272 |
259 InstallHostBrowserDialog.show(this, listener, getString(R.string.name), | 273 InstallHostBrowserDialog.show(this, listener, getString(R.string.name), |
260 lastResortHostBrowserPackageName, lastResortHostBrowserApplicati onName, | 274 lastResortHostBrowserPackageName, lastResortHostBrowserApplicati onName, |
261 R.drawable.last_resort_runtime_host_logo); | 275 R.drawable.last_resort_runtime_host_logo); |
262 } | 276 } |
263 } | 277 } |
OLD | NEW |