blob: a1b1440fa77532c0aa00a9fa38098e0eb09a8ed6 (
plain)
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
|
// Copyright 2021 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 COMPONENTS_FEED_CORE_V2_STREAM_UPLOAD_CRITERIA_H_
#define COMPONENTS_FEED_CORE_V2_STREAM_UPLOAD_CRITERIA_H_
#include "base/memory/raw_ptr.h"
class PrefService;
namespace feed {
namespace feed_stream {
// Determines whether we can upload actions.
class UploadCriteria {
public:
explicit UploadCriteria(PrefService* profile_prefs);
UploadCriteria(const UploadCriteria&) = delete;
UploadCriteria& operator=(const UploadCriteria&) = delete;
bool CanUploadActions() const;
// Events to update criteria.
void SurfaceOpenedOrClosed();
void Clear();
private:
bool HasReachedConditionsToUploadActionsWithNoticeCard();
void UpdateCanUploadActionsWithNoticeCard();
raw_ptr<PrefService> profile_prefs_;
// Whether the feed stream can upload actions with the notice card in the
// feed. This is cached so that we enable uploads in the session after the
// criteria was met.
bool can_upload_actions_with_notice_card_ = false;
};
} // namespace feed_stream
} // namespace feed
#endif // COMPONENTS_FEED_CORE_V2_STREAM_UPLOAD_CRITERIA_H_
|