| 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 web_contents, url, ssl); | 848 web_contents, url, ssl); |
| 849 } | 849 } |
| 850 | 850 |
| 851 | 851 |
| 852 void Print(Browser* browser) { | 852 void Print(Browser* browser) { |
| 853 #if defined(ENABLE_PRINTING) | 853 #if defined(ENABLE_PRINTING) |
| 854 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); | 854 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); |
| 855 #if defined(ENABLE_FULL_PRINTING) | 855 #if defined(ENABLE_FULL_PRINTING) |
| 856 printing::PrintViewManager* print_view_manager = | 856 printing::PrintViewManager* print_view_manager = |
| 857 printing::PrintViewManager::FromWebContents(contents); | 857 printing::PrintViewManager::FromWebContents(contents); |
| 858 if (browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled)) | 858 print_view_manager->PrintPreviewNow(false); |
| 859 print_view_manager->PrintNow(); | |
| 860 else | |
| 861 print_view_manager->PrintPreviewNow(false); | |
| 862 #else | 859 #else |
| 863 printing::PrintViewManagerBasic* print_view_manager = | 860 printing::PrintViewManagerBasic* print_view_manager = |
| 864 printing::PrintViewManagerBasic::FromWebContents(contents); | 861 printing::PrintViewManagerBasic::FromWebContents(contents); |
| 865 print_view_manager->PrintNow(); | 862 print_view_manager->PrintNow(); |
| 866 #endif // defined(ENABLE_FULL_PRINTING) | 863 #endif // defined(ENABLE_FULL_PRINTING) |
| 867 #endif // defined(ENABLE_PRINTING) | 864 #endif // defined(ENABLE_PRINTING) |
| 868 } | 865 } |
| 869 | 866 |
| 870 bool CanPrint(Browser* browser) { | 867 bool CanPrint(Browser* browser) { |
| 871 // Do not print when printing is disabled via pref or policy. | 868 // Do not print when printing is disabled via pref or policy. |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 browser->profile(), | 1281 browser->profile(), |
| 1285 browser->host_desktop_type())); | 1282 browser->host_desktop_type())); |
| 1286 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1283 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1287 | 1284 |
| 1288 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1285 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1289 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1286 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1290 app_browser->window()->Show(); | 1287 app_browser->window()->Show(); |
| 1291 } | 1288 } |
| 1292 | 1289 |
| 1293 } // namespace chrome | 1290 } // namespace chrome |
| OLD | NEW |