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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 intent.setPackage(getInstrumentation().getTargetContext().getPackageName
()); | 67 intent.setPackage(getInstrumentation().getTargetContext().getPackageName
()); |
68 intent.setAction(WebappLauncherActivity.ACTION_START_WEBAPP); | 68 intent.setAction(WebappLauncherActivity.ACTION_START_WEBAPP); |
69 if (addMac) { | 69 if (addMac) { |
70 // Needed for security reasons. If the MAC is excluded, the URL of
the webapp is opened | 70 // Needed for security reasons. If the MAC is excluded, the URL of
the webapp is opened |
71 // in a browser window, instead. | 71 // in a browser window, instead. |
72 String mac = ShortcutHelper.getEncodedMac(getInstrumentation().getTa
rgetContext(), url); | 72 String mac = ShortcutHelper.getEncodedMac(getInstrumentation().getTa
rgetContext(), url); |
73 intent.putExtra(ShortcutHelper.EXTRA_MAC, mac); | 73 intent.putExtra(ShortcutHelper.EXTRA_MAC, mac); |
74 } | 74 } |
75 | 75 |
76 WebappInfo webappInfo = WebappInfo.create(id, url, null, new WebappInfo.
Icon(icon), title, | 76 WebappInfo webappInfo = WebappInfo.create(id, url, null, new WebappInfo.
Icon(icon), title, |
77 null, WebDisplayMode.kStandalone, ScreenOrientationValues.PORTRA
IT, | 77 null, WebDisplayMode.STANDALONE, ScreenOrientationValues.PORTRAI
T, |
78 ShortcutSource.UNKNOWN, ShortcutHelper.MANIFEST_COLOR_INVALID_OR
_MISSING, | 78 ShortcutSource.UNKNOWN, ShortcutHelper.MANIFEST_COLOR_INVALID_OR
_MISSING, |
79 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false); | 79 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false); |
80 webappInfo.setWebappIntentExtras(intent); | 80 webappInfo.setWebappIntentExtras(intent); |
81 | 81 |
82 return intent; | 82 return intent; |
83 } | 83 } |
84 | 84 |
85 private void fireWebappIntent(String id, String url, String title, String ic
on, | 85 private void fireWebappIntent(String id, String url, String title, String ic
on, |
86 boolean addMac) { | 86 boolean addMac) { |
87 Intent intent = createIntent(id, url, title, icon, addMac); | 87 Intent intent = createIntent(id, url, title, icon, addMac); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 330 |
331 WebappActivity webappActivity = (WebappActivity) lastActivity; | 331 WebappActivity webappActivity = (WebappActivity) lastActivity; |
332 if (webappActivity.getActivityTab() == null) return false; | 332 if (webappActivity.getActivityTab() == null) return false; |
333 | 333 |
334 View rootView = webappActivity.findViewById(android.R.id.content); | 334 View rootView = webappActivity.findViewById(android.R.id.content); |
335 if (!rootView.hasWindowFocus()) return false; | 335 if (!rootView.hasWindowFocus()) return false; |
336 | 336 |
337 return true; | 337 return true; |
338 } | 338 } |
339 } | 339 } |
OLD | NEW |