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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 26 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
27 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" | 27 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" |
28 #include "chrome/browser/browser_about_handler.h" | 28 #include "chrome/browser/browser_about_handler.h" |
29 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
30 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 30 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
31 #include "chrome/browser/infobars/infobar_service.h" | 31 #include "chrome/browser/infobars/infobar_service.h" |
32 #include "chrome/browser/prerender/prerender_contents.h" | 32 #include "chrome/browser/prerender/prerender_contents.h" |
33 #include "chrome/browser/prerender/prerender_manager.h" | 33 #include "chrome/browser/prerender/prerender_manager.h" |
34 #include "chrome/browser/prerender/prerender_manager_factory.h" | 34 #include "chrome/browser/prerender/prerender_manager_factory.h" |
35 #include "chrome/browser/printing/print_view_manager_basic.h" | 35 #include "chrome/browser/printing/print_view_manager_basic.h" |
| 36 #include "chrome/browser/printing/print_view_manager_common.h" |
36 #include "chrome/browser/profiles/profile.h" | 37 #include "chrome/browser/profiles/profile.h" |
37 #include "chrome/browser/profiles/profile_android.h" | 38 #include "chrome/browser/profiles/profile_android.h" |
38 #include "chrome/browser/profiles/profile_manager.h" | 39 #include "chrome/browser/profiles/profile_manager.h" |
39 #include "chrome/browser/search/instant_service.h" | 40 #include "chrome/browser/search/instant_service.h" |
40 #include "chrome/browser/search/instant_service_factory.h" | 41 #include "chrome/browser/search/instant_service_factory.h" |
41 #include "chrome/browser/search/search.h" | 42 #include "chrome/browser/search/search.h" |
42 #include "chrome/browser/sessions/session_tab_helper.h" | 43 #include "chrome/browser/sessions/session_tab_helper.h" |
43 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 44 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
44 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" | 45 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" |
45 #include "chrome/browser/tab_contents/tab_util.h" | 46 #include "chrome/browser/tab_contents/tab_util.h" |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 entry->SetTitle(title); | 663 entry->SetTitle(title); |
663 } | 664 } |
664 | 665 |
665 bool TabAndroid::Print(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 666 bool TabAndroid::Print(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
666 if (!web_contents()) | 667 if (!web_contents()) |
667 return false; | 668 return false; |
668 | 669 |
669 printing::PrintViewManagerBasic::CreateForWebContents(web_contents()); | 670 printing::PrintViewManagerBasic::CreateForWebContents(web_contents()); |
670 printing::PrintViewManagerBasic* print_view_manager = | 671 printing::PrintViewManagerBasic* print_view_manager = |
671 printing::PrintViewManagerBasic::FromWebContents(web_contents()); | 672 printing::PrintViewManagerBasic::FromWebContents(web_contents()); |
672 if (print_view_manager == NULL) | 673 if (!print_view_manager) |
673 return false; | 674 return false; |
674 | 675 |
675 print_view_manager->PrintNow(); | 676 print_view_manager->PrintNow(printing::GetFrameToPrint(web_contents())); |
676 return true; | 677 return true; |
677 } | 678 } |
678 | 679 |
679 void TabAndroid::SetPendingPrint() { | 680 void TabAndroid::SetPendingPrint() { |
680 JNIEnv* env = base::android::AttachCurrentThread(); | 681 JNIEnv* env = base::android::AttachCurrentThread(); |
681 Java_Tab_setPendingPrint(env, weak_java_tab_.get(env)); | 682 Java_Tab_setPendingPrint(env, weak_java_tab_.get(env)); |
682 } | 683 } |
683 | 684 |
684 ScopedJavaLocalRef<jobject> TabAndroid::GetFavicon( | 685 ScopedJavaLocalRef<jobject> TabAndroid::GetFavicon( |
685 JNIEnv* env, | 686 JNIEnv* env, |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 883 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
883 TRACE_EVENT0("native", "TabAndroid::Init"); | 884 TRACE_EVENT0("native", "TabAndroid::Init"); |
884 // This will automatically bind to the Java object and pass ownership there. | 885 // This will automatically bind to the Java object and pass ownership there. |
885 new TabAndroid(env, obj); | 886 new TabAndroid(env, obj); |
886 } | 887 } |
887 | 888 |
888 // static | 889 // static |
889 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 890 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
890 return RegisterNativesImpl(env); | 891 return RegisterNativesImpl(env); |
891 } | 892 } |
OLD | NEW |