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

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

Issue 1407353012: Refactor FaviconDriver::OnFaviconAvailable() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@initial_simplify
Patch Set: Created 5 years, 1 month 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 case content::NOTIFICATION_NAV_ENTRY_CHANGED: 382 case content::NOTIFICATION_NAV_ENTRY_CHANGED:
383 Java_Tab_onNavEntryChanged(env, weak_java_tab_.get(env).obj()); 383 Java_Tab_onNavEntryChanged(env, weak_java_tab_.get(env).obj());
384 break; 384 break;
385 default: 385 default:
386 NOTREACHED() << "Unexpected notification " << type; 386 NOTREACHED() << "Unexpected notification " << type;
387 break; 387 break;
388 } 388 }
389 } 389 }
390 390
391 void TabAndroid::OnFaviconAvailable(const gfx::Image& image) { 391 void TabAndroid::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver,
392 NotificationIconType notification_icon_type,
393 const GURL& icon_url,
394 bool icon_url_changed,
395 const gfx::Image& image) {
396 if (notification_icon_type != NON_TOUCH_LARGEST &&
397 notification_icon_type != TOUCH_LARGEST) {
398 return;
399 }
400
392 SkBitmap favicon = image.AsImageSkia().GetRepresentation(1.0f).sk_bitmap(); 401 SkBitmap favicon = image.AsImageSkia().GetRepresentation(1.0f).sk_bitmap();
393 if (favicon.empty()) 402 if (favicon.empty())
394 return; 403 return;
395 404
396 JNIEnv* env = base::android::AttachCurrentThread(); 405 JNIEnv* env = base::android::AttachCurrentThread();
397 Java_Tab_onFaviconAvailable(env, weak_java_tab_.get(env).obj(), 406 Java_Tab_onFaviconAvailable(env, weak_java_tab_.get(env).obj(),
398 gfx::ConvertToJavaBitmap(&favicon).obj()); 407 gfx::ConvertToJavaBitmap(&favicon).obj());
399 } 408 }
400 409
401 void TabAndroid::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver,
402 bool icon_url_changed) {
403 }
404
405 void TabAndroid::Destroy(JNIEnv* env, jobject obj) { 410 void TabAndroid::Destroy(JNIEnv* env, jobject obj) {
406 delete this; 411 delete this;
407 } 412 }
408 413
409 void TabAndroid::InitWebContents(JNIEnv* env, 414 void TabAndroid::InitWebContents(JNIEnv* env,
410 jobject obj, 415 jobject obj,
411 jboolean incognito, 416 jboolean incognito,
412 jobject jcontent_view_core, 417 jobject jcontent_view_core,
413 jobject jweb_contents_delegate, 418 jobject jweb_contents_delegate,
414 jobject jcontext_menu_populator) { 419 jobject jcontext_menu_populator) {
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 928 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
924 TRACE_EVENT0("native", "TabAndroid::Init"); 929 TRACE_EVENT0("native", "TabAndroid::Init");
925 // This will automatically bind to the Java object and pass ownership there. 930 // This will automatically bind to the Java object and pass ownership there.
926 new TabAndroid(env, obj); 931 new TabAndroid(env, obj);
927 } 932 }
928 933
929 // static 934 // static
930 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 935 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
931 return RegisterNativesImpl(env); 936 return RegisterNativesImpl(env);
932 } 937 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/extensions/api/tabs/tabs_event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698