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

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: Thu Sep 25 18:19:02 PDT 2014 Created 6 years, 2 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 846
847 void ShowWebsiteSettings(Browser* browser, 847 void ShowWebsiteSettings(Browser* browser,
848 content::WebContents* web_contents, 848 content::WebContents* web_contents,
849 const GURL& url, 849 const GURL& url,
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
857 void Print(Browser* browser) { 856 void Print(Browser* browser) {
858 #if defined(ENABLE_PRINTING) 857 #if defined(ENABLE_PRINTING)
859 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); 858 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
859
860 #if defined(ENABLE_FULL_PRINTING) 860 #if defined(ENABLE_FULL_PRINTING)
861 printing::PrintViewManager* print_view_manager = 861 printing::PrintViewManager* print_view_manager =
862 printing::PrintViewManager::FromWebContents(contents); 862 printing::PrintViewManager::FromWebContents(contents);
863 print_view_manager->PrintPreviewNow(false); 863 if (!browser->profile()->GetPrefs()->GetBoolean(
864 #else 864 prefs::kPrintPreviewDisabled)) {
865 print_view_manager->PrintPreviewNow(false);
866 return;
867 }
868 #else // ENABLE_FULL_PRINTING
865 printing::PrintViewManagerBasic* print_view_manager = 869 printing::PrintViewManagerBasic* print_view_manager =
866 printing::PrintViewManagerBasic::FromWebContents(contents); 870 printing::PrintViewManagerBasic::FromWebContents(contents);
871 #endif // ENABLE_FULL_PRINTING
872
873 #if !defined(DISABLE_BASIC_PRINTING)
867 print_view_manager->PrintNow(); 874 print_view_manager->PrintNow();
868 #endif // defined(ENABLE_FULL_PRINTING) 875 #endif // DISABLE_BASIC_PRINTING
876
869 #endif // defined(ENABLE_PRINTING) 877 #endif // defined(ENABLE_PRINTING)
870 } 878 }
871 879
872 bool CanPrint(Browser* browser) { 880 bool CanPrint(Browser* browser) {
873 // Do not print when printing is disabled via pref or policy. 881 // Do not print when printing is disabled via pref or policy.
874 // Do not print when a constrained window is showing. It's confusing. 882 // Do not print when a constrained window is showing. It's confusing.
875 // TODO(gbillock): Need to re-assess the call to 883 // TODO(gbillock): Need to re-assess the call to
876 // IsShowingWebContentsModalDialog after a popup management policy is 884 // IsShowingWebContentsModalDialog after a popup management policy is
877 // refined -- we will probably want to just queue the print request, not 885 // refined -- we will probably want to just queue the print request, not
878 // block it. 886 // block it.
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 browser->profile(), 1286 browser->profile(),
1279 browser->host_desktop_type())); 1287 browser->host_desktop_type()));
1280 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1288 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1281 1289
1282 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1290 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1283 contents->GetRenderViewHost()->SyncRendererPrefs(); 1291 contents->GetRenderViewHost()->SyncRendererPrefs();
1284 app_browser->window()->Show(); 1292 app_browser->window()->Show();
1285 } 1293 }
1286 1294
1287 } // namespace chrome 1295 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698