| 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.ntp; | 5 package org.chromium.chrome.browser.ntp; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.app.ActivityManager; | 9 import android.app.ActivityManager; |
| 10 import android.app.Dialog; | 10 import android.app.Dialog; |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 if (mIsDestroyed) return; | 524 if (mIsDestroyed) return; |
| 525 | 525 |
| 526 recordNTPShown(); | 526 recordNTPShown(); |
| 527 | 527 |
| 528 int tileTypes[] = new int[items.length]; | 528 int tileTypes[] = new int[items.length]; |
| 529 for (int i = 0; i < items.length; i++) { | 529 for (int i = 0; i < items.length; i++) { |
| 530 tileTypes[i] = items[i].getTileType(); | 530 tileTypes[i] = items[i].getTileType(); |
| 531 } | 531 } |
| 532 mMostVisitedSites.recordTileTypeMetrics(tileTypes); | 532 mMostVisitedSites.recordTileTypeMetrics(tileTypes); |
| 533 | 533 |
| 534 if (isNtpOfflinePagesEnabled()) { |
| 535 final int maxNumTiles = 12; |
| 536 for (int i = 0; i < items.length; i++) { |
| 537 if (items[i].isOfflineAvailable()) { |
| 538 RecordHistogram.recordEnumeratedHistogram( |
| 539 "NewTabPage.TileOfflineAvailable", i, maxNumTile
s); |
| 540 } |
| 541 } |
| 542 } |
| 543 |
| 534 SyncSessionsMetrics.recordYoungestForeignTabAgeOnNTP(); | 544 SyncSessionsMetrics.recordYoungestForeignTabAgeOnNTP(); |
| 535 } | 545 } |
| 536 }; | 546 }; |
| 537 | 547 |
| 538 /** | 548 /** |
| 539 * Constructs a NewTabPage. | 549 * Constructs a NewTabPage. |
| 540 * @param activity The activity used for context to create the new tab page'
s View. | 550 * @param activity The activity used for context to create the new tab page'
s View. |
| 541 * @param tab The Tab that is showing this new tab page. | 551 * @param tab The Tab that is showing this new tab page. |
| 542 * @param tabModelSelector The TabModelSelector used to open tabs. | 552 * @param tabModelSelector The TabModelSelector used to open tabs. |
| 543 */ | 553 */ |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 @Override | 822 @Override |
| 813 public boolean shouldCaptureThumbnail() { | 823 public boolean shouldCaptureThumbnail() { |
| 814 return mNewTabPageView.shouldCaptureThumbnail(); | 824 return mNewTabPageView.shouldCaptureThumbnail(); |
| 815 } | 825 } |
| 816 | 826 |
| 817 @Override | 827 @Override |
| 818 public void captureThumbnail(Canvas canvas) { | 828 public void captureThumbnail(Canvas canvas) { |
| 819 mNewTabPageView.captureThumbnail(canvas); | 829 mNewTabPageView.captureThumbnail(canvas); |
| 820 } | 830 } |
| 821 } | 831 } |
| OLD | NEW |