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
ash / wallpaper / wallpaper_metrics_manager.h [blame]
// Copyright 2012 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_WALLPAPER_WALLPAPER_METRICS_MANAGER_H_
#define ASH_WALLPAPER_WALLPAPER_METRICS_MANAGER_H_
#include "ash/ash_export.h"
#include "ash/public/cpp/wallpaper/online_wallpaper_params.h"
#include "ash/public/cpp/wallpaper/wallpaper_controller.h"
#include "ash/public/cpp/wallpaper/wallpaper_controller_observer.h"
#include "ash/public/cpp/wallpaper/wallpaper_types.h"
#include "base/scoped_observation.h"
namespace ash {
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class SetWallpaperResult {
kSuccess = 0,
kPermissionDenied,
kNetworkError,
kDecodingError,
kInvalidState,
kRequestFailure,
kFileNotFound,
kMaxValue = kFileNotFound,
};
// The implementation of WallpaperControllerObserver that saves metrics.
class ASH_EXPORT WallpaperMetricsManager : public WallpaperControllerObserver {
public:
WallpaperMetricsManager();
WallpaperMetricsManager(const WallpaperMetricsManager&) = delete;
WallpaperMetricsManager& operator=(const WallpaperMetricsManager&) = delete;
~WallpaperMetricsManager() override;
static std::string ToResultHistogram(WallpaperType type);
// WallpaperControllerObserver:
void OnOnlineWallpaperSet(const OnlineWallpaperParams& params) override;
void OnWallpaperChanged() override;
void OnWallpaperPreviewStarted() override;
void LogSettingTimeOfDayWallpaperAfterOobe(bool success);
void LogWallpaperResult(WallpaperType type, SetWallpaperResult reason);
private:
base::ScopedObservation<WallpaperController, WallpaperControllerObserver>
wallpaper_controller_observation_{this};
};
} // namespace ash
#endif // ASH_WALLPAPER_WALLPAPER_METRICS_MANAGER_H_