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.graphics.drawable.Drawable; | 9 import android.graphics.drawable.Drawable; |
10 import android.net.Uri; | 10 import android.net.Uri; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 * Displays a webapp in a nearly UI-less Chrome (InfoBars still appear). | 45 * Displays a webapp in a nearly UI-less Chrome (InfoBars still appear). |
46 */ | 46 */ |
47 public class WebappActivity extends FullScreenActivity { | 47 public class WebappActivity extends FullScreenActivity { |
48 public static final String WEBAPP_SCHEME = "webapp"; | 48 public static final String WEBAPP_SCHEME = "webapp"; |
49 | 49 |
50 private static final String TAG = "WebappActivity"; | 50 private static final String TAG = "WebappActivity"; |
51 private static final long MS_BEFORE_NAVIGATING_BACK_FROM_INTERSTITIAL = 1000
; | 51 private static final long MS_BEFORE_NAVIGATING_BACK_FROM_INTERSTITIAL = 1000
; |
52 | 52 |
53 private final WebappInfo mWebappInfo; | 53 private final WebappInfo mWebappInfo; |
54 private AsyncTask<WebappActivity, Void, Void> mCleanupTask; | 54 private AsyncTask<WebappActivity, Void, Void> mCleanupTask; |
| 55 private boolean mOldWebappCleanupStarted; |
55 | 56 |
56 private WebContentsObserver mWebContentsObserver; | 57 private WebContentsObserver mWebContentsObserver; |
57 | 58 |
58 private ViewGroup mSplashScreen; | 59 private ViewGroup mSplashScreen; |
59 private WebappUrlBar mUrlBar; | 60 private WebappUrlBar mUrlBar; |
60 | 61 |
61 private boolean mIsInitialized; | 62 private boolean mIsInitialized; |
62 private Integer mBrandColor; | 63 private Integer mBrandColor; |
63 | 64 |
64 /** | 65 /** |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 @Override | 150 @Override |
150 public void onResume() { | 151 public void onResume() { |
151 if (!isFinishing()) { | 152 if (!isFinishing()) { |
152 if (getIntent() != null) { | 153 if (getIntent() != null) { |
153 // Avoid situations where Android starts two Activities with the
same data. | 154 // Avoid situations where Android starts two Activities with the
same data. |
154 DocumentUtils.finishOtherTasksWithData(getIntent().getData(), ge
tTaskId()); | 155 DocumentUtils.finishOtherTasksWithData(getIntent().getData(), ge
tTaskId()); |
155 } | 156 } |
156 updateTaskDescription(); | 157 updateTaskDescription(); |
157 } | 158 } |
158 super.onResume(); | 159 super.onResume(); |
| 160 |
| 161 // Kick off the old web app cleanup (if we haven't alread) now that we h
ave queued the |
| 162 // current web app's storage to be opened. |
| 163 if (!mOldWebappCleanupStarted) { |
| 164 WebappRegistry.unregisterOldWebapps(this, System.currentTimeMillis()
); |
| 165 mOldWebappCleanupStarted = true; |
| 166 } |
159 } | 167 } |
160 | 168 |
161 @Override | 169 @Override |
162 protected int getControlContainerLayoutId() { | 170 protected int getControlContainerLayoutId() { |
163 return R.layout.webapp_control_container; | 171 return R.layout.webapp_control_container; |
164 } | 172 } |
165 | 173 |
166 @Override | 174 @Override |
167 public void postInflationStartup() { | 175 public void postInflationStartup() { |
168 initializeSplashScreen(); | 176 initializeSplashScreen(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 return visible; | 419 return visible; |
412 } | 420 } |
413 | 421 |
414 // We're temporarily disable CS on webapp since there are some issues. (http
://crbug.com/471950) | 422 // We're temporarily disable CS on webapp since there are some issues. (http
://crbug.com/471950) |
415 // TODO(changwan): re-enable it once the issues are resolved. | 423 // TODO(changwan): re-enable it once the issues are resolved. |
416 @Override | 424 @Override |
417 protected boolean isContextualSearchAllowed() { | 425 protected boolean isContextualSearchAllowed() { |
418 return false; | 426 return false; |
419 } | 427 } |
420 } | 428 } |
OLD | NEW |