OLD | NEW |
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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 } | 367 } |
368 case content::NOTIFICATION_NAV_ENTRY_CHANGED: | 368 case content::NOTIFICATION_NAV_ENTRY_CHANGED: |
369 Java_Tab_onNavEntryChanged(env, weak_java_tab_.get(env).obj()); | 369 Java_Tab_onNavEntryChanged(env, weak_java_tab_.get(env).obj()); |
370 break; | 370 break; |
371 default: | 371 default: |
372 NOTREACHED() << "Unexpected notification " << type; | 372 NOTREACHED() << "Unexpected notification " << type; |
373 break; | 373 break; |
374 } | 374 } |
375 } | 375 } |
376 | 376 |
377 void TabAndroid::OnFaviconAvailable(const gfx::Image& image) { | 377 void TabAndroid::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, |
| 378 NotificationIconType notification_icon_type, |
| 379 const GURL& icon_url, |
| 380 bool icon_url_changed, |
| 381 const gfx::Image& image) { |
| 382 if (notification_icon_type != NON_TOUCH_LARGEST && |
| 383 notification_icon_type != TOUCH_LARGEST) { |
| 384 return; |
| 385 } |
| 386 |
378 SkBitmap favicon = image.AsImageSkia().GetRepresentation(1.0f).sk_bitmap(); | 387 SkBitmap favicon = image.AsImageSkia().GetRepresentation(1.0f).sk_bitmap(); |
379 if (favicon.empty()) | 388 if (favicon.empty()) |
380 return; | 389 return; |
381 | 390 |
382 JNIEnv* env = base::android::AttachCurrentThread(); | 391 JNIEnv* env = base::android::AttachCurrentThread(); |
383 Java_Tab_onFaviconAvailable(env, weak_java_tab_.get(env).obj(), | 392 Java_Tab_onFaviconAvailable(env, weak_java_tab_.get(env).obj(), |
384 gfx::ConvertToJavaBitmap(&favicon).obj()); | 393 gfx::ConvertToJavaBitmap(&favicon).obj()); |
385 } | 394 } |
386 | 395 |
387 void TabAndroid::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, | |
388 bool icon_url_changed) { | |
389 } | |
390 | |
391 void TabAndroid::Destroy(JNIEnv* env, jobject obj) { | 396 void TabAndroid::Destroy(JNIEnv* env, jobject obj) { |
392 delete this; | 397 delete this; |
393 } | 398 } |
394 | 399 |
395 void TabAndroid::InitWebContents(JNIEnv* env, | 400 void TabAndroid::InitWebContents(JNIEnv* env, |
396 jobject obj, | 401 jobject obj, |
397 jboolean incognito, | 402 jboolean incognito, |
398 jobject jcontent_view_core, | 403 jobject jcontent_view_core, |
399 jobject jweb_contents_delegate, | 404 jobject jweb_contents_delegate, |
400 jobject jcontext_menu_populator) { | 405 jobject jcontext_menu_populator) { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 914 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
910 TRACE_EVENT0("native", "TabAndroid::Init"); | 915 TRACE_EVENT0("native", "TabAndroid::Init"); |
911 // This will automatically bind to the Java object and pass ownership there. | 916 // This will automatically bind to the Java object and pass ownership there. |
912 new TabAndroid(env, obj); | 917 new TabAndroid(env, obj); |
913 } | 918 } |
914 | 919 |
915 // static | 920 // static |
916 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 921 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
917 return RegisterNativesImpl(env); | 922 return RegisterNativesImpl(env); |
918 } | 923 } |
OLD | NEW |