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