OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_editor.h" | 10 #include "chrome/browser/bookmarks/bookmark_editor.h" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 // LocalState can be NULL in tests. | 625 // LocalState can be NULL in tests. |
626 if (g_browser_process->local_state() && | 626 if (g_browser_process->local_state() && |
627 !g_browser_process->local_state()->GetBoolean(prefs::kPrintingEnabled)) { | 627 !g_browser_process->local_state()->GetBoolean(prefs::kPrintingEnabled)) { |
628 return false; | 628 return false; |
629 } | 629 } |
630 | 630 |
631 // It is always possible to advanced print when print preview is visible. | 631 // It is always possible to advanced print when print preview is visible. |
632 return PrintPreviewShowing(browser) || CanPrint(browser); | 632 return PrintPreviewShowing(browser) || CanPrint(browser); |
633 } | 633 } |
634 | 634 |
| 635 void PrintToDestination(Browser* browser) { |
| 636 browser->GetActiveTabContents()->print_view_manager()->PrintToDestination(); |
| 637 } |
| 638 |
635 void EmailPageLocation(Browser* browser) { | 639 void EmailPageLocation(Browser* browser) { |
636 content::RecordAction(UserMetricsAction("EmailPageLocation")); | 640 content::RecordAction(UserMetricsAction("EmailPageLocation")); |
637 WebContents* wc = browser->GetActiveWebContents(); | 641 WebContents* wc = browser->GetActiveWebContents(); |
638 DCHECK(wc); | 642 DCHECK(wc); |
639 | 643 |
640 std::string title = net::EscapeQueryParamValue( | 644 std::string title = net::EscapeQueryParamValue( |
641 UTF16ToUTF8(wc->GetTitle()), false); | 645 UTF16ToUTF8(wc->GetTitle()), false); |
642 std::string page_url = net::EscapeQueryParamValue(wc->GetURL().spec(), false); | 646 std::string page_url = net::EscapeQueryParamValue(wc->GetURL().spec(), false); |
643 std::string mailto = std::string("mailto:?subject=Fwd:%20") + | 647 std::string mailto = std::string("mailto:?subject=Fwd:%20") + |
644 title + "&body=%0A%0A" + page_url; | 648 title + "&body=%0A%0A" + page_url; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 | 922 |
919 bool CanViewSource(const Browser* browser) { | 923 bool CanViewSource(const Browser* browser) { |
920 return browser->GetActiveWebContents()->GetController().CanViewSource(); | 924 return browser->GetActiveWebContents()->GetController().CanViewSource(); |
921 } | 925 } |
922 | 926 |
923 bool CanCreateApplicationShortcuts(const Browser* browser) { | 927 bool CanCreateApplicationShortcuts(const Browser* browser) { |
924 return web_app::IsValidUrl(browser->GetActiveWebContents()->GetURL()); | 928 return web_app::IsValidUrl(browser->GetActiveWebContents()->GetURL()); |
925 } | 929 } |
926 | 930 |
927 } // namespace chrome | 931 } // namespace chrome |
OLD | NEW |