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

Unified Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 22577010: Printing: Add a basic printing mode without print preview and cloud print. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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/webui/options/browser_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index bc9f5c15671730b01e2e23f25a92ed2f13d7fc5e..9fe38555cdd4e35688a10b49fc47707a8be495a7 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -179,18 +179,21 @@ BrowserOptionsHandler::BrowserOptionsHandler()
#if !defined(OS_MACOSX)
default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this);
#endif
-#if(!defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN))
+
+#if defined(ENABLE_FULL_PRINTING)
+#if !defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
// On Windows, we need the PDF plugin which is only guaranteed to exist on
// Google Chrome builds. Use a command-line switch for Windows non-Google
// Chrome builds.
cloud_print_connector_ui_enabled_ =
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableCloudPrintProxy);
-#elif(!defined(OS_CHROMEOS))
+#elif !defined(OS_CHROMEOS)
// Always enabled for Mac, Linux and Google Chrome Windows builds.
// Never enabled for Chrome OS, we don't even need to indicate it.
cloud_print_connector_ui_enabled_ = true;
#endif
+#endif // defined(ENABLE_FULL_PRINTING)
}
BrowserOptionsHandler::~BrowserOptionsHandler() {
@@ -457,7 +460,9 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) {
IDS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_TITLE);
RegisterTitle(values, "spellingConfirmOverlay",
IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE);
+#if defined(ENABLE_FULL_PRINTING)
RegisterCloudPrintValues(values);
+#endif
values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL);
string16 omnibox_url = ASCIIToUTF16(chrome::kOmniboxLearnMoreURL);
@@ -536,6 +541,7 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) {
switches::kEnableResetProfileSettings));
}
+#if defined(ENABLE_FULL_PRINTING)
void BrowserOptionsHandler::RegisterCloudPrintValues(DictionaryValue* values) {
#if defined(OS_CHROMEOS)
values->SetString("cloudPrintChromeosOptionLabel",
@@ -559,6 +565,7 @@ void BrowserOptionsHandler::RegisterCloudPrintValues(DictionaryValue* values) {
IDS_OPTIONS_CLOUD_PRINT_CONNECTOR_ENABLED_BUTTON));
#endif
}
+#endif // defined(ENABLE_FULL_PRINTING)
void BrowserOptionsHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
@@ -613,25 +620,11 @@ void BrowserOptionsHandler::RegisterMessages() {
base::Bind(&BrowserOptionsHandler::ShowManageSSLCertificates,
base::Unretained(this)));
#endif
+#if defined(ENABLE_FULL_PRINTING)
web_ui()->RegisterMessageCallback(
"showCloudPrintManagePage",
base::Bind(&BrowserOptionsHandler::ShowCloudPrintManagePage,
base::Unretained(this)));
-#if !defined(OS_CHROMEOS)
- if (cloud_print_connector_ui_enabled_) {
- web_ui()->RegisterMessageCallback(
- "showCloudPrintSetupDialog",
- base::Bind(&BrowserOptionsHandler::ShowCloudPrintSetupDialog,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "disableCloudPrintConnector",
- base::Bind(&BrowserOptionsHandler::HandleDisableCloudPrintConnector,
- base::Unretained(this)));
- }
- web_ui()->RegisterMessageCallback(
- "showNetworkProxySettings",
- base::Bind(&BrowserOptionsHandler::ShowNetworkProxySettings,
- base::Unretained(this)));
#endif
#if defined(OS_CHROMEOS)
web_ui()->RegisterMessageCallback(
@@ -651,7 +644,23 @@ void BrowserOptionsHandler::RegisterMessages() {
"restartBrowser",
base::Bind(&BrowserOptionsHandler::HandleRestartBrowser,
base::Unretained(this)));
-#endif
+#if defined(ENABLE_FULL_PRINTING)
+ if (cloud_print_connector_ui_enabled_) {
+ web_ui()->RegisterMessageCallback(
+ "showCloudPrintSetupDialog",
+ base::Bind(&BrowserOptionsHandler::ShowCloudPrintSetupDialog,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "disableCloudPrintConnector",
+ base::Bind(&BrowserOptionsHandler::HandleDisableCloudPrintConnector,
+ base::Unretained(this)));
+ }
+#endif // defined(ENABLE_FULL_PRINTING)
+ web_ui()->RegisterMessageCallback(
+ "showNetworkProxySettings",
+ base::Bind(&BrowserOptionsHandler::ShowNetworkProxySettings,
+ base::Unretained(this)));
+#endif // defined(OS_CHROMEOS)
}
void BrowserOptionsHandler::OnStateChanged() {
@@ -707,7 +716,7 @@ void BrowserOptionsHandler::InitializeHandler() {
}
#endif
-#if !defined(OS_CHROMEOS)
+#if defined(ENABLE_FULL_PRINTING) && !defined(OS_CHROMEOS)
base::Closure cloud_print_callback = base::Bind(
&BrowserOptionsHandler::OnCloudPrintPrefsChanged, base::Unretained(this));
cloud_print_connector_email_.Init(
@@ -761,7 +770,8 @@ void BrowserOptionsHandler::InitializePage() {
SetupPageZoomSelector();
SetupAutoOpenFileTypes();
SetupProxySettingsSection();
-#if !defined(OS_CHROMEOS)
+
+#if defined(ENABLE_FULL_PRINTING) && !defined(OS_CHROMEOS)
if (cloud_print_connector_ui_enabled_) {
SetupCloudPrintConnectorSection();
RefreshCloudPrintStatusFromService();
@@ -769,6 +779,7 @@ void BrowserOptionsHandler::InitializePage() {
RemoveCloudPrintConnectorSection();
}
#endif
+
#if defined(OS_CHROMEOS)
SetupAccessibilityFeatures();
if (!g_browser_process->browser_policy_connector()->IsEnterpriseManaged() &&
@@ -1008,12 +1019,12 @@ void BrowserOptionsHandler::Observe(
}
}
+#if defined(ENABLE_FULL_PRINTING) && !defined(OS_CHROMEOS)
void BrowserOptionsHandler::OnCloudPrintPrefsChanged() {
-#if !defined(OS_CHROMEOS)
if (cloud_print_connector_ui_enabled_)
SetupCloudPrintConnectorSection();
-#endif
}
+#endif
void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) {
#if defined(OS_WIN)
@@ -1500,6 +1511,7 @@ void BrowserOptionsHandler::ShowManageSSLCertificates(const ListValue* args) {
}
#endif
+#if defined(ENABLE_FULL_PRINTING)
void BrowserOptionsHandler::ShowCloudPrintManagePage(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_ManageCloudPrinters"));
// Open a new tab in the current window for the management page.
@@ -1578,7 +1590,8 @@ void BrowserOptionsHandler::RemoveCloudPrintConnectorSection() {
web_ui()->CallJavascriptFunction(
"BrowserOptions.removeCloudPrintConnectorSection");
}
-#endif
+#endif // defined(OS_CHROMEOS)
+#endif // defined(ENABLE_FULL_PRINTING)
#if defined(OS_CHROMEOS)
void BrowserOptionsHandler::HandleOpenWallpaperManager(

Powered by Google App Engine
This is Rietveld 408576698