1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160

ash / system / time / calendar_metrics.h [blame]

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SYSTEM_TIME_CALENDAR_METRICS_H_
#define ASH_SYSTEM_TIME_CALENDAR_METRICS_H_

#include <cstddef>
#include <string>

#include "google_apis/common/api_error_codes.h"

namespace ui {
class AnimationThroughputReporter;
class Event;
}  // namespace ui

namespace base {
class TimeDelta;
class TimeTicks;
}  // namespace base

namespace views {
class View;
}  // namespace views

namespace ash {

namespace calendar_metrics {

// The event types CalendarView is interested in. These are used in histograms,
// do not remove/renumber entries. If you're adding to this enum with the
// intention that it will be logged, update the CalendarEventSource listing in
// enums.xml.
enum class CalendarEventSource {
  kInvalid = 0,
  kTap = 1,
  kClick = 2,
  kKeyboard = 3,
  kStylus = 4,
  kMaxValue = kStylus
};

// The different hosts which hold components allowing a user to open the
// calendar. These are used in histograms, do not remove/renumber entries. If
// you're adding to this enum with the intention that it will be logged, update
// the CalendarViewShowSource token variant in histograms.xml.
enum class CalendarViewShowSource {
  kTimeView = 0,  // Shown via activating the time view in the status area.
  kDateView = 1,  // Shown via activating the  date view in the quick settings
                  // bubble.
  kAccelerator = 2,  // Shown via activating the accelerator.
  kMaxValue = kAccelerator
};

// Sources of scrolling inside the calendar view. These are used in histograms,
// do not remove/renumber entries. If you're adding to this enum with the
// intention that it will be logged, update the CalendarViewScrollSource token
// variant in enums.xml.
enum class CalendarViewScrollSource {
  kByMouseWheel = 0,
  kByGesture = 1,
  kByFling = 2,
  kByStylus = 3,
  kMaxValue = kByStylus
};

// The keys pressed by a user to navigate the calendar by using the keyboard.
// These are used in histograms, do not remove/renumber entries. If you're
// adding to this enum with the intention that it will be logged, update the
// CalendarKeyboardNavigationSource enum in enums.xml.
enum class CalendarKeyboardNavigationSource {
  kTab = 0,
  kArrowKeys = 1,
  kMaxValue = kArrowKeys
};

// Converts the given event into an appropriate CalendarEventSource.
CalendarEventSource GetEventType(const ui::Event& event);

// Records calendar show metrics for a given CalendarViewShowSource
void RecordCalendarShowMetrics(
    CalendarViewShowSource show_source,
    calendar_metrics::CalendarEventSource event_source);

void RecordCalendarDateCellActivated(const ui::Event& event);

void RecordMonthArrowButtonActivated(bool up, const ui::Event& event);

void RecordEventListItemActivated(const ui::Event& event);

void RecordEventListForTodayActivated();

void RecordMonthDwellTime(const base::TimeDelta& dwell_time);

void RecordResetToTodayPressed();

void RecordScrollSource(CalendarViewScrollSource source);

ui::AnimationThroughputReporter CreateAnimationReporter(
    views::View* view,
    const std::string& animation_histogram_name);

void RecordCalendarKeyboardNavigation(
    const CalendarKeyboardNavigationSource key_source);

void RecordEventListItemInUpNextLaunched(const ui::Event& event);

void RecordUpNextEventCount(const int event_count);

void RecordJoinButtonPressedFromEventListView(const ui::Event& event);

void RecordJoinButtonPressedFromUpNextView(const ui::Event& event);

void RecordEventListEventCount(const int event_count);

void RecordEventsDisplayedToUser();

void RecordScrollEventInUpNext();

void RecordCalendarLaunchedFromEmptyEventList();

void RecordEventListClosed();

void RecordSettingsButtonPressed();

void RecordCalendarListFetchDuration(const base::TimeDelta fetch_duration);

void RecordCalendarListFetchErrorCode(google_apis::ApiErrorCode error);

void RecordCalendarListFetchTimeout(bool fetch_timed_out);

void RecordEventListFetchDuration(const base::TimeDelta fetch_duration);

void RecordEventListFetchErrorCode(google_apis::ApiErrorCode error);

void RecordEventListFetchTimeout(bool fetch_timed_out);

void RecordEventListFetchesTotalDuration(const base::TimeDelta fetch_duration);

void RecordSingleMonthSizeInBytes(size_t single_month_cache_size);

void RecordTotalEventsCacheSizeInMonths(unsigned int events_cache_size);

void RecordTotalSelectedCalendars(unsigned int selected_calendars);

void RecordTimeToSeeTodaysEventDots(const base::TimeDelta time_elapsed,
                                    bool multi_calendar_enabled);

void RecordTimeToSeeTodaysPrimaryCalendarEventDots(
    const base::TimeTicks time_elapsed);

void RecordTimeToSeeTodaysMultiCalendarEventDots(
    const base::TimeTicks time_elapsed);

}  // namespace calendar_metrics

}  // namespace ash

#endif  // ASH_SYSTEM_TIME_CALENDAR_METRICS_H_