Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5014)

Unified Diff: chrome/browser/ui/browser.cc

Issue 7721001: PrintPreview: Make ctrl-shift-p start the native print flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 72b6f33163898ed4e6ea749d8eaf4bfeef905642..1629c216137b0ee2569d59a32068d633eeaa929b 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -57,6 +57,7 @@
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
+#include "chrome/browser/printing/print_preview_tab_controller.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/restore_tab_helper.h"
#include "chrome/browser/sessions/session_service.h"
@@ -1757,6 +1758,10 @@ void Browser::Print() {
GetSelectedTabContentsWrapper()->print_view_manager()->PrintNow();
}
+void Browser::AdvancedPrint() {
+ GetSelectedTabContentsWrapper()->print_view_manager()->AdvancedPrintNow();
+}
+
void Browser::ToggleEncodingAutoDetect() {
UserMetrics::RecordAction(UserMetricsAction("AutoDetectChange"));
encoding_auto_detect_.SetValue(!encoding_auto_detect_.GetValue());
@@ -2430,6 +2435,7 @@ void Browser::ExecuteCommandWithDisposition(
case IDC_VIEW_SOURCE: ViewSelectedSource(); break;
case IDC_EMAIL_PAGE_LOCATION: EmailPageLocation(); break;
case IDC_PRINT: Print(); break;
+ case IDC_ADVANCED_PRINT: AdvancedPrint(); break;
case IDC_ENCODING_AUTO_DETECT: ToggleEncodingAutoDetect(); break;
case IDC_ENCODING_UTF8:
case IDC_ENCODING_UTF16LE:
@@ -4159,13 +4165,18 @@ void Browser::UpdateCommandsForContentRestrictionState() {
void Browser::UpdatePrintingState(int content_restrictions) {
bool enabled = true;
+ bool is_preview_tab = true;
Lei Zhang 2011/08/25 09:05:49 This variable is poorly named. It's true in some c
kmadhusu 2011/08/25 17:51:48 Fixed...
if (content_restrictions & CONTENT_RESTRICTION_PRINT) {
enabled = false;
+ is_preview_tab = printing::PrintPreviewTabController::IsPrintPreviewTab(
+ GetSelectedTabContents());
} else if (g_browser_process->local_state()) {
enabled = g_browser_process->local_state()->
GetBoolean(prefs::kPrintingEnabled);
}
command_updater_.UpdateCommandEnabled(IDC_PRINT, enabled);
+ command_updater_.UpdateCommandEnabled(IDC_ADVANCED_PRINT,
+ is_preview_tab ? true : enabled);
}
void Browser::UpdateReloadStopState(bool is_loading, bool force) {

Powered by Google App Engine
This is Rietveld 408576698