| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 | 8 |
| 9 import org.chromium.base.ContextUtils; | 9 import org.chromium.base.ContextUtils; |
| 10 import org.chromium.base.library_loader.LibraryProcessType; | 10 import org.chromium.base.library_loader.LibraryProcessType; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // navigate to. | 40 // navigate to. |
| 41 String overrideUrl = intent.getStringExtra(ShortcutHelper.EXTRA_URL); | 41 String overrideUrl = intent.getStringExtra(ShortcutHelper.EXTRA_URL); |
| 42 if (overrideUrl != null && isInitialized() | 42 if (overrideUrl != null && isInitialized() |
| 43 && !overrideUrl.equals(getActivityTab().getUrl())) { | 43 && !overrideUrl.equals(getActivityTab().getUrl())) { |
| 44 getActivityTab().loadUrl( | 44 getActivityTab().loadUrl( |
| 45 new LoadUrlParams(overrideUrl, PageTransition.AUTO_TOPLEVEL)
); | 45 new LoadUrlParams(overrideUrl, PageTransition.AUTO_TOPLEVEL)
); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 @Override | 49 @Override |
| 50 protected WebappInfo createWebappInfo(Intent intent) { |
| 51 return (intent == null) ? WebApkInfo.createEmpty() : WebApkInfo.create(i
ntent); |
| 52 } |
| 53 |
| 54 @Override |
| 50 protected void onStorageIsNull(final int backgroundColor) { | 55 protected void onStorageIsNull(final int backgroundColor) { |
| 51 // Register the WebAPK. It is possible that a WebAPK's meta data was del
eted when user | 56 // Register the WebAPK. It is possible that a WebAPK's meta data was del
eted when user |
| 52 // cleared Chrome's data. When it is launched again, we know that the We
bAPK is still | 57 // cleared Chrome's data. When it is launched again, we know that the We
bAPK is still |
| 53 // installed, so re-register it. | 58 // installed, so re-register it. |
| 54 WebappRegistry.getInstance().register( | 59 WebappRegistry.getInstance().register( |
| 55 mWebappInfo.id(), new WebappRegistry.FetchWebappDataStorageCallb
ack() { | 60 mWebappInfo.id(), new WebappRegistry.FetchWebappDataStorageCallb
ack() { |
| 56 @Override | 61 @Override |
| 57 public void onWebappDataStorageRetrieved(WebappDataStorage s
torage) { | 62 public void onWebappDataStorageRetrieved(WebappDataStorage s
torage) { |
| 58 updateStorage(storage); | 63 updateStorage(storage); |
| 59 // Initialize the time of the last is-update-needed chec
k with the | 64 // Initialize the time of the last is-update-needed chec
k with the |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // TODO(hanxi): crbug.com/611842. Investigates whether this function wor
ks for multiple | 136 // TODO(hanxi): crbug.com/611842. Investigates whether this function wor
ks for multiple |
| 132 // windows or with --site-per-process enabled. | 137 // windows or with --site-per-process enabled. |
| 133 initializeChildProcessCreationParams(true); | 138 initializeChildProcessCreationParams(true); |
| 134 } | 139 } |
| 135 | 140 |
| 136 @Override | 141 @Override |
| 137 public void onDeferredStartup() { | 142 public void onDeferredStartup() { |
| 138 super.onDeferredStartup(); | 143 super.onDeferredStartup(); |
| 139 | 144 |
| 140 mUpdateManager = new WebApkUpdateManager(); | 145 mUpdateManager = new WebApkUpdateManager(); |
| 141 mUpdateManager.updateIfNeeded(getActivityTab(), mWebappInfo); | 146 mUpdateManager.updateIfNeeded(getActivityTab(), (WebApkInfo) mWebappInfo
); |
| 142 } | 147 } |
| 143 | 148 |
| 144 @Override | 149 @Override |
| 145 public void onPause() { | 150 public void onPause() { |
| 146 super.onPause(); | 151 super.onPause(); |
| 147 initializeChildProcessCreationParams(false); | 152 initializeChildProcessCreationParams(false); |
| 148 } | 153 } |
| 149 | 154 |
| 150 /** | 155 /** |
| 151 * Initializes {@link ChildProcessCreationParams} as a WebAPK's renderer pro
cess if | 156 * Initializes {@link ChildProcessCreationParams} as a WebAPK's renderer pro
cess if |
| (...skipping 13 matching lines...) Expand all Loading... |
| 165 } | 170 } |
| 166 | 171 |
| 167 @Override | 172 @Override |
| 168 protected void onDestroyInternal() { | 173 protected void onDestroyInternal() { |
| 169 if (mUpdateManager != null) { | 174 if (mUpdateManager != null) { |
| 170 mUpdateManager.destroy(); | 175 mUpdateManager.destroy(); |
| 171 } | 176 } |
| 172 super.onDestroyInternal(); | 177 super.onDestroyInternal(); |
| 173 } | 178 } |
| 174 } | 179 } |
| OLD | NEW |