| 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.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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 874   // Do not print when a constrained window is showing. It's confusing. | 874   // Do not print when a constrained window is showing. It's confusing. | 
| 875   // TODO(gbillock): Need to re-assess the call to | 875   // TODO(gbillock): Need to re-assess the call to | 
| 876   // IsShowingWebContentsModalDialog after a popup management policy is | 876   // IsShowingWebContentsModalDialog after a popup management policy is | 
| 877   // refined -- we will probably want to just queue the print request, not | 877   // refined -- we will probably want to just queue the print request, not | 
| 878   // block it. | 878   // block it. | 
| 879   return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && | 879   return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && | 
| 880       !(IsShowingWebContentsModalDialog(browser) || | 880       !(IsShowingWebContentsModalDialog(browser) || | 
| 881       GetContentRestrictions(browser) & CONTENT_RESTRICTION_PRINT); | 881       GetContentRestrictions(browser) & CONTENT_RESTRICTION_PRINT); | 
| 882 } | 882 } | 
| 883 | 883 | 
| 884 #if !defined(OS_WIN) | 884 #if !defined(DISABLE_BASIC_PRINTING) | 
| 885 void AdvancedPrint(Browser* browser) { | 885 void BasicPrint(Browser* browser) { | 
| 886 #if defined(ENABLE_FULL_PRINTING) | 886 #if defined(ENABLE_FULL_PRINTING) | 
| 887   printing::PrintViewManager* print_view_manager = | 887   printing::PrintViewManager* print_view_manager = | 
| 888       printing::PrintViewManager::FromWebContents( | 888       printing::PrintViewManager::FromWebContents( | 
| 889           browser->tab_strip_model()->GetActiveWebContents()); | 889           browser->tab_strip_model()->GetActiveWebContents()); | 
| 890   print_view_manager->AdvancedPrintNow(); | 890   print_view_manager->BasicPrint(); | 
| 891 #endif | 891 #endif | 
| 892 } | 892 } | 
| 893 | 893 | 
| 894 bool CanAdvancedPrint(Browser* browser) { | 894 bool CanBasicPrint(Browser* browser) { | 
| 895   return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && | 895   return browser->profile()->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && | 
| 896       (PrintPreviewShowing(browser) || CanPrint(browser)); | 896       (PrintPreviewShowing(browser) || CanPrint(browser)); | 
| 897 } | 897 } | 
| 898 #endif  // !OS_WIN | 898 #endif  // !DISABLE_BASIC_PRINTING | 
| 899 | 899 | 
| 900 void EmailPageLocation(Browser* browser) { | 900 void EmailPageLocation(Browser* browser) { | 
| 901   content::RecordAction(UserMetricsAction("EmailPageLocation")); | 901   content::RecordAction(UserMetricsAction("EmailPageLocation")); | 
| 902   WebContents* wc = browser->tab_strip_model()->GetActiveWebContents(); | 902   WebContents* wc = browser->tab_strip_model()->GetActiveWebContents(); | 
| 903   DCHECK(wc); | 903   DCHECK(wc); | 
| 904 | 904 | 
| 905   std::string title = net::EscapeQueryParamValue( | 905   std::string title = net::EscapeQueryParamValue( | 
| 906       base::UTF16ToUTF8(wc->GetTitle()), false); | 906       base::UTF16ToUTF8(wc->GetTitle()), false); | 
| 907   std::string page_url = net::EscapeQueryParamValue(wc->GetURL().spec(), false); | 907   std::string page_url = net::EscapeQueryParamValue(wc->GetURL().spec(), false); | 
| 908   std::string mailto = std::string("mailto:?subject=Fwd:%20") + | 908   std::string mailto = std::string("mailto:?subject=Fwd:%20") + | 
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1269                                           browser->profile(), | 1269                                           browser->profile(), | 
| 1270                                           browser->host_desktop_type())); | 1270                                           browser->host_desktop_type())); | 
| 1271   app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1271   app_browser->tab_strip_model()->AppendWebContents(contents, true); | 
| 1272 | 1272 | 
| 1273   contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1273   contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 
| 1274   contents->GetRenderViewHost()->SyncRendererPrefs(); | 1274   contents->GetRenderViewHost()->SyncRendererPrefs(); | 
| 1275   app_browser->window()->Show(); | 1275   app_browser->window()->Show(); | 
| 1276 } | 1276 } | 
| 1277 | 1277 | 
| 1278 }  // namespace chrome | 1278 }  // namespace chrome | 
| OLD | NEW | 
|---|