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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 void BasicPrint(Browser* browser) { | 885 void BasicPrint(Browser* browser) { |
886 #if defined(ENABLE_FULL_PRINTING) | 886 #if defined(ENABLE_FULL_PRINTING) |
887 printing::PrintViewManager* print_view_manager = | 887 printing::PrintViewManager* print_view_manager = |
888 printing::PrintViewManager::FromWebContents( | 888 printing::PrintViewManager::FromWebContents( |
889 browser->tab_strip_model()->GetActiveWebContents()); | 889 browser->tab_strip_model()->GetActiveWebContents()); |
890 print_view_manager->BasicPrint(); | 890 print_view_manager->BasicPrint(); |
891 #endif | 891 #endif |
892 } | 892 } |
893 | 893 |
894 bool CanBasicPrint(Browser* browser) { | 894 bool CanBasicPrint(Browser* browser) { |
| 895 // If printing is not disabled via pref or policy, it is always possible to |
| 896 // advanced print when the print preview is visible. The exception to this |
| 897 // is under Win8 ash, since showing the advanced print dialog will open it |
| 898 // modally on the Desktop and hang the browser. |
| 899 #if defined(OS_WIN) |
| 900 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 901 return false; |
| 902 #endif |
| 903 |
895 return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && | 904 return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && |
896 (PrintPreviewShowing(browser) || CanPrint(browser)); | 905 (PrintPreviewShowing(browser) || CanPrint(browser)); |
897 } | 906 } |
898 #endif // !DISABLE_BASIC_PRINTING | 907 #endif // !DISABLE_BASIC_PRINTING |
899 | 908 |
900 void EmailPageLocation(Browser* browser) { | 909 void EmailPageLocation(Browser* browser) { |
901 content::RecordAction(UserMetricsAction("EmailPageLocation")); | 910 content::RecordAction(UserMetricsAction("EmailPageLocation")); |
902 WebContents* wc = browser->tab_strip_model()->GetActiveWebContents(); | 911 WebContents* wc = browser->tab_strip_model()->GetActiveWebContents(); |
903 DCHECK(wc); | 912 DCHECK(wc); |
904 | 913 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 browser->profile(), | 1278 browser->profile(), |
1270 browser->host_desktop_type())); | 1279 browser->host_desktop_type())); |
1271 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1280 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1272 | 1281 |
1273 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1282 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1274 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1283 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1275 app_browser->window()->Show(); | 1284 app_browser->window()->Show(); |
1276 } | 1285 } |
1277 | 1286 |
1278 } // namespace chrome | 1287 } // namespace chrome |
OLD | NEW |