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

Unified Diff: components/translate/core/browser/translate_ranker.h

Issue 2395253002: Send TranslateEventProtos to UMA. (Closed)
Patch Set: nit Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/translate/core/browser/translate_ranker.h
diff --git a/components/translate/core/browser/translate_ranker.h b/components/translate/core/browser/translate_ranker.h
index 6444b9b62d9ed25c0fcb7ff19643d1d40129401b..7d039ab68edd4699851e620efae8bf53ec47db33 100644
--- a/components/translate/core/browser/translate_ranker.h
+++ b/components/translate/core/browser/translate_ranker.h
@@ -16,6 +16,10 @@ namespace chrome_intelligence {
class TranslateRankerModel;
}
+namespace metrics {
+class TranslateEventProto;
+}
+
namespace translate {
class TranslatePrefs;
@@ -59,6 +63,15 @@ class TranslateRanker {
// Returns the model version (a date stamp) or 0 if there is no valid model.
int GetModelVersion() const;
+ // Caches the translate event.
+ void RecordTranslateEvent(
+ const metrics::TranslateEventProto& translate_event);
+
+ // Transfers cached translate events to the given vector pointer and clears
+ // the cache.
+ void FlushTranslateEvents(
+ std::vector<metrics::TranslateEventProto>* translate_events);
+
private:
// The ID which is assigned to the underlying URLFetcher.
static constexpr int kFetcherId = 2;
@@ -91,6 +104,9 @@ class TranslateRanker {
// Used for UMA reporting of timing.
base::Time download_start_time_;
+ // Saved cache of translate event protos.
+ std::vector<metrics::TranslateEventProto> translate_events_cache_;
+
FRIEND_TEST_ALL_PREFIXES(TranslateRankerTest, CalculateScore);
friend struct base::DefaultSingletonTraits<TranslateRanker>;

Powered by Google App Engine
This is Rietveld 408576698