| 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.document; | 5 package org.chromium.chrome.browser.document; |
| 6 | 6 |
| 7 import android.content.Intent; | 7 import android.content.Intent; |
| 8 | 8 |
| 9 import org.chromium.base.metrics.RecordHistogram; | 9 import org.chromium.base.metrics.RecordHistogram; |
| 10 import org.chromium.chrome.browser.BookmarkUtils; | |
| 11 import org.chromium.chrome.browser.IntentHandler; | 10 import org.chromium.chrome.browser.IntentHandler; |
| 11 import org.chromium.chrome.browser.ShortcutHelper; |
| 12 import org.chromium.chrome.browser.util.IntentUtils; | 12 import org.chromium.chrome.browser.util.IntentUtils; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Records UMA relevant to Document mode. | 15 * Records UMA relevant to Document mode. |
| 16 */ | 16 */ |
| 17 public class DocumentUma { | 17 public class DocumentUma { |
| 18 /** | 18 /** |
| 19 * Records what caused a DocumentActivity to be resumed. | 19 * Records what caused a DocumentActivity to be resumed. |
| 20 */ | 20 */ |
| 21 static void recordStartedBy(int source) { | 21 static void recordStartedBy(int source) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 int intentSource = DocumentMetricIds.STARTED_BY_UNKNOWN; | 41 int intentSource = DocumentMetricIds.STARTED_BY_UNKNOWN; |
| 42 IntentHandler.ExternalAppId appId = | 42 IntentHandler.ExternalAppId appId = |
| 43 IntentHandler.determineExternalIntentSource(packageName, intent)
; | 43 IntentHandler.determineExternalIntentSource(packageName, intent)
; |
| 44 | 44 |
| 45 if (intent.hasExtra(IntentHandler.EXTRA_STARTED_BY)) { | 45 if (intent.hasExtra(IntentHandler.EXTRA_STARTED_BY)) { |
| 46 intentSource = IntentUtils.safeGetIntExtra(intent, | 46 intentSource = IntentUtils.safeGetIntExtra(intent, |
| 47 IntentHandler.EXTRA_STARTED_BY, DocumentMetricIds.STARTED_BY
_UNKNOWN); | 47 IntentHandler.EXTRA_STARTED_BY, DocumentMetricIds.STARTED_BY
_UNKNOWN); |
| 48 } else if (IntentUtils.safeGetBooleanExtra(intent, | 48 } else if (IntentUtils.safeGetBooleanExtra(intent, |
| 49 BookmarkUtils.REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB, false)) { | 49 ShortcutHelper.REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB, false)) { |
| 50 // TODO(dfalcantara): Add a new a boolean instead of piggybacking on
this Intent extra. | 50 // TODO(dfalcantara): Add a new a boolean instead of piggybacking on
this Intent extra. |
| 51 intentSource = DocumentMetricIds.STARTED_BY_LAUNCHER; | 51 intentSource = DocumentMetricIds.STARTED_BY_LAUNCHER; |
| 52 } else if (IntentUtils.safeGetBooleanExtra( | 52 } else if (IntentUtils.safeGetBooleanExtra( |
| 53 intent, IntentHandler.EXTRA_APPEND_TASK, false)) { | 53 intent, IntentHandler.EXTRA_APPEND_TASK, false)) { |
| 54 intentSource = DocumentMetricIds.STARTED_BY_SEARCH_RESULT_PAGE; | 54 intentSource = DocumentMetricIds.STARTED_BY_SEARCH_RESULT_PAGE; |
| 55 } else if (IntentUtils.safeGetBooleanExtra( | 55 } else if (IntentUtils.safeGetBooleanExtra( |
| 56 intent, IntentHandler.EXTRA_PRESERVE_TASK, false)) { | 56 intent, IntentHandler.EXTRA_PRESERVE_TASK, false)) { |
| 57 // TODO(dfalcantara): Figure out how split apart Intents fired by th
e search box. | 57 // TODO(dfalcantara): Figure out how split apart Intents fired by th
e search box. |
| 58 intentSource = DocumentMetricIds.STARTED_BY_SEARCH_SUGGESTION_EXTERN
AL; | 58 intentSource = DocumentMetricIds.STARTED_BY_SEARCH_SUGGESTION_EXTERN
AL; |
| 59 } else if (appId == IntentHandler.ExternalAppId.GMAIL) { | 59 } else if (appId == IntentHandler.ExternalAppId.GMAIL) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 if (intentSource >= DocumentMetricIds.STARTED_BY_EXTERNAL_APP_GMAIL | 89 if (intentSource >= DocumentMetricIds.STARTED_BY_EXTERNAL_APP_GMAIL |
| 90 && intentSource < DocumentMetricIds.STARTED_BY_CONTEXTUAL_SEARCH
) { | 90 && intentSource < DocumentMetricIds.STARTED_BY_CONTEXTUAL_SEARCH
) { |
| 91 // Document activity was started from an external app, record which
one. | 91 // Document activity was started from an external app, record which
one. |
| 92 RecordHistogram.recordEnumeratedHistogram("MobileIntent.PageLoadDueT
oExternalApp", | 92 RecordHistogram.recordEnumeratedHistogram("MobileIntent.PageLoadDueT
oExternalApp", |
| 93 appId.ordinal(), IntentHandler.ExternalAppId.INDEX_BOUNDARY.
ordinal()); | 93 appId.ordinal(), IntentHandler.ExternalAppId.INDEX_BOUNDARY.
ordinal()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 recordStartedBy(intentSource); | 96 recordStartedBy(intentSource); |
| 97 } | 97 } |
| 98 } | 98 } |
| OLD | NEW |