| 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/ui/browser_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 #endif | 88 #endif |
| 89 | 89 |
| 90 #if defined(ENABLE_EXTENSIONS) | 90 #if defined(ENABLE_EXTENSIONS) |
| 91 #include "extensions/browser/extension_registry.h" | 91 #include "extensions/browser/extension_registry.h" |
| 92 #include "extensions/browser/extension_system.h" | 92 #include "extensions/browser/extension_system.h" |
| 93 #include "extensions/common/extension.h" | 93 #include "extensions/common/extension.h" |
| 94 #include "extensions/common/extension_set.h" | 94 #include "extensions/common/extension_set.h" |
| 95 #endif | 95 #endif |
| 96 | 96 |
| 97 #if defined(ENABLE_PRINTING) | 97 #if defined(ENABLE_PRINTING) |
| 98 #include "chrome/browser/printing/print_view_manager.h" | |
| 99 #if defined(ENABLE_FULL_PRINTING) | 98 #if defined(ENABLE_FULL_PRINTING) |
| 100 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 99 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
| 100 #include "chrome/browser/printing/print_view_manager.h" |
| 101 #else | 101 #else |
| 102 #include "chrome/browser/printing/print_view_manager_basic.h" | 102 #include "chrome/browser/printing/print_view_manager_basic.h" |
| 103 #endif // defined(ENABLE_FULL_PRINTING) | 103 #endif // defined(ENABLE_FULL_PRINTING) |
| 104 #endif // defined(ENABLE_PRINTING) | 104 #endif // defined(ENABLE_PRINTING) |
| 105 | 105 |
| 106 namespace { | 106 namespace { |
| 107 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; | 107 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; |
| 108 } | 108 } |
| 109 | 109 |
| 110 using base::UserMetricsAction; | 110 using base::UserMetricsAction; |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 const SSLStatus& ssl) { | 850 const SSLStatus& ssl) { |
| 851 browser->window()->ShowWebsiteSettings( | 851 browser->window()->ShowWebsiteSettings( |
| 852 Profile::FromBrowserContext(web_contents->GetBrowserContext()), | 852 Profile::FromBrowserContext(web_contents->GetBrowserContext()), |
| 853 web_contents, url, ssl); | 853 web_contents, url, ssl); |
| 854 } | 854 } |
| 855 | 855 |
| 856 | 856 |
| 857 void Print(Browser* browser) { | 857 void Print(Browser* browser) { |
| 858 #if defined(ENABLE_PRINTING) | 858 #if defined(ENABLE_PRINTING) |
| 859 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); | 859 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); |
| 860 #if defined(ENABLE_FULL_PRINTING) |
| 860 printing::PrintViewManager* print_view_manager = | 861 printing::PrintViewManager* print_view_manager = |
| 861 printing::PrintViewManager::FromWebContents(contents); | 862 printing::PrintViewManager::FromWebContents(contents); |
| 862 | 863 print_view_manager->PrintPreviewNow(false); |
| 863 #if defined(ENABLE_FULL_PRINTING) | 864 #else |
| 864 if (!browser->profile()->GetPrefs()->GetBoolean( | 865 printing::PrintViewManagerBasic* print_view_manager = |
| 865 prefs::kPrintPreviewDisabled)) { | 866 printing::PrintViewManagerBasic::FromWebContents(contents); |
| 866 print_view_manager->PrintPreviewNow(false); | |
| 867 return; | |
| 868 } | |
| 869 #endif // ENABLE_FULL_PRINTING | |
| 870 | |
| 871 #if !defined(DISABLE_BASIC_PRINTING) | |
| 872 print_view_manager->PrintNow(); | 867 print_view_manager->PrintNow(); |
| 873 #endif // DISABLE_BASIC_PRINTING | 868 #endif // defined(ENABLE_FULL_PRINTING) |
| 874 | |
| 875 #endif // defined(ENABLE_PRINTING) | 869 #endif // defined(ENABLE_PRINTING) |
| 876 } | 870 } |
| 877 | 871 |
| 878 bool CanPrint(Browser* browser) { | 872 bool CanPrint(Browser* browser) { |
| 879 // Do not print when printing is disabled via pref or policy. | 873 // Do not print when printing is disabled via pref or policy. |
| 880 // Do not print when a constrained window is showing. It's confusing. | 874 // Do not print when a constrained window is showing. It's confusing. |
| 881 // TODO(gbillock): Need to re-assess the call to | 875 // TODO(gbillock): Need to re-assess the call to |
| 882 // IsShowingWebContentsModalDialog after a popup management policy is | 876 // IsShowingWebContentsModalDialog after a popup management policy is |
| 883 // refined -- we will probably want to just queue the print request, not | 877 // refined -- we will probably want to just queue the print request, not |
| 884 // block it. | 878 // block it. |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 browser->profile(), | 1278 browser->profile(), |
| 1285 browser->host_desktop_type())); | 1279 browser->host_desktop_type())); |
| 1286 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1280 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1287 | 1281 |
| 1288 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1282 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1289 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1283 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1290 app_browser->window()->Show(); | 1284 app_browser->window()->Show(); |
| 1291 } | 1285 } |
| 1292 | 1286 |
| 1293 } // namespace chrome | 1287 } // namespace chrome |
| OLD | NEW |