| 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.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.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.SharedPreferences; | 10 import android.content.SharedPreferences; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 63 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 64 intent.setPackage(getInstrumentation().getTargetContext().getPackageName
()); | 64 intent.setPackage(getInstrumentation().getTargetContext().getPackageName
()); |
| 65 intent.setAction(WebappLauncherActivity.ACTION_START_WEBAPP); | 65 intent.setAction(WebappLauncherActivity.ACTION_START_WEBAPP); |
| 66 if (addMac) { | 66 if (addMac) { |
| 67 // Needed for security reasons. If the MAC is excluded, the URL of
the webapp is opened | 67 // Needed for security reasons. If the MAC is excluded, the URL of
the webapp is opened |
| 68 // in a browser window, instead. | 68 // in a browser window, instead. |
| 69 String mac = ShortcutHelper.getEncodedMac(getInstrumentation().getTa
rgetContext(), url); | 69 String mac = ShortcutHelper.getEncodedMac(getInstrumentation().getTa
rgetContext(), url); |
| 70 intent.putExtra(ShortcutHelper.EXTRA_MAC, mac); | 70 intent.putExtra(ShortcutHelper.EXTRA_MAC, mac); |
| 71 } | 71 } |
| 72 | 72 |
| 73 WebappInfo webappInfo = WebappInfo.create(id, url, icon, title, null, | 73 WebappInfo webappInfo = WebappInfo.create(id, url, null, icon, title, nu
ll, |
| 74 WebDisplayMode.Standalone, ScreenOrientationValues.PORTRAIT, Sho
rtcutSource.UNKNOWN, | 74 WebDisplayMode.Standalone, ScreenOrientationValues.PORTRAIT, Sho
rtcutSource.UNKNOWN, |
| 75 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, | 75 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, |
| 76 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false, null, n
ull); | 76 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false, null, n
ull); |
| 77 webappInfo.setWebappIntentExtras(intent); | 77 webappInfo.setWebappIntentExtras(intent); |
| 78 | 78 |
| 79 return intent; | 79 return intent; |
| 80 } | 80 } |
| 81 | 81 |
| 82 private void fireWebappIntent(String id, String url, String title, String ic
on, | 82 private void fireWebappIntent(String id, String url, String title, String ic
on, |
| 83 boolean addMac) throws Exception { | 83 boolean addMac) throws Exception { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 323 |
| 324 WebappActivity webappActivity = (WebappActivity) lastActivity; | 324 WebappActivity webappActivity = (WebappActivity) lastActivity; |
| 325 if (webappActivity.getActivityTab() == null) return false; | 325 if (webappActivity.getActivityTab() == null) return false; |
| 326 | 326 |
| 327 View rootView = webappActivity.findViewById(android.R.id.content); | 327 View rootView = webappActivity.findViewById(android.R.id.content); |
| 328 if (!rootView.hasWindowFocus()) return false; | 328 if (!rootView.hasWindowFocus()) return false; |
| 329 | 329 |
| 330 return true; | 330 return true; |
| 331 } | 331 } |
| 332 } | 332 } |
| OLD | NEW |