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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 // LocalState can be NULL in tests. | 626 // LocalState can be NULL in tests. |
627 if (g_browser_process->local_state() && | 627 if (g_browser_process->local_state() && |
628 !g_browser_process->local_state()->GetBoolean(prefs::kPrintingEnabled)) { | 628 !g_browser_process->local_state()->GetBoolean(prefs::kPrintingEnabled)) { |
629 return false; | 629 return false; |
630 } | 630 } |
631 | 631 |
632 // It is always possible to advanced print when print preview is visible. | 632 // It is always possible to advanced print when print preview is visible. |
633 return PrintPreviewShowing(browser) || CanPrint(browser); | 633 return PrintPreviewShowing(browser) || CanPrint(browser); |
634 } | 634 } |
635 | 635 |
| 636 void PrintToDestination(Browser* browser) { |
| 637 browser->GetActiveTabContents()->print_view_manager()->PrintToDestination(); |
| 638 } |
| 639 |
636 void EmailPageLocation(Browser* browser) { | 640 void EmailPageLocation(Browser* browser) { |
637 content::RecordAction(UserMetricsAction("EmailPageLocation")); | 641 content::RecordAction(UserMetricsAction("EmailPageLocation")); |
638 WebContents* wc = browser->GetActiveWebContents(); | 642 WebContents* wc = browser->GetActiveWebContents(); |
639 DCHECK(wc); | 643 DCHECK(wc); |
640 | 644 |
641 std::string title = net::EscapeQueryParamValue( | 645 std::string title = net::EscapeQueryParamValue( |
642 UTF16ToUTF8(wc->GetTitle()), false); | 646 UTF16ToUTF8(wc->GetTitle()), false); |
643 std::string page_url = net::EscapeQueryParamValue(wc->GetURL().spec(), false); | 647 std::string page_url = net::EscapeQueryParamValue(wc->GetURL().spec(), false); |
644 std::string mailto = std::string("mailto:?subject=Fwd:%20") + | 648 std::string mailto = std::string("mailto:?subject=Fwd:%20") + |
645 title + "&body=%0A%0A" + page_url; | 649 title + "&body=%0A%0A" + page_url; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 if (!tab_contents) | 945 if (!tab_contents) |
942 tab_contents = new TabContents(contents); | 946 tab_contents = new TabContents(contents); |
943 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); | 947 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); |
944 | 948 |
945 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 949 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
946 contents->GetRenderViewHost()->SyncRendererPrefs(); | 950 contents->GetRenderViewHost()->SyncRendererPrefs(); |
947 app_browser->window()->Show(); | 951 app_browser->window()->Show(); |
948 } | 952 } |
949 | 953 |
950 } // namespace chrome | 954 } // namespace chrome |
OLD | NEW |