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 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 content::WebContents* web_contents, | 899 content::WebContents* web_contents, |
900 const GURL& url, | 900 const GURL& url, |
901 const security_state::SecurityInfo& security_info) { | 901 const security_state::SecurityInfo& security_info) { |
902 browser->window()->ShowWebsiteSettings( | 902 browser->window()->ShowWebsiteSettings( |
903 Profile::FromBrowserContext(web_contents->GetBrowserContext()), | 903 Profile::FromBrowserContext(web_contents->GetBrowserContext()), |
904 web_contents, url, security_info); | 904 web_contents, url, security_info); |
905 } | 905 } |
906 | 906 |
907 void Print(Browser* browser) { | 907 void Print(Browser* browser) { |
908 #if BUILDFLAG(ENABLE_PRINTING) | 908 #if BUILDFLAG(ENABLE_PRINTING) |
909 printing::StartPrint( | 909 auto* web_contents = browser->tab_strip_model()->GetActiveWebContents(); |
910 browser->tab_strip_model()->GetActiveWebContents(), | 910 printing::StartPrint(web_contents, browser->profile()->GetPrefs()->GetBoolean( |
911 browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled), | 911 prefs::kPrintPreviewDisabled), |
912 false); | 912 false /* has_selection? */); |
913 #endif // BUILDFLAG(ENABLE_PRINTING) | 913 #endif |
914 } | 914 } |
915 | 915 |
916 bool CanPrint(Browser* browser) { | 916 bool CanPrint(Browser* browser) { |
917 // Do not print when printing is disabled via pref or policy. | 917 // Do not print when printing is disabled via pref or policy. |
918 // Do not print when a page has crashed. | 918 // Do not print when a page has crashed. |
919 // Do not print when a constrained window is showing. It's confusing. | 919 // Do not print when a constrained window is showing. It's confusing. |
920 // TODO(gbillock): Need to re-assess the call to | 920 // TODO(gbillock): Need to re-assess the call to |
921 // IsShowingWebContentsModalDialog after a popup management policy is | 921 // IsShowingWebContentsModalDialog after a popup management policy is |
922 // refined -- we will probably want to just queue the print request, not | 922 // refined -- we will probably want to just queue the print request, not |
923 // block it. | 923 // block it. |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); | 1329 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); |
1330 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1330 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1331 | 1331 |
1332 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1332 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1333 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1333 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1334 app_browser->window()->Show(); | 1334 app_browser->window()->Show(); |
1335 } | 1335 } |
1336 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 1336 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
1337 | 1337 |
1338 } // namespace chrome | 1338 } // namespace chrome |
OLD | NEW |