Index: chrome/browser/android/logo_bridge.h |
diff --git a/chrome/browser/android/logo_bridge.h b/chrome/browser/android/logo_bridge.h |
index 89f5f48b12a3ecf1dbc0e09e08098b45d4aee407..1c0f5b1e04bf285202f9c2de7cae6790b4a601e2 100644 |
--- a/chrome/browser/android/logo_bridge.h |
+++ b/chrome/browser/android/logo_bridge.h |
@@ -35,6 +35,18 @@ struct RequestMetadata; |
// default search provider's logo. |
class LogoBridge : public doodle::DoodleService::Observer { |
public: |
+ // Stores its creation time and writes it to a UMA histogram. Each instance |
+ // writes the metric once or never. |
+ class LoadTimeMetricRecorder { |
+ public: |
+ // Writes the diff between |Now| and the recorders creation time to a UMA |
+ // metric. If the recorder was aborted/finished before, nothing happens. |
+ virtual void Finish() = 0; |
+ |
+ // The recorder instance immediately stops to record. |
+ virtual void Cancel() = 0; |
+ }; |
+ |
explicit LogoBridge(jobject j_profile); |
void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
@@ -63,7 +75,9 @@ class LogoBridge : public doodle::DoodleService::Observer { |
void OnDoodleConfigUpdated( |
const base::Optional<doodle::DoodleConfig>& maybe_doodle_config) override; |
- void DoodleConfigReceived( |
+ // Takes a config and loads the image for it. Returns true if the image is |
+ // loading. |
+ bool DoodleConfigReceived( |
const base::Optional<doodle::DoodleConfig>& maybe_doodle_config, |
bool from_cache); |
@@ -75,6 +89,10 @@ class LogoBridge : public doodle::DoodleService::Observer { |
const gfx::Image& image, |
const image_fetcher::RequestMetadata& metadata); |
+ // Returns the currently running LoadTimeRecorder. If there is none, a null |
+ // object is returned. |
+ LoadTimeMetricRecorder* load_time_recorder(); |
+ |
// Only valid if UseNewDoodleApi is disabled. |
LogoService* logo_service_; |
@@ -87,6 +105,8 @@ class LogoBridge : public doodle::DoodleService::Observer { |
std::unique_ptr<AnimatedLogoFetcher> animated_logo_fetcher_; |
+ std::unique_ptr<LoadTimeMetricRecorder> load_time_recorder_; |
+ |
base::WeakPtrFactory<LogoBridge> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(LogoBridge); |