#include "chrome/browser/ui/search/ntp_user_data_logger.h"
#include <algorithm>
#include <string>
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/trace_event/trace_event.h"
#include "chrome/browser/after_startup_task_utils.h"
#include "chrome/browser/search/background/ntp_custom_background_service.h"
#include "chrome/browser/search/background/ntp_custom_background_service_factory.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/ui/search/ntp_user_data_types.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/ntp_tiles/metrics.h"
#include "components/prefs/pref_service.h"
#include "components/search/ntp_features.h"
namespace {
constexpr char kUIEventCategory[] = …;
void LogCustomizedShortcutSettings(bool using_most_visited, bool is_visible) { … }
CustomizedFeature LoggingEventToCustomizedFeature(NTPLoggingEventType event) { … }
CustomizeChromeBackgroundAction LoggingEventToCustomizeChromeBackgroundAction(
NTPLoggingEventType event) { … }
CustomizeLocalImageBackgroundAction
LoggingEventToCustomizeLocalImageBackgroundAction(NTPLoggingEventType event) { … }
CustomizeShortcutAction LoggingEventToCustomizeShortcutAction(
NTPLoggingEventType event) { … }
const char* LoggingEventToBackgroundUserActionName(NTPLoggingEventType event) { … }
const char* LoggingEventToMenuUserActionName(NTPLoggingEventType event) { … }
const char* LoggingEventToShortcutUserActionName(NTPLoggingEventType event) { … }
enum LogoImpressionType { … };
enum LogoClickType { … };
LogoClickType LoggingEventToLogoClick(NTPLoggingEventType event) { … }
}
#define UMA_HISTOGRAM_LOAD_TIME(name, sample) …
NTPUserDataLogger::NTPUserDataLogger(Profile* profile,
const GURL& ntp_url,
base::Time ntp_navigation_start_time)
: … { … }
NTPUserDataLogger::~NTPUserDataLogger() = default;
void NTPUserDataLogger::LogOneGoogleBarFetchDuration(
bool success,
const base::TimeDelta& duration) { … }
void NTPUserDataLogger::LogEvent(NTPLoggingEventType event,
base::TimeDelta time) { … }
void NTPUserDataLogger::LogMostVisitedLoaded(base::TimeDelta time,
bool using_most_visited,
bool is_visible) { … }
void NTPUserDataLogger::LogMostVisitedImpression(
const ntp_tiles::NTPTileImpression& impression) { … }
void NTPUserDataLogger::LogMostVisitedNavigation(
const ntp_tiles::NTPTileImpression& impression) { … }
bool NTPUserDataLogger::DefaultSearchProviderIsGoogle() const { … }
bool NTPUserDataLogger::CustomBackgroundIsConfigured() const { … }
void NTPUserDataLogger::EmitNtpStatistics(base::TimeDelta load_time,
bool using_most_visited,
bool is_visible) { … }
void NTPUserDataLogger::EmitNtpTraceEvent(const char* event_name,
base::TimeDelta duration) { … }
void NTPUserDataLogger::RecordDoodleImpression(base::TimeDelta time,
bool is_cta,
bool from_cache) { … }
void NTPUserDataLogger::RecordAction(const char* action) { … }