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

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

Issue 2464403003: [CUPS] Implement the "Printers" section in chrome://settings. (Closed)
Patch Set: . Created 4 years, 1 month 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 277d5d35a6445ad7a22814177d13af8c5990eef2..d0dfe0e1213aac5b16eefe31f17d1eba9aa601e7 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -244,6 +244,10 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
{ "advancedSectionTitleCloudPrint", IDS_GOOGLE_CLOUD_PRINT },
{ "advancedSectionTitleContent",
IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT },
+#if defined(OS_CHROMEOS)
+ { "advancedSectionTitleCupsPrint",
+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_CUPS_PRINT },
+#endif // defined(OS_CHROMEOS)
stevenjb 2016/11/04 00:01:28 Move this down to large existing OS_CHROMEOS secti
xdai1 2016/11/04 00:07:41 In line 239, it says "keep these in alphabetical o
stevenjb 2016/11/04 00:27:17 There is a separate alphebetized section for OS_CH
xdai1 2016/11/04 05:29:45 Ah. I see. Didn't noticed that there is a seprate
{ "advancedSectionTitleLanguages",
IDS_OPTIONS_ADVANCED_SECTION_TITLE_LANGUAGES },
{ "advancedSectionTitleNetwork",
@@ -259,6 +263,11 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
{ "certificatesManageButton", IDS_OPTIONS_CERTIFICATES_MANAGE_BUTTON },
{ "changeHomePage", IDS_OPTIONS_CHANGE_HOME_PAGE },
{ "childLabel", IDS_PROFILES_LIST_CHILD_LABEL },
+#if defined(OS_CHROMEOS)
+ { "cupsPrintOptionLabel", IDS_OPTIONS_ADVANCED_SECTION_CUPS_PRINT_LABEL },
+ { "cupsPrintersManageButton",
+ IDS_OPTIONS_ADVANCED_SECTION_CUPS_PRINT_MANAGE_BUTTON },
+#endif // defined(OS_CHROMEOS)
stevenjb 2016/11/04 00:01:28 These too.
xdai1 2016/11/04 00:07:41 ditto.
{ "currentUserOnly", IDS_OPTIONS_CURRENT_USER_ONLY },
{ "customizeSync", IDS_OPTIONS_CUSTOMIZE_SYNC_BUTTON_LABEL },
{ "defaultBrowserUnknown",
@@ -681,6 +690,14 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref());
#endif
+#if defined(OS_CHROMEOS)
+ values->SetBoolean("cupsPrintEnabled",
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ ::switches::kEnableNativeCups));
+ values->SetString("cupsPrintLearnMoreURL",
+ chrome::kChromeUIMdCupsSettingsURL);
+#endif // defined(OS_CHROMEOS)
+
#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
values->SetBoolean("cloudPrintHideNotificationsCheckbox",
!cloud_print::PrivetNotificationService::IsEnabled());
@@ -836,6 +853,10 @@ void BrowserOptionsHandler::RegisterMessages() {
"showAccessibilityTalkBackSettings",
base::Bind(&BrowserOptionsHandler::ShowAccessibilityTalkBackSettings,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "showCupsPrintDevicesPage",
+ base::Bind(&BrowserOptionsHandler::ShowCupsPrintDevicesPage,
+ base::Unretained(this)));
#else
web_ui()->RegisterMessageCallback(
"becomeDefaultBrowser",
@@ -1705,6 +1726,17 @@ void BrowserOptionsHandler::ShowManageSSLCertificates(
}
#endif
+#if defined(OS_CHROMEOS)
+void BrowserOptionsHandler::ShowCupsPrintDevicesPage(
+ const base::ListValue* args) {
+ // Navigate in current tab to CUPS printers management page.
+ OpenURLParams params(GURL(chrome::kChromeUIMdCupsSettingsURL), Referrer(),
+ WindowOpenDisposition::NEW_FOREGROUND_TAB,
+ ui::PAGE_TRANSITION_LINK, false);
+ web_ui()->GetWebContents()->OpenURL(params);
+}
+#endif // defined(OS_CHROMEOS)
+
#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
void BrowserOptionsHandler::ShowCloudPrintDevicesPage(
const base::ListValue* args) {

Powered by Google App Engine
This is Rietveld 408576698