Skip to content

Commit

Permalink
Remove the --disable-native-cups flag.
Browse files Browse the repository at this point in the history
Native CUPS has been turned on since M59 and it has settled well.
The flag to turn it off is being removed.  Also clean up code that is
now extraneous.

Bug: 733793
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I351790c7f8f0a486743e190355af7922b0105676
Reviewed-on: https://chromium-review.googlesource.com/575829
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Sean Kau <skau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488695}
  • Loading branch information
Sean Kau authored and Commit Bot committed Jul 21, 2017
1 parent e8810fe commit 80e92e7
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 134 deletions.
3 changes: 0 additions & 3 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2535,9 +2535,6 @@ const FeatureEntry kFeatureEntries[] = {
kOsCrOS,
SINGLE_VALUE_TYPE(
chromeos::switches::kDisableSystemTimezoneAutomaticDetectionPolicy)},
{"disable-native-cups", flag_descriptions::kDisableNativeCupsName,
flag_descriptions::kDisableNativeCupsDescription, kOsCrOS,
SINGLE_VALUE_TYPE(switches::kDisableNativeCups)},
{"enable-cros-component", flag_descriptions::kCrOSComponentName,
flag_descriptions::kCrOSComponentDescription, kOsCrOS,
FEATURE_VALUE_TYPE(features::kCrOSComponent)},
Expand Down
4 changes: 0 additions & 4 deletions chrome/browser/chromeos/chrome_browser_main_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -728,10 +728,6 @@ void ChromeBrowserMainPartsChromeos::PreProfileInit() {
WizardController::SetZeroDelays();
}

// Enable/disable native CUPS integration
printing::PrintBackend::SetNativeCupsEnabled(
!parsed_command_line().HasSwitch(::switches::kDisableNativeCups));

power_prefs_.reset(new PowerPrefs(PowerPolicyController::Get()));

arc_kiosk_app_manager_.reset(new ArcKioskAppManager());
Expand Down
5 changes: 0 additions & 5 deletions chrome/browser/flag_descriptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2300,11 +2300,6 @@ const char kUseWinrtMidiApiDescription[] =

#if defined(OS_CHROMEOS)

const char kDisableNativeCupsName[] = "Native CUPS";

const char kDisableNativeCupsDescription[] =
"Disable the use of the native CUPS printing backend.";

const char kEnableAndroidWallpapersAppName[] = "Android Wallpapers App";

const char kEnableAndroidWallpapersAppDescription[] =
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/flag_descriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1285,9 +1285,6 @@ extern const char kCrosRegionsModeDefault[];
extern const char kCrosRegionsModeOverride[];
extern const char kCrosRegionsModeHide[];

extern const char kDisableNativeCupsName[];
extern const char kDisableNativeCupsDescription[];

extern const char kDisableNewVirtualKeyboardBehaviorName[];
extern const char kDisableNewVirtualKeyboardBehaviorDescription[];

Expand Down
10 changes: 4 additions & 6 deletions chrome/browser/resources/options/browser_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,12 +722,10 @@ cr.define('options', function() {

// CUPS Print section (CrOS only).
if (cr.isChromeOS) {
if (!loadTimeData.getBoolean('cupsPrintDisabled')) {
$('cups-printers-section').hidden = false;
$('cupsPrintersManageButton').onclick = function() {
chrome.send('showCupsPrintDevicesPage');
};
}
$('cups-printers-section').hidden = false;
$('cupsPrintersManageButton').onclick = function() {
chrome.send('showCupsPrintDevicesPage');
};
}

if (loadTimeData.getBoolean('cloudPrintShowMDnsOptions')) {
Expand Down
48 changes: 22 additions & 26 deletions chrome/browser/resources/settings/printing_page/printing_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
</array-selector>
<neon-animatable route-path="default">
<if expr="chromeos">
<template is="dom-if" if="[[showCupsPrintingFeatures_]]">
<div id="cupsPrinters" class="settings-box first"
on-tap="onTapCupsPrinters_" actionable>
<div class="start">$i18n{cupsPrintersTitle}</div>
<button class="subpage-arrow" is="paper-icon-button-light"
aria-label="$i18n{cupsPrintersTitle}"></button>
</div>
</template>
<div id="cupsPrinters" class="settings-box first"
on-tap="onTapCupsPrinters_" actionable>
<div class="start">$i18n{cupsPrintersTitle}</div>
<button class="subpage-arrow" is="paper-icon-button-light"
aria-label="$i18n{cupsPrintersTitle}"></button>
</div>
</if>
<div id="cloudPrinters" class="settings-box"
on-tap="onTapCloudPrinters_" actionable>
Expand All @@ -40,25 +38,23 @@
</div>
</neon-animatable>
<if expr="chromeos">
<template is="dom-if" if="[[showCupsPrintingFeatures_]]">
<template is="dom-if" route-path="/cupsPrinters">
<settings-subpage
associated-control="[[$$('#cupsPrinters')]]"
page-title="$i18n{cupsPrintersTitle}"
search-label="$i18n{searchLabel}"
<template is="dom-if" route-path="/cupsPrinters">
<settings-subpage
associated-control="[[$$('#cupsPrinters')]]"
page-title="$i18n{cupsPrintersTitle}"
search-label="$i18n{searchLabel}"
search-term="{{searchTerm}}">
<settings-cups-printers printers="{{cupsPrinters}}"
search-term="{{searchTerm}}">
<settings-cups-printers printers="{{cupsPrinters}}"
search-term="{{searchTerm}}">
</settings-cups-printers>
</settings-subpage>
</template>
<template is="dom-if" route-path="/cupsPrinterDetails" restamp
no-search>
<settings-subpage page-title="$i18n{printerDetailsTitle}">
<settings-cups-printer-details-page printer="{{detailPrinter_}}">
</settings-cups-printer-details-page>
</settings-subpage>
</template>
</settings-cups-printers>
</settings-subpage>
</template>
<template is="dom-if" route-path="/cupsPrinterDetails" restamp
no-search>
<settings-subpage page-title="$i18n{printerDetailsTitle}">
<settings-cups-printer-details-page printer="{{detailPrinter_}}">
</settings-cups-printer-details-page>
</settings-subpage>
</template>
</if>
<template is="dom-if" route-path="/cloudPrinters">
Expand Down
13 changes: 0 additions & 13 deletions chrome/browser/resources/settings/printing_page/printing_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ Polymer({
notify: true,
},

// <if expr="chromeos">
/**
* Whether to show CUPS printers settings.
* @private {boolean}
*/
showCupsPrintingFeatures_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('showCupsPrintingFeatures');
},
},
// </if>

/** @type {!Array<!CupsPrinterInfo>} */
cupsPrinters: {
type: Array,
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/ui/webui/options/browser_options_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,6 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
#endif

#if defined(OS_CHROMEOS)
values->SetBoolean("cupsPrintDisabled",
base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kDisableNativeCups));
values->SetString("cupsPrintLearnMoreURL", chrome::kCrosPrintingLearnMoreURL);
#endif // defined(OS_CHROMEOS)

Expand Down
9 changes: 2 additions & 7 deletions chrome/browser/ui/webui/print_preview/print_preview_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <utility>
#include <vector>

#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/id_map.h"
#include "base/lazy_instance.h"
Expand All @@ -33,7 +32,6 @@
#include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
Expand Down Expand Up @@ -420,18 +418,15 @@ content::WebUIDataSource* CreatePrintPreviewUISource(Profile* profile) {
#else
source->AddBoolean("printPdfAsImageEnabled", false);
#endif

#if defined(OS_CHROMEOS)
bool cups_and_md_settings_enabled =
!base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kDisableNativeCups);
source->AddBoolean("showLocalManageButton", cups_and_md_settings_enabled);
source->AddBoolean("useSystemDefaultPrinter", false);
#else
source->AddBoolean("showLocalManageButton", true);
bool system_default_printer = profile->GetPrefs()->GetBoolean(
prefs::kPrintPreviewUseSystemDefaultPrinter);
source->AddBoolean("useSystemDefaultPrinter", system_default_printer);
#endif
source->AddBoolean("showLocalManageButton", true);
return source;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <vector>

#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
Expand All @@ -22,7 +21,6 @@
#include "chrome/browser/chromeos/printing/synced_printers_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/print_preview/printer_capabilities.h"
#include "chrome/common/chrome_switches.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/debug_daemon_client.h"
#include "chromeos/printing/ppd_provider.h"
Expand Down Expand Up @@ -99,12 +97,8 @@ class PrinterBackendProxyChromeos : public PrinterBackendProxy {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

PrinterList printer_list;

if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableNativeCups)) {
AddPrintersToList(prefs_->GetConfiguredPrinters(), &printer_list);
AddPrintersToList(prefs_->GetEnterprisePrinters(), &printer_list);
}
AddPrintersToList(prefs_->GetConfiguredPrinters(), &printer_list);
AddPrintersToList(prefs_->GetEnterprisePrinters(), &printer_list);

content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
base::Bind(cb, printer_list));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1593,9 +1593,6 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) {
chrome::kCloudPrintLearnMoreURL);

#if defined(OS_CHROMEOS)
html_source->AddBoolean("showCupsPrintingFeatures",
!base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kDisableNativeCups));
html_source->AddString("printingCUPSPrintLearnMoreUrl",
chrome::kCupsPrintLearnMoreURL);
#endif
Expand Down
3 changes: 0 additions & 3 deletions chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,6 @@ const char kDisableLoggingRedirect[] = "disable-logging-redirect";
// Disables apps on the login screen. By default, they are allowed and can be
// installed through policy.
const char kDisableLoginScreenApps[] = "disable-login-screen-apps";

// Disables native cups integration
const char kDisableNativeCups[] = "disable-native-cups";
#endif // defined(OS_CHROMEOS)

#if defined(USE_ASH)
Expand Down
1 change: 0 additions & 1 deletion chrome/common/chrome_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ extern const char kWebApkServerUrl[];
extern const char kCroshCommand[];
extern const char kDisableLoggingRedirect[];
extern const char kDisableLoginScreenApps[];
extern const char kDisableNativeCups[];
#endif // defined(OS_CHROMEOS)

#if defined(USE_ASH)
Expand Down
5 changes: 0 additions & 5 deletions chrome/test/data/webui/settings/cr_settings_browsertest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1622,11 +1622,6 @@ CrSettingsPrintingPageTest.prototype = {
browsePreload:
'chrome://md-settings/printing_page/cups_add_printer_dialog.html',

/** @override */
commandLineSwitches: [{
switchName: 'enable-native-cups',
}],

/** @override */
extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([
ROOT_PATH + 'ui/webui/resources/js/assert.js',
Expand Down
11 changes: 0 additions & 11 deletions printing/backend/print_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "printing/backend/print_backend.h"

namespace {
bool g_native_cups_enabled = false;

// PrintBackend override for testing.
printing::PrintBackend* g_print_backend_for_test = nullptr;
Expand Down Expand Up @@ -61,14 +60,4 @@ void PrintBackend::SetPrintBackendForTesting(PrintBackend* backend) {
g_print_backend_for_test = backend;
}

// static
bool PrintBackend::GetNativeCupsEnabled() {
return g_native_cups_enabled;
}

// static
void PrintBackend::SetNativeCupsEnabled(bool enabled) {
g_native_cups_enabled = enabled;
}

} // namespace printing
5 changes: 0 additions & 5 deletions printing/backend/print_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ class PRINTING_EXPORT PrintBackend
// retain ownership.
static void SetPrintBackendForTesting(PrintBackend* print_backend);

// Returns the value of the native cups flag
static bool GetNativeCupsEnabled();

static void SetNativeCupsEnabled(bool enabled);

protected:
friend class base::RefCountedThreadSafe<PrintBackend>;
virtual ~PrintBackend();
Expand Down
51 changes: 28 additions & 23 deletions printing/backend/print_backend_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "printing/backend/print_backend.h"

#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/values.h"
#include "printing/backend/print_backend_consts.h"
#include "url/gurl.h"
Expand All @@ -15,6 +16,29 @@
#endif // defined(USE_CUPS)

namespace printing {
namespace {

#if defined(USE_CUPS)
std::unique_ptr<CupsConnection> CreateConnection(
const base::DictionaryValue* print_backend_settings) {
std::string print_server_url_str;
std::string cups_blocking;
int encryption = HTTP_ENCRYPT_NEVER;
if (print_backend_settings) {
print_backend_settings->GetString(kCUPSPrintServerURL,
&print_server_url_str);
print_backend_settings->GetString(kCUPSBlocking, &cups_blocking);
print_backend_settings->GetInteger(kCUPSEncryption, &encryption);
}
GURL print_server_url(print_server_url_str);

return base::MakeUnique<CupsConnection>(
print_server_url, static_cast<http_encryption_t>(encryption),
cups_blocking == kValueTrue);
}
#endif // defined(USE_CUPS)

} // namespace

// Provides either a stubbed out PrintBackend implementation or a CUPS IPP
// implementation for use on ChromeOS.
Expand Down Expand Up @@ -82,31 +106,12 @@ bool PrintBackendChromeOS::IsValidPrinter(const std::string& printer_name) {
// static
scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl(
const base::DictionaryValue* print_backend_settings) {
if (GetNativeCupsEnabled()) {
#if defined(USE_CUPS)
std::string print_server_url_str;
std::string cups_blocking;
int encryption = HTTP_ENCRYPT_NEVER;
if (print_backend_settings) {
print_backend_settings->GetString(kCUPSPrintServerURL,
&print_server_url_str);

print_backend_settings->GetString(kCUPSBlocking, &cups_blocking);

print_backend_settings->GetInteger(kCUPSEncryption, &encryption);
}
GURL print_server_url(print_server_url_str);

std::unique_ptr<CupsConnection> connection =
base::MakeUnique<CupsConnection>(
print_server_url, static_cast<http_encryption_t>(encryption),
cups_blocking == kValueTrue);

return new PrintBackendCupsIpp(std::move(connection));
return make_scoped_refptr(
new PrintBackendCupsIpp(CreateConnection(print_backend_settings)));
#else
return make_scoped_refptr(new PrintBackendChromeOS());
#endif // defined(USE_CUPS)
}

return new PrintBackendChromeOS();
}

} // namespace printing
6 changes: 1 addition & 5 deletions printing/printing_context_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "printing/metafile.h"
#include "printing/print_job_constants.h"
#include "printing/print_settings.h"
#include "printing/printing_context_no_system_dialog.h"
#include "printing/units.h"

namespace printing {
Expand Down Expand Up @@ -150,10 +149,7 @@ void SetPrintableArea(PrintSettings* settings,

// static
std::unique_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) {
if (PrintBackend::GetNativeCupsEnabled())
return base::MakeUnique<PrintingContextChromeos>(delegate);

return base::MakeUnique<PrintingContextNoSystemDialog>(delegate);
return base::MakeUnique<PrintingContextChromeos>(delegate);
}

PrintingContextChromeos::PrintingContextChromeos(Delegate* delegate)
Expand Down

0 comments on commit 80e92e7

Please sign in to comment.