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

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

Issue 63483007: Refactor Android printing code to make it more testable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add license to PrintingControllerFactory Created 7 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 (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_string.h" 8 #include "base/android/jni_string.h"
9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" 9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h"
10 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" 10 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
14 #include "chrome/browser/extensions/tab_helper.h" 14 #include "chrome/browser/extensions/tab_helper.h"
15 #include "chrome/browser/favicon/favicon_tab_helper.h" 15 #include "chrome/browser/favicon/favicon_tab_helper.h"
16 #include "chrome/browser/history/history_tab_helper.h" 16 #include "chrome/browser/history/history_tab_helper.h"
17 #include "chrome/browser/infobars/infobar_service.h" 17 #include "chrome/browser/infobars/infobar_service.h"
18 #include "chrome/browser/net/net_error_tab_helper.h" 18 #include "chrome/browser/net/net_error_tab_helper.h"
19 #include "chrome/browser/password_manager/password_manager.h" 19 #include "chrome/browser/password_manager/password_manager.h"
20 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" 20 #include "chrome/browser/password_manager/password_manager_delegate_impl.h"
21 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" 21 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
22 #include "chrome/browser/predictors/resource_prefetch_predictor_tab_helper.h" 22 #include "chrome/browser/predictors/resource_prefetch_predictor_tab_helper.h"
23 #include "chrome/browser/prerender/prerender_tab_helper.h" 23 #include "chrome/browser/prerender/prerender_tab_helper.h"
24 #include "chrome/browser/printing/print_view_manager_basic.h"
24 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/profiles/profile_android.h" 26 #include "chrome/browser/profiles/profile_android.h"
26 #include "chrome/browser/sessions/session_tab_helper.h" 27 #include "chrome/browser/sessions/session_tab_helper.h"
27 #include "chrome/browser/ssl/ssl_tab_helper.h" 28 #include "chrome/browser/ssl/ssl_tab_helper.h"
28 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" 29 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h"
29 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h" 30 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h"
30 #include "chrome/browser/translate/translate_tab_helper.h" 31 #include "chrome/browser/translate/translate_tab_helper.h"
31 #include "chrome/browser/ui/alternate_error_tab_observer.h" 32 #include "chrome/browser/ui/alternate_error_tab_observer.h"
32 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg ate.h" 33 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg ate.h"
33 #include "chrome/browser/ui/android/infobars/infobar_container_android.h" 34 #include "chrome/browser/ui/android/infobars/infobar_container_android.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 std::string url; 393 std::string url;
393 if (jurl) 394 if (jurl)
394 url = base::android::ConvertJavaStringToUTF8(env, jurl); 395 url = base::android::ConvertJavaStringToUTF8(env, jurl);
395 396
396 content::NavigationEntry* entry = 397 content::NavigationEntry* entry =
397 web_contents()->GetController().GetVisibleEntry(); 398 web_contents()->GetController().GetVisibleEntry();
398 if (entry && url == entry->GetVirtualURL().spec()) 399 if (entry && url == entry->GetVirtualURL().spec())
399 entry->SetTitle(title); 400 entry->SetTitle(title);
400 } 401 }
401 402
403 bool TabAndroid::Print(JNIEnv* env, jobject obj) {
404 if (!web_contents())
405 return false;
406
407 printing::PrintViewManagerBasic::CreateForWebContents(web_contents());
408 printing::PrintViewManagerBasic* print_view_manager =
409 printing::PrintViewManagerBasic::FromWebContents(web_contents());
410 if (print_view_manager == NULL)
411 return false;
412
413 print_view_manager->PrintNow();
414 return true;
415 }
416
402 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 417 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
403 return RegisterNativesImpl(env); 418 return RegisterNativesImpl(env);
404 } 419 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | printing/android/java/src/org/chromium/printing/PrintManagerDelegate.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698