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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 if (addMac) { | 75 if (addMac) { |
76 // Needed for security reasons. If the MAC is excluded, the URL of
the webapp is opened | 76 // Needed for security reasons. If the MAC is excluded, the URL of
the webapp is opened |
77 // in a browser window, instead. | 77 // in a browser window, instead. |
78 String mac = ShortcutHelper.getEncodedMac(getInstrumentation().getTa
rgetContext(), url); | 78 String mac = ShortcutHelper.getEncodedMac(getInstrumentation().getTa
rgetContext(), url); |
79 intent.putExtra(ShortcutHelper.EXTRA_MAC, mac); | 79 intent.putExtra(ShortcutHelper.EXTRA_MAC, mac); |
80 } | 80 } |
81 | 81 |
82 WebappInfo webappInfo = WebappInfo.create(id, url, icon, title, null, | 82 WebappInfo webappInfo = WebappInfo.create(id, url, icon, title, null, |
83 WebDisplayMode.Standalone, ScreenOrientationValues.PORTRAIT, Sho
rtcutSource.UNKNOWN, | 83 WebDisplayMode.Standalone, ScreenOrientationValues.PORTRAIT, Sho
rtcutSource.UNKNOWN, |
84 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, | 84 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, |
85 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false); | 85 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false, null); |
86 webappInfo.setWebappIntentExtras(intent); | 86 webappInfo.setWebappIntentExtras(intent); |
87 | 87 |
88 return intent; | 88 return intent; |
89 } | 89 } |
90 | 90 |
91 private void fireWebappIntent(String id, String url, String title, String ic
on, | 91 private void fireWebappIntent(String id, String url, String title, String ic
on, |
92 boolean addMac) throws Exception { | 92 boolean addMac) throws Exception { |
93 Intent intent = createIntent(id, url, title, icon, addMac); | 93 Intent intent = createIntent(id, url, title, icon, addMac); |
94 | 94 |
95 getInstrumentation().getTargetContext().startActivity(intent); | 95 getInstrumentation().getTargetContext().startActivity(intent); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 WebappActivity webappActivity = (WebappActivity) lastActivity; | 374 WebappActivity webappActivity = (WebappActivity) lastActivity; |
375 if (webappActivity.getActivityTab() == null) return false; | 375 if (webappActivity.getActivityTab() == null) return false; |
376 | 376 |
377 View rootView = webappActivity.findViewById(android.R.id.content); | 377 View rootView = webappActivity.findViewById(android.R.id.content); |
378 if (!rootView.hasWindowFocus()) return false; | 378 if (!rootView.hasWindowFocus()) return false; |
379 | 379 |
380 return true; | 380 return true; |
381 } | 381 } |
382 } | 382 } |
OLD | NEW |