| // Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_METRICS_H_ |
| #define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_METRICS_H_ |
| |
| #import "base/time/time.h" |
| #import "ios/chrome/browser/ui/contextual_search/contextual_search_controller.h" |
| #import "ios/chrome/browser/ui/contextual_search/contextual_search_panel_state.h" |
| #import "ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.h" |
| |
| namespace ContextualSearch { |
| |
| // Record the contextual search pref state at startup. |
| void RecordPreferenceState(TouchToSearch::TouchToSearchPreferenceState state); |
| |
| // Record when the contextual search preference changes; if |enabled| then the |
| // preference was turned on. Notes that RecordFirstRunFlowOutcome() should be |
| // used instead after the first run flow. |
| void RecordPreferenceChanged(bool enabled); |
| |
| // Record the contextual search pref state after the first run flow completes. |
| void RecordFirstRunFlowOutcome( |
| TouchToSearch::TouchToSearchPreferenceState state); |
| |
| // Record the time between the start of a new search and showing the search |
| // results. |
| void RecordDuration(bool resultsSeen, bool chained, base::TimeDelta duration); |
| |
| // Record the time between the user tapping and starting a search. |
| void RecordTimeToSearch(base::TimeDelta duration); |
| |
| // Record whether the first run flow's panel was seen during the contextual |
| // search. This should only be called when the user exits the search still |
| // in the undecided state. |seen| should be true if the user saw the first |
| // run flow view, or false if they didn't (for example, if they had not yet |
| // opted in, triggered a search, and then dismissed the panel). |
| void RecordFirstRunPanelSeen(bool seen); |
| |
| // Record that the search results generated by a tap were created, and if the |
| // user saw them. |
| void RecordTapResultsSeen(bool seen); |
| |
| // Record that the search results generated by a long-press selection were |
| // created, and if the user saw them. |
| void RecordSelectionResultsSeen(bool seen); |
| |
| // Record when a user makes a tap, if it resulted in a valid selection. |
| void RecordSelectionIsValid(bool valid); |
| |
| // Record the first time the panel enters |to_state|, which state it came from |
| // and why. |
| void RecordFirstStateEntry(PanelState from_state, |
| PanelState to_state, |
| StateChangeReason reason); |
| |
| // Record the first time the panel exits |from_state|, which state it changed |
| // to and why. |
| void RecordFirstStateExit(PanelState from_state, |
| PanelState to_state, |
| StateChangeReason reason); |
| |
| } // namespace ContextualSearch |
| |
| #endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_METRICS_H_ |