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

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 2407483002: Make enable_service_discovery a chrome/ feature. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.h ('k') | chrome/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index 147b18db3a916b2289ca5b8401aa05fcb4a69ea1..1119b974cb21344b9e07167d50ae48668930743d 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -90,7 +90,7 @@
#include "chrome/common/url_constants.h"
#endif
-#if defined(ENABLE_SERVICE_DISCOVERY)
+#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
#include "chrome/browser/printing/cloud_print/privet_constants.h"
#endif
@@ -501,6 +501,14 @@ base::FilePath GetUniquePath(const base::FilePath& path) {
return unique_path;
}
+bool PrivetPrintingEnabled() {
+#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
+ return true;
+#else
+ return false;
+#endif
+}
+
} // namespace
class PrintPreviewHandler::AccessTokenService
@@ -669,14 +677,6 @@ void PrintPreviewHandler::RegisterMessages() {
RegisterForGaiaCookieChanges();
}
-bool PrintPreviewHandler::PrivetPrintingEnabled() {
-#if defined(ENABLE_SERVICE_DISCOVERY)
- return true;
-#else
- return false;
-#endif
-}
-
WebContents* PrintPreviewHandler::preview_web_contents() const {
return web_ui()->GetWebContents();
}
@@ -697,17 +697,17 @@ void PrintPreviewHandler::HandleGetPrinters(const base::ListValue* /*args*/) {
void PrintPreviewHandler::HandleGetPrivetPrinters(const base::ListValue* args) {
if (!PrivetPrintingEnabled())
return web_ui()->CallJavascriptFunctionUnsafe("onPrivetPrinterSearchDone");
-#if defined(ENABLE_SERVICE_DISCOVERY)
+#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
using local_discovery::ServiceDiscoverySharedClient;
scoped_refptr<ServiceDiscoverySharedClient> service_discovery =
ServiceDiscoverySharedClient::GetInstance();
StartPrivetLister(service_discovery);
-#endif // ENABLE_SERVICE_DISCOVERY
+#endif
}
void PrintPreviewHandler::HandleStopGetPrivetPrinters(
const base::ListValue* args) {
-#if defined(ENABLE_SERVICE_DISCOVERY)
+#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
if (PrivetPrintingEnabled() && printer_lister_) {
printer_lister_->Stop();
}
@@ -716,7 +716,7 @@ void PrintPreviewHandler::HandleStopGetPrivetPrinters(
void PrintPreviewHandler::HandleGetPrivetPrinterCapabilities(
const base::ListValue* args) {
-#if defined(ENABLE_SERVICE_DISCOVERY)
+#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
std::string name;
bool success = args->GetString(0, &name);
DCHECK(success);
@@ -890,7 +890,7 @@ void PrintPreviewHandler::HandlePrint(const base::ListValue* args) {
return;
}
-#if defined(ENABLE_SERVICE_DISCOVERY)
+#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
if (print_with_privet && PrivetPrintingEnabled()) {
std::string printer_name;
std::string print_ticket;
@@ -1485,8 +1485,7 @@ bool PrintPreviewHandler::GetPreviewDataAndTitle(
return true;
}
-#if defined(ENABLE_SERVICE_DISCOVERY)
-
+#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
void PrintPreviewHandler::StartPrivetLister(const scoped_refptr<
local_discovery::ServiceDiscoverySharedClient>& client) {
if (!PrivetPrintingEnabled())
@@ -1694,8 +1693,7 @@ void PrintPreviewHandler::FillPrinterDescription(
command_line->HasSwitch(switches::kEnablePrintPreviewRegisterPromos));
printer_value->SetString("cloudID", description.id);
}
-
-#endif // defined(ENABLE_SERVICE_DISCOVERY)
+#endif // BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
void PrintPreviewHandler::EnsureExtensionPrinterHandlerSet() {
if (extension_printer_handler_)
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.h ('k') | chrome/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698