OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 if (jurl) | 625 if (jurl) |
626 url = base::android::ConvertJavaStringToUTF8(env, jurl); | 626 url = base::android::ConvertJavaStringToUTF8(env, jurl); |
627 | 627 |
628 content::NavigationEntry* entry = | 628 content::NavigationEntry* entry = |
629 web_contents()->GetController().GetVisibleEntry(); | 629 web_contents()->GetController().GetVisibleEntry(); |
630 if (entry && url == entry->GetVirtualURL().spec()) | 630 if (entry && url == entry->GetVirtualURL().spec()) |
631 entry->SetTitle(title); | 631 entry->SetTitle(title); |
632 } | 632 } |
633 | 633 |
634 bool TabAndroid::Print(JNIEnv* env, jobject obj) { | 634 bool TabAndroid::Print(JNIEnv* env, jobject obj) { |
635 if (!web_contents()) | 635 LOG(INFO) << "DGN TabAndroid::Print"; |
| 636 if (!web_contents()) { |
| 637 LOG(INFO) << "DGN TabAndroid::Print - No webcontents"; |
636 return false; | 638 return false; |
| 639 } |
637 | 640 |
638 printing::PrintViewManagerBasic::CreateForWebContents(web_contents()); | 641 printing::PrintViewManagerBasic::CreateForWebContents(web_contents()); |
639 printing::PrintViewManagerBasic* print_view_manager = | 642 printing::PrintViewManagerBasic* print_view_manager = |
640 printing::PrintViewManagerBasic::FromWebContents(web_contents()); | 643 printing::PrintViewManagerBasic::FromWebContents(web_contents()); |
641 if (print_view_manager == NULL) | 644 if (print_view_manager == NULL) { |
| 645 LOG(INFO) << "DGN TabAndroid::Print - No print_view_manager"; |
642 return false; | 646 return false; |
| 647 } |
643 | 648 |
644 print_view_manager->PrintNow(); | 649 print_view_manager->PrintNow(); |
645 return true; | 650 return true; |
646 } | 651 } |
647 | 652 |
| 653 void TabAndroid::ShowPrintDialog() { |
| 654 JNIEnv* env = base::android::AttachCurrentThread(); |
| 655 Java_Tab_showPrintDialog(env, weak_java_tab_.get(env).obj()); |
| 656 } |
| 657 |
648 ScopedJavaLocalRef<jobject> TabAndroid::GetDefaultFavicon(JNIEnv* env, | 658 ScopedJavaLocalRef<jobject> TabAndroid::GetDefaultFavicon(JNIEnv* env, |
649 jobject obj) { | 659 jobject obj) { |
650 ScopedJavaLocalRef<jobject> bitmap; | 660 ScopedJavaLocalRef<jobject> bitmap; |
651 FaviconTabHelper* favicon_tab_helper = | 661 FaviconTabHelper* favicon_tab_helper = |
652 FaviconTabHelper::FromWebContents(web_contents_.get()); | 662 FaviconTabHelper::FromWebContents(web_contents_.get()); |
653 | 663 |
654 if (!favicon_tab_helper) | 664 if (!favicon_tab_helper) |
655 return bitmap; | 665 return bitmap; |
656 | 666 |
657 // Always return the default favicon in Android. | 667 // Always return the default favicon in Android. |
(...skipping 30 matching lines...) Expand all Loading... |
688 | 698 |
689 static void Init(JNIEnv* env, jobject obj) { | 699 static void Init(JNIEnv* env, jobject obj) { |
690 TRACE_EVENT0("native", "TabAndroid::Init"); | 700 TRACE_EVENT0("native", "TabAndroid::Init"); |
691 // This will automatically bind to the Java object and pass ownership there. | 701 // This will automatically bind to the Java object and pass ownership there. |
692 new TabAndroid(env, obj); | 702 new TabAndroid(env, obj); |
693 } | 703 } |
694 | 704 |
695 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 705 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
696 return RegisterNativesImpl(env); | 706 return RegisterNativesImpl(env); |
697 } | 707 } |
OLD | NEW |