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

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

Issue 2426503002: Make printing work better with OOPIF. (Closed)
Patch Set: Check GetFrameToPrint and remove another TODO Created 4 years, 1 month 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_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 content::WebContents* web_contents, 868 content::WebContents* web_contents,
869 const GURL& url, 869 const GURL& url,
870 const security_state::SecurityStateModel::SecurityInfo& security_info) { 870 const security_state::SecurityStateModel::SecurityInfo& security_info) {
871 browser->window()->ShowWebsiteSettings( 871 browser->window()->ShowWebsiteSettings(
872 Profile::FromBrowserContext(web_contents->GetBrowserContext()), 872 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
873 web_contents, url, security_info); 873 web_contents, url, security_info);
874 } 874 }
875 875
876 void Print(Browser* browser) { 876 void Print(Browser* browser) {
877 #if BUILDFLAG(ENABLE_PRINTING) 877 #if BUILDFLAG(ENABLE_PRINTING)
878 printing::StartPrint( 878 auto* web_contents = browser->tab_strip_model()->GetActiveWebContents();
879 browser->tab_strip_model()->GetActiveWebContents(), 879 printing::StartPrint(web_contents, browser->profile()->GetPrefs()->GetBoolean(
880 browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled), 880 prefs::kPrintPreviewDisabled),
881 false); 881 false /* has_selection? */);
882 #endif // BUILDFLAG(ENABLE_PRINTING) 882 #endif
883 } 883 }
884 884
885 bool CanPrint(Browser* browser) { 885 bool CanPrint(Browser* browser) {
886 // Do not print when printing is disabled via pref or policy. 886 // Do not print when printing is disabled via pref or policy.
887 // Do not print when a page has crashed. 887 // Do not print when a page has crashed.
888 // Do not print when a constrained window is showing. It's confusing. 888 // Do not print when a constrained window is showing. It's confusing.
889 // TODO(gbillock): Need to re-assess the call to 889 // TODO(gbillock): Need to re-assess the call to
890 // IsShowingWebContentsModalDialog after a popup management policy is 890 // IsShowingWebContentsModalDialog after a popup management policy is
891 // refined -- we will probably want to just queue the print request, not 891 // refined -- we will probably want to just queue the print request, not
892 // block it. 892 // block it.
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); 1298 app_name, true /* trusted_source */, gfx::Rect(), browser->profile()));
1299 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1299 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1300 1300
1301 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1301 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1302 contents->GetRenderViewHost()->SyncRendererPrefs(); 1302 contents->GetRenderViewHost()->SyncRendererPrefs();
1303 app_browser->window()->Show(); 1303 app_browser->window()->Show();
1304 } 1304 }
1305 #endif // defined(ENABLE_EXTENSIONS) 1305 #endif // defined(ENABLE_EXTENSIONS)
1306 1306
1307 } // namespace chrome 1307 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698