Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(566)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java

Issue 2930553002: Add UMA metric to track the time elapsed since a WebAPK was last launched (Closed)
Patch Set: Merge branch 'master' into last_launched Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // user clearing their history or not launching the web app recently. 398 // user clearing their history or not launching the web app recently.
399 // Restore the data if necessary from the intent. 399 // Restore the data if necessary from the intent.
400 storage.updateFromShortcutIntent(getIntent()); 400 storage.updateFromShortcutIntent(getIntent());
401 401
402 // A recent last used time is the indicator that the web app is still 402 // A recent last used time is the indicator that the web app is still
403 // present on the home screen, and enables sources such as notifications to 403 // present on the home screen, and enables sources such as notifications to
404 // launch web apps. Thus, we do not update the last used time when the w eb 404 // launch web apps. Thus, we do not update the last used time when the w eb
405 // app is not directly launched from the home screen, as this interferes 405 // app is not directly launched from the home screen, as this interferes
406 // with the heuristic. 406 // with the heuristic.
407 if (mWebappInfo.isLaunchedFromHomescreen()) { 407 if (mWebappInfo.isLaunchedFromHomescreen()) {
408 onWillUpdateLastUsedTime(storage);
dominickn 2017/06/08 05:15:27 It would be good if you could add a quick test tha
pkotwicz 2017/06/12 20:34:46 How do you suggest that I add such a test? I don't
dominickn 2017/06/14 00:19:39 Ah yes, the integration test is sufficient with an
409 storage.setWasLaunched();
dominickn 2017/06/08 05:15:27 I think you need to setWasLaunched() before onWill
pkotwicz 2017/06/12 20:34:46 Actually, it is important for the WebApkActivity m
408 storage.updateLastUsedTime(); 410 storage.updateLastUsedTime();
409 } 411 }
410 } 412 }
411 413
414 /** Called prior to updating the "last used" time in WebappDataStorage. */
415 protected void onWillUpdateLastUsedTime(WebappDataStorage storage) {}
416
412 protected void initializeSplashScreenWidgets(int backgroundColor, Bitmap spl ashImage) { 417 protected void initializeSplashScreenWidgets(int backgroundColor, Bitmap spl ashImage) {
413 Bitmap displayIcon = splashImage == null ? mWebappInfo.icon() : splashIm age; 418 Bitmap displayIcon = splashImage == null ? mWebappInfo.icon() : splashIm age;
414 int minimiumSizeThreshold = getResources().getDimensionPixelSize( 419 int minimiumSizeThreshold = getResources().getDimensionPixelSize(
415 R.dimen.webapp_splash_image_size_minimum); 420 R.dimen.webapp_splash_image_size_minimum);
416 int bigThreshold = getResources().getDimensionPixelSize( 421 int bigThreshold = getResources().getDimensionPixelSize(
417 R.dimen.webapp_splash_image_size_threshold); 422 R.dimen.webapp_splash_image_size_threshold);
418 423
419 // Inflate the correct layout for the image. 424 // Inflate the correct layout for the image.
420 int layoutId; 425 int layoutId;
421 if (displayIcon == null || displayIcon.getWidth() < minimiumSizeThreshol d 426 if (displayIcon == null || displayIcon.getWidth() < minimiumSizeThreshol d
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 return new WebappDelegateFactory(this); 719 return new WebappDelegateFactory(this);
715 } 720 }
716 721
717 // We're temporarily disable CS on webapp since there are some issues. (http ://crbug.com/471950) 722 // We're temporarily disable CS on webapp since there are some issues. (http ://crbug.com/471950)
718 // TODO(changwan): re-enable it once the issues are resolved. 723 // TODO(changwan): re-enable it once the issues are resolved.
719 @Override 724 @Override
720 protected boolean isContextualSearchAllowed() { 725 protected boolean isContextualSearchAllowed() {
721 return false; 726 return false;
722 } 727 }
723 } 728 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698