| 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.contextualsearch; | 5 package org.chromium.chrome.browser.contextualsearch; |
| 6 | 6 |
| 7 import android.util.Pair; | 7 import android.util.Pair; |
| 8 | 8 |
| 9 import org.chromium.base.metrics.RecordHistogram; | 9 import org.chromium.base.metrics.RecordHistogram; |
| 10 import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.Context
ualSearchPanel.PanelState; | 10 import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.Context
ualSearchPanel.PanelState; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 PROMO_DISABLED_FROM_LONG_PRESS); | 405 PROMO_DISABLED_FROM_LONG_PRESS); |
| 406 codes.put(new Pair<Integer, Boolean>(PREFERENCE_UNINITIALIZED, LONG_PRES
S), | 406 codes.put(new Pair<Integer, Boolean>(PREFERENCE_UNINITIALIZED, LONG_PRES
S), |
| 407 PROMO_UNDECIDED_FROM_LONG_PRESS); | 407 PROMO_UNDECIDED_FROM_LONG_PRESS); |
| 408 PROMO_BY_GESTURE_CODES = Collections.unmodifiableMap(codes); | 408 PROMO_BY_GESTURE_CODES = Collections.unmodifiableMap(codes); |
| 409 } | 409 } |
| 410 | 410 |
| 411 /** | 411 /** |
| 412 * Logs the state of the Contextual Search preference. This function should
be called if the | 412 * Logs the state of the Contextual Search preference. This function should
be called if the |
| 413 * Contextual Search feature is enabled, and will track the different prefer
ence settings | 413 * Contextual Search feature is enabled, and will track the different prefer
ence settings |
| 414 * (disabled, enabled or uninitialized). Calling more than once is fine. | 414 * (disabled, enabled or uninitialized). Calling more than once is fine. |
| 415 * This is deprecated; pass the number of taps remaining to logPreferenceSta
te. | |
| 416 */ | |
| 417 @Deprecated | |
| 418 public static void logPreferenceState() { | |
| 419 logPreferenceState(PROMO_TAPS_REMAINING_INVALID); | |
| 420 } | |
| 421 | |
| 422 /** | |
| 423 * Logs the state of the Contextual Search preference. This function should
be called if the | |
| 424 * Contextual Search feature is enabled, and will track the different prefer
ence settings | |
| 425 * (disabled, enabled or uninitialized). Calling more than once is fine. | |
| 426 * @param promoTapsRemaining The number of taps remaining, or -1 if not appl
icable. | 415 * @param promoTapsRemaining The number of taps remaining, or -1 if not appl
icable. |
| 427 */ | 416 */ |
| 428 public static void logPreferenceState(int promoTapsRemaining) { | 417 public static void logPreferenceState(int promoTapsRemaining) { |
| 429 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPrefer
enceState", | 418 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPrefer
enceState", |
| 430 getPreferenceValue(), PREFERENCE_HISTOGRAM_BOUNDARY); | 419 getPreferenceValue(), PREFERENCE_HISTOGRAM_BOUNDARY); |
| 431 if (promoTapsRemaining != PROMO_TAPS_REMAINING_INVALID) { | 420 if (promoTapsRemaining != PROMO_TAPS_REMAINING_INVALID) { |
| 432 RecordHistogram.recordCountHistogram("Search.ContextualSearchPromoTa
psRemaining", | 421 RecordHistogram.recordCountHistogram("Search.ContextualSearchPromoTa
psRemaining", |
| 433 promoTapsRemaining); | 422 promoTapsRemaining); |
| 434 } | 423 } |
| 435 } | 424 } |
| 436 | 425 |
| 437 /** | 426 /** |
| 438 * Logs changes to the Contextual Search preference, aside from those result
ing from the first | 427 * Logs changes to the Contextual Search preference, aside from those result
ing from the first |
| 439 * run flow. | 428 * run flow. |
| 440 * @param enabled Whether the preference is being enabled or disabled. | 429 * @param enabled Whether the preference is being enabled or disabled. |
| 441 */ | 430 */ |
| 442 public static void logPreferenceChange(boolean enabled) { | 431 public static void logPreferenceChange(boolean enabled) { |
| 443 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPrefer
enceStateChange", | 432 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPrefer
enceStateChange", |
| 444 enabled ? PREFERENCE_ENABLED : PREFERENCE_DISABLED, PREFERENCE_H
ISTOGRAM_BOUNDARY); | 433 enabled ? PREFERENCE_ENABLED : PREFERENCE_DISABLED, PREFERENCE_H
ISTOGRAM_BOUNDARY); |
| 445 } | 434 } |
| 446 | 435 |
| 447 /** | 436 /** |
| 448 * Logs the outcome of a first run flow. | |
| 449 * This is deprecated; call logPromoOutcome instead. | |
| 450 */ | |
| 451 @Deprecated | |
| 452 public static void logFirstRunFlowOutcome() { | |
| 453 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchFirstR
unFlowOutcome", | |
| 454 getPreferenceValue(), PREFERENCE_HISTOGRAM_BOUNDARY); | |
| 455 } | |
| 456 | |
| 457 /** | |
| 458 * Logs the outcome of the promo (first run flow). | 437 * Logs the outcome of the promo (first run flow). |
| 459 * Logs multiple histograms; with and without the originating gesture. | 438 * Logs multiple histograms; with and without the originating gesture. |
| 460 * @param wasTap Whether the gesture that originally caused the panel to sho
w was a Tap. | 439 * @param wasTap Whether the gesture that originally caused the panel to sho
w was a Tap. |
| 461 */ | 440 */ |
| 462 public static void logPromoOutcome(boolean wasTap) { | 441 public static void logPromoOutcome(boolean wasTap) { |
| 463 int preferenceCode = getPreferenceValue(); | 442 int preferenceCode = getPreferenceValue(); |
| 464 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchFirstR
unFlowOutcome", | 443 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchFirstR
unFlowOutcome", |
| 465 preferenceCode, PREFERENCE_HISTOGRAM_BOUNDARY); | 444 preferenceCode, PREFERENCE_HISTOGRAM_BOUNDARY); |
| 466 int preferenceByGestureCode = getPromoByGestureStateCode(preferenceCode,
wasTap); | 445 int preferenceByGestureCode = getPromoByGestureStateCode(preferenceCode,
wasTap); |
| 467 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPromoO
utcomeByGesture", | 446 RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPromoO
utcomeByGesture", |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 * @param wasTap Whether the gesture that originally caused the panel to sho
w was a Tap. | 694 * @param wasTap Whether the gesture that originally caused the panel to sho
w was a Tap. |
| 716 * @param histogramName The full name of the histogram to log to. | 695 * @param histogramName The full name of the histogram to log to. |
| 717 */ | 696 */ |
| 718 private static void logHistogramByGesture(boolean wasPanelSeen, boolean wasT
ap, | 697 private static void logHistogramByGesture(boolean wasPanelSeen, boolean wasT
ap, |
| 719 String histogramName) { | 698 String histogramName) { |
| 720 RecordHistogram.recordEnumeratedHistogram(histogramName, | 699 RecordHistogram.recordEnumeratedHistogram(histogramName, |
| 721 getPanelSeenByGestureStateCode(wasPanelSeen, wasTap), | 700 getPanelSeenByGestureStateCode(wasPanelSeen, wasTap), |
| 722 RESULTS_BY_GESTURE_BOUNDARY); | 701 RESULTS_BY_GESTURE_BOUNDARY); |
| 723 } | 702 } |
| 724 } | 703 } |
| OLD | NEW |