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.content.Intent; | 7 import android.content.Intent; |
8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
9 import android.net.Uri; | 9 import android.net.Uri; |
10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 /** | 101 /** |
102 * Construct a WebappInfo. | 102 * Construct a WebappInfo. |
103 * @param intent Intent containing info about the app. | 103 * @param intent Intent containing info about the app. |
104 */ | 104 */ |
105 public static WebappInfo create(Intent intent) { | 105 public static WebappInfo create(Intent intent) { |
106 String id = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_
ID); | 106 String id = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_
ID); |
107 String icon = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTR
A_ICON); | 107 String icon = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTR
A_ICON); |
108 String url = urlFromIntent(intent); | 108 String url = urlFromIntent(intent); |
109 String scope = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXT
RA_SCOPE); | 109 String scope = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXT
RA_SCOPE); |
110 int displayMode = IntentUtils.safeGetIntExtra( | 110 int displayMode = IntentUtils.safeGetIntExtra( |
111 intent, ShortcutHelper.EXTRA_DISPLAY_MODE, WebDisplayMode.kStand
alone); | 111 intent, ShortcutHelper.EXTRA_DISPLAY_MODE, WebDisplayMode.STANDA
LONE); |
112 int orientation = IntentUtils.safeGetIntExtra( | 112 int orientation = IntentUtils.safeGetIntExtra( |
113 intent, ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValue
s.DEFAULT); | 113 intent, ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValue
s.DEFAULT); |
114 int source = sourceFromIntent(intent); | 114 int source = sourceFromIntent(intent); |
115 long themeColor = IntentUtils.safeGetLongExtra(intent, | 115 long themeColor = IntentUtils.safeGetLongExtra(intent, |
116 ShortcutHelper.EXTRA_THEME_COLOR, | 116 ShortcutHelper.EXTRA_THEME_COLOR, |
117 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); | 117 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); |
118 long backgroundColor = IntentUtils.safeGetLongExtra(intent, | 118 long backgroundColor = IntentUtils.safeGetLongExtra(intent, |
119 ShortcutHelper.EXTRA_BACKGROUND_COLOR, | 119 ShortcutHelper.EXTRA_BACKGROUND_COLOR, |
120 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); | 120 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); |
121 boolean isIconGenerated = IntentUtils.safeGetBooleanExtra(intent, | 121 boolean isIconGenerated = IntentUtils.safeGetBooleanExtra(intent, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 /** | 315 /** |
316 * Returns true if the WebappInfo was created for an Intent fired from a lau
ncher shortcut (as | 316 * Returns true if the WebappInfo was created for an Intent fired from a lau
ncher shortcut (as |
317 * opposed to an intent from a push notification or other internal source). | 317 * opposed to an intent from a push notification or other internal source). |
318 */ | 318 */ |
319 public boolean isLaunchedFromHomescreen() { | 319 public boolean isLaunchedFromHomescreen() { |
320 int source = source(); | 320 int source = source(); |
321 return source != ShortcutSource.NOTIFICATION && source != ShortcutSource
.EXTERNAL_INTENT; | 321 return source != ShortcutSource.NOTIFICATION && source != ShortcutSource
.EXTERNAL_INTENT; |
322 } | 322 } |
323 } | 323 } |
OLD | NEW |