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

Side by Side Diff: chrome/browser/android/logo_bridge.cc

Issue 2843403003: OnDoodleConfigRevalidated (Closed)
Patch Set: 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
« no previous file with comments | « chrome/browser/android/logo_bridge.h ('k') | components/doodle/doodle_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/logo_bridge.h" 5 #include "chrome/browser/android/logo_bridge.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 240
241 void LogoBridge::GetAnimatedLogo(JNIEnv* env, 241 void LogoBridge::GetAnimatedLogo(JNIEnv* env,
242 const JavaParamRef<jobject>& obj, 242 const JavaParamRef<jobject>& obj,
243 const JavaParamRef<jobject>& j_callback, 243 const JavaParamRef<jobject>& j_callback,
244 const JavaParamRef<jstring>& j_url) { 244 const JavaParamRef<jstring>& j_url) {
245 GURL url = GURL(ConvertJavaStringToUTF8(env, j_url)); 245 GURL url = GURL(ConvertJavaStringToUTF8(env, j_url));
246 animated_logo_fetcher_->Start(env, url, j_callback); 246 animated_logo_fetcher_->Start(env, url, j_callback);
247 } 247 }
248 248
249 void LogoBridge::OnDoodleConfigRevalidated() {
250 if (j_logo_observer_.is_null()) {
251 return;
252 }
253 // If an existing config got re-validated, there's nothing to do - the UI is
254 // already in the correct state. However, we do tell the UI when we validate
255 // that there really isn't a Doodle. This is needed for metrics tracking.
256 if (!doodle_service_->config().has_value()) {
257 DoodleConfigReceived(base::nullopt, /*from_cache=*/false);
258 }
259 }
260
249 void LogoBridge::OnDoodleConfigUpdated( 261 void LogoBridge::OnDoodleConfigUpdated(
250 const base::Optional<doodle::DoodleConfig>& maybe_doodle_config) { 262 const base::Optional<doodle::DoodleConfig>& maybe_doodle_config) {
251 if (j_logo_observer_.is_null()) { 263 if (j_logo_observer_.is_null()) {
252 return; 264 return;
253 } 265 }
254 DoodleConfigReceived(maybe_doodle_config, /*from_cache=*/false); 266 DoodleConfigReceived(maybe_doodle_config, /*from_cache=*/false);
255 } 267 }
256 268
257 void LogoBridge::DoodleConfigReceived( 269 void LogoBridge::DoodleConfigReceived(
258 const base::Optional<doodle::DoodleConfig>& maybe_doodle_config, 270 const base::Optional<doodle::DoodleConfig>& maybe_doodle_config,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 ScopedJavaLocalRef<jobject> j_logo = MakeJavaLogo( 320 ScopedJavaLocalRef<jobject> j_logo = MakeJavaLogo(
309 env, image.ToSkBitmap(), on_click_url, alt_text, animated_image_url); 321 env, image.ToSkBitmap(), on_click_url, alt_text, animated_image_url);
310 Java_LogoObserver_onLogoAvailable(env, j_logo_observer_, j_logo, 322 Java_LogoObserver_onLogoAvailable(env, j_logo_observer_, j_logo,
311 config_from_cache); 323 config_from_cache);
312 } 324 }
313 325
314 // static 326 // static
315 bool RegisterLogoBridge(JNIEnv* env) { 327 bool RegisterLogoBridge(JNIEnv* env) {
316 return RegisterNativesImpl(env); 328 return RegisterNativesImpl(env);
317 } 329 }
OLDNEW
« no previous file with comments | « chrome/browser/android/logo_bridge.h ('k') | components/doodle/doodle_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698