Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: components/feature_engagement_tracker/internal/init_aware_model.h

Issue 2877243002: Support IPH NotifyEvent calls before Initialize (Closed)
Patch Set: Fixed build.gn Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_INIT_AWARE_MODEL_H_
6 #define COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_INIT_AWARE_MODEL_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11 #include <string>
12 #include <tuple>
13 #include <vector>
14
15 #include "base/memory/weak_ptr.h"
16 #include "components/feature_engagement_tracker/internal/model.h"
17
18 namespace feature_engagement_tracker {
19
20 class InitAwareModel : public Model {
21 public:
22 InitAwareModel(std::unique_ptr<Model> model);
23 ~InitAwareModel() override;
24
25 // Model implementation.
26 void Initialize(const OnModelInitializationFinished& callback,
27 uint32_t current_day) override;
28 bool IsReady() const override;
29 const Event* GetEvent(const std::string& event_name) const override;
30 void IncrementEvent(const std::string& event_name,
31 uint32_t current_day) override;
32
33 private:
34 void OnInitializeComplete(const OnModelInitializationFinished& callback,
35 bool success);
36
37 std::unique_ptr<Model> model_;
38 std::vector<std::tuple<std::string, uint32_t>> queued_events_;
39
40 base::WeakPtrFactory<InitAwareModel> weak_ptr_factory_;
41
42 DISALLOW_COPY_AND_ASSIGN(InitAwareModel);
43 };
44
45 } // namespace feature_engagement_tracker
46
47 #endif // COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_INIT_AWARE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698