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

Side by Side Diff: chrome/browser/ui/browser_commands.cc

Issue 597933002: Restored disable print preview policy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wed Sep 24 10:32:18 PDT 2014 Created 6 years, 3 months 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 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
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"
98 #if defined(ENABLE_FULL_PRINTING) 99 #if defined(ENABLE_FULL_PRINTING)
99 #include "chrome/browser/printing/print_preview_dialog_controller.h" 100 #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
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)
861 printing::PrintViewManager* print_view_manager = 860 printing::PrintViewManager* print_view_manager =
862 printing::PrintViewManager::FromWebContents(contents); 861 printing::PrintViewManager::FromWebContents(contents);
863 print_view_manager->PrintPreviewNow(false); 862
864 #else 863 #if defined(ENABLE_FULL_PRINTING)
865 printing::PrintViewManagerBasic* print_view_manager = 864 if (!browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled)) {
Lei Zhang 2014/09/24 17:53:42 nit: over 80 char / line
Vitaly Buka (NO REVIEWS) 2014/09/24 18:07:03 Done.
866 printing::PrintViewManagerBasic::FromWebContents(contents); 865 print_view_manager->PrintPreviewNow(false);
866 return;
867 }
868 #endif // ENABLE_FULL_PRINTING
869
870 #if !defined(DISABLE_BASIC_PRINTING)
867 print_view_manager->PrintNow(); 871 print_view_manager->PrintNow();
868 #endif // defined(ENABLE_FULL_PRINTING) 872 #endif // DISABLE_BASIC_PRINTING
873
869 #endif // defined(ENABLE_PRINTING) 874 #endif // defined(ENABLE_PRINTING)
870 } 875 }
871 876
872 bool CanPrint(Browser* browser) { 877 bool CanPrint(Browser* browser) {
873 // Do not print when printing is disabled via pref or policy. 878 // Do not print when printing is disabled via pref or policy.
874 // Do not print when a constrained window is showing. It's confusing. 879 // Do not print when a constrained window is showing. It's confusing.
875 // TODO(gbillock): Need to re-assess the call to 880 // TODO(gbillock): Need to re-assess the call to
876 // IsShowingWebContentsModalDialog after a popup management policy is 881 // IsShowingWebContentsModalDialog after a popup management policy is
877 // refined -- we will probably want to just queue the print request, not 882 // refined -- we will probably want to just queue the print request, not
878 // block it. 883 // block it.
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 browser->profile(), 1283 browser->profile(),
1279 browser->host_desktop_type())); 1284 browser->host_desktop_type()));
1280 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1285 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1281 1286
1282 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1287 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1283 contents->GetRenderViewHost()->SyncRendererPrefs(); 1288 contents->GetRenderViewHost()->SyncRendererPrefs();
1284 app_browser->window()->Show(); 1289 app_browser->window()->Show();
1285 } 1290 }
1286 1291
1287 } // namespace chrome 1292 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698