| 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.Color; | 9 import android.graphics.Color; |
| 10 import android.graphics.drawable.Drawable; | 10 import android.graphics.drawable.Drawable; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 super.onSaveInstanceState(outState); | 145 super.onSaveInstanceState(outState); |
| 146 if (getActivityTab() != null) { | 146 if (getActivityTab() != null) { |
| 147 outState.putInt(BUNDLE_TAB_ID, getActivityTab().getId()); | 147 outState.putInt(BUNDLE_TAB_ID, getActivityTab().getId()); |
| 148 outState.putString(BUNDLE_TAB_URL, getActivityTab().getUrl()); | 148 outState.putString(BUNDLE_TAB_URL, getActivityTab().getUrl()); |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 @Override | 152 @Override |
| 153 public void onStartWithNative() { | 153 public void onStartWithNative() { |
| 154 super.onStartWithNative(); | 154 super.onStartWithNative(); |
| 155 mDirectoryManager.cleanUpDirectories(this, getId()); | 155 mDirectoryManager.cleanUpDirectories(this, getActivityId()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 @Override | 158 @Override |
| 159 public void onStopWithNative() { | 159 public void onStopWithNative() { |
| 160 super.onStopWithNative(); | 160 super.onStopWithNative(); |
| 161 mDirectoryManager.cancelCleanup(); | 161 mDirectoryManager.cancelCleanup(); |
| 162 if (getActivityTab() != null) saveState(getActivityDirectory()); | 162 if (getActivityTab() != null) saveState(getActivityDirectory()); |
| 163 if (getFullscreenManager() != null) { | 163 if (getFullscreenManager() != null) { |
| 164 getFullscreenManager().setPersistentFullscreenMode(false); | 164 getFullscreenManager().setPersistentFullscreenMode(false); |
| 165 } | 165 } |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 ApiCompatibilityUtils.setTaskDescription(this, title, icon, | 493 ApiCompatibilityUtils.setTaskDescription(this, title, icon, |
| 494 ColorUtils.getOpaqueColor(taskDescriptionColor)); | 494 ColorUtils.getOpaqueColor(taskDescriptionColor)); |
| 495 ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor); | 495 ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor); |
| 496 } | 496 } |
| 497 | 497 |
| 498 @Override | 498 @Override |
| 499 protected void setStatusBarColor(Tab tab, int color) { | 499 protected void setStatusBarColor(Tab tab, int color) { |
| 500 // Intentionally do nothing as WebappActivity explicitly sets status bar
color. | 500 // Intentionally do nothing as WebappActivity explicitly sets status bar
color. |
| 501 } | 501 } |
| 502 | 502 |
| 503 /** Returns a unique identifier for this WebappActivity. */ | 503 /** |
| 504 protected String getId() { | 504 * Returns a unique identifier for this WebappActivity. |
| 505 * Note: do not call this function when you need {@link WebappInfo#id()}. Su
bclasses like |
| 506 * WebappManagedActivity and WebApkManagedActivity overwrite this function a
nd return the |
| 507 * index of the activity. |
| 508 */ |
| 509 protected String getActivityId() { |
| 505 return mWebappInfo.id(); | 510 return mWebappInfo.id(); |
| 506 } | 511 } |
| 507 | 512 |
| 508 /** | 513 /** |
| 509 * Get the active directory by this web app. | 514 * Get the active directory by this web app. |
| 510 * | 515 * |
| 511 * @return The directory used for the current web app. | 516 * @return The directory used for the current web app. |
| 512 */ | 517 */ |
| 513 @Override | 518 @Override |
| 514 protected final File getActivityDirectory() { | 519 protected final File getActivityDirectory() { |
| 515 return mDirectoryManager.getWebappDirectory(this, getId()); | 520 return mDirectoryManager.getWebappDirectory(this, getActivityId()); |
| 516 } | 521 } |
| 517 | 522 |
| 518 private void hideSplashScreen(final int reason) { | 523 private void hideSplashScreen(final int reason) { |
| 519 if (mSplashScreen == null) return; | 524 if (mSplashScreen == null) return; |
| 520 | 525 |
| 521 mSplashScreen.animate() | 526 mSplashScreen.animate() |
| 522 .alpha(0f) | 527 .alpha(0f) |
| 523 .withEndAction(new Runnable() { | 528 .withEndAction(new Runnable() { |
| 524 @Override | 529 @Override |
| 525 public void run() { | 530 public void run() { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 return new WebappDelegateFactory(this); | 580 return new WebappDelegateFactory(this); |
| 576 } | 581 } |
| 577 | 582 |
| 578 // We're temporarily disable CS on webapp since there are some issues. (http
://crbug.com/471950) | 583 // We're temporarily disable CS on webapp since there are some issues. (http
://crbug.com/471950) |
| 579 // TODO(changwan): re-enable it once the issues are resolved. | 584 // TODO(changwan): re-enable it once the issues are resolved. |
| 580 @Override | 585 @Override |
| 581 protected boolean isContextualSearchAllowed() { | 586 protected boolean isContextualSearchAllowed() { |
| 582 return false; | 587 return false; |
| 583 } | 588 } |
| 584 } | 589 } |
| OLD | NEW |