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