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_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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 content::WebContents* web_contents, | 869 content::WebContents* web_contents, |
870 const GURL& url, | 870 const GURL& url, |
871 const security_state::SecurityStateModel::SecurityInfo& security_info) { | 871 const security_state::SecurityStateModel::SecurityInfo& security_info) { |
872 browser->window()->ShowWebsiteSettings( | 872 browser->window()->ShowWebsiteSettings( |
873 Profile::FromBrowserContext(web_contents->GetBrowserContext()), | 873 Profile::FromBrowserContext(web_contents->GetBrowserContext()), |
874 web_contents, url, security_info); | 874 web_contents, url, security_info); |
875 } | 875 } |
876 | 876 |
877 void Print(Browser* browser) { | 877 void Print(Browser* browser) { |
878 #if BUILDFLAG(ENABLE_PRINTING) | 878 #if BUILDFLAG(ENABLE_PRINTING) |
879 printing::StartPrint( | 879 auto* web_contents = browser->tab_strip_model()->GetActiveWebContents(); |
880 browser->tab_strip_model()->GetActiveWebContents(), | 880 printing::StartPrint(web_contents, browser->profile()->GetPrefs()->GetBoolean( |
881 browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled), | 881 prefs::kPrintPreviewDisabled), |
882 false); | 882 false /* has_selection? */); |
883 #endif // BUILDFLAG(ENABLE_PRINTING) | 883 #endif |
884 } | 884 } |
885 | 885 |
886 bool CanPrint(Browser* browser) { | 886 bool CanPrint(Browser* browser) { |
887 // Do not print when printing is disabled via pref or policy. | 887 // Do not print when printing is disabled via pref or policy. |
888 // Do not print when a page has crashed. | 888 // Do not print when a page has crashed. |
889 // Do not print when a constrained window is showing. It's confusing. | 889 // Do not print when a constrained window is showing. It's confusing. |
890 // TODO(gbillock): Need to re-assess the call to | 890 // TODO(gbillock): Need to re-assess the call to |
891 // IsShowingWebContentsModalDialog after a popup management policy is | 891 // IsShowingWebContentsModalDialog after a popup management policy is |
892 // refined -- we will probably want to just queue the print request, not | 892 // refined -- we will probably want to just queue the print request, not |
893 // block it. | 893 // block it. |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); | 1299 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); |
1300 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1300 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1301 | 1301 |
1302 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1302 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1303 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1303 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1304 app_browser->window()->Show(); | 1304 app_browser->window()->Show(); |
1305 } | 1305 } |
1306 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 1306 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
1307 | 1307 |
1308 } // namespace chrome | 1308 } // namespace chrome |
OLD | NEW |