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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 static OptionsStringResource resources[] = { 238 static OptionsStringResource resources[] = {
239 // Please keep these in alphabetical order. 239 // Please keep these in alphabetical order.
240 { "accessibilityFeaturesLink", IDS_OPTIONS_ACCESSIBILITY_FEATURES_LINK }, 240 { "accessibilityFeaturesLink", IDS_OPTIONS_ACCESSIBILITY_FEATURES_LINK },
241 { "accessibilityTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY }, 241 { "accessibilityTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY },
242 { "advancedSectionTitleCertificates", 242 { "advancedSectionTitleCertificates",
243 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CERTIFICATES }, 243 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CERTIFICATES },
244 { "advancedSectionTitleCloudPrint", IDS_GOOGLE_CLOUD_PRINT }, 244 { "advancedSectionTitleCloudPrint", IDS_GOOGLE_CLOUD_PRINT },
245 { "advancedSectionTitleContent", 245 { "advancedSectionTitleContent",
246 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT }, 246 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT },
247 #if defined(OS_CHROMEOS)
248 { "advancedSectionTitleCupsPrint",
249 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CUPS_PRINT },
250 #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
247 { "advancedSectionTitleLanguages", 251 { "advancedSectionTitleLanguages",
248 IDS_OPTIONS_ADVANCED_SECTION_TITLE_LANGUAGES }, 252 IDS_OPTIONS_ADVANCED_SECTION_TITLE_LANGUAGES },
249 { "advancedSectionTitleNetwork", 253 { "advancedSectionTitleNetwork",
250 IDS_OPTIONS_ADVANCED_SECTION_TITLE_NETWORK }, 254 IDS_OPTIONS_ADVANCED_SECTION_TITLE_NETWORK },
251 { "advancedSectionTitlePrivacy", 255 { "advancedSectionTitlePrivacy",
252 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY }, 256 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY },
253 { "advancedSectionTitleSystem", IDS_OPTIONS_ADVANCED_SECTION_TITLE_SYSTEM }, 257 { "advancedSectionTitleSystem", IDS_OPTIONS_ADVANCED_SECTION_TITLE_SYSTEM },
254 { "autoOpenFileTypesInfo", IDS_OPTIONS_OPEN_FILE_TYPES_AUTOMATICALLY }, 258 { "autoOpenFileTypesInfo", IDS_OPTIONS_OPEN_FILE_TYPES_AUTOMATICALLY },
255 { "autoOpenFileTypesResetToDefault", 259 { "autoOpenFileTypesResetToDefault",
256 IDS_OPTIONS_AUTOOPENFILETYPES_RESETTODEFAULT }, 260 IDS_OPTIONS_AUTOOPENFILETYPES_RESETTODEFAULT },
257 { "autofillEnabled", IDS_OPTIONS_AUTOFILL_ENABLE }, 261 { "autofillEnabled", IDS_OPTIONS_AUTOFILL_ENABLE },
258 { "autologinEnabled", IDS_OPTIONS_PASSWORDS_AUTOLOGIN }, 262 { "autologinEnabled", IDS_OPTIONS_PASSWORDS_AUTOLOGIN },
259 { "certificatesManageButton", IDS_OPTIONS_CERTIFICATES_MANAGE_BUTTON }, 263 { "certificatesManageButton", IDS_OPTIONS_CERTIFICATES_MANAGE_BUTTON },
260 { "changeHomePage", IDS_OPTIONS_CHANGE_HOME_PAGE }, 264 { "changeHomePage", IDS_OPTIONS_CHANGE_HOME_PAGE },
261 { "childLabel", IDS_PROFILES_LIST_CHILD_LABEL }, 265 { "childLabel", IDS_PROFILES_LIST_CHILD_LABEL },
266 #if defined(OS_CHROMEOS)
267 { "cupsPrintOptionLabel", IDS_OPTIONS_ADVANCED_SECTION_CUPS_PRINT_LABEL },
268 { "cupsPrintersManageButton",
269 IDS_OPTIONS_ADVANCED_SECTION_CUPS_PRINT_MANAGE_BUTTON },
270 #endif // defined(OS_CHROMEOS)
stevenjb 2016/11/04 00:01:28 These too.
xdai1 2016/11/04 00:07:41 ditto.
262 { "currentUserOnly", IDS_OPTIONS_CURRENT_USER_ONLY }, 271 { "currentUserOnly", IDS_OPTIONS_CURRENT_USER_ONLY },
263 { "customizeSync", IDS_OPTIONS_CUSTOMIZE_SYNC_BUTTON_LABEL }, 272 { "customizeSync", IDS_OPTIONS_CUSTOMIZE_SYNC_BUTTON_LABEL },
264 { "defaultBrowserUnknown", 273 { "defaultBrowserUnknown",
265 IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, IDS_PRODUCT_NAME }, 274 IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, IDS_PRODUCT_NAME },
266 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT }, 275 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT },
267 { "defaultFontSizeLabel", IDS_OPTIONS_DEFAULT_FONT_SIZE_LABEL }, 276 { "defaultFontSizeLabel", IDS_OPTIONS_DEFAULT_FONT_SIZE_LABEL },
268 { "defaultSearchManageEngines", IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES }, 277 { "defaultSearchManageEngines", IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES },
269 { "defaultZoomFactorLabel", IDS_OPTIONS_DEFAULT_ZOOM_LEVEL_LABEL }, 278 { "defaultZoomFactorLabel", IDS_OPTIONS_DEFAULT_ZOOM_LEVEL_LABEL },
270 { "disableWebServices", IDS_OPTIONS_DISABLE_WEB_SERVICES }, 279 { "disableWebServices", IDS_OPTIONS_DISABLE_WEB_SERVICES },
271 { "doNotTrack", IDS_OPTIONS_ENABLE_DO_NOT_TRACK }, 280 { "doNotTrack", IDS_OPTIONS_ENABLE_DO_NOT_TRACK },
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 683
675 values->SetBoolean("profileIsSupervised", 684 values->SetBoolean("profileIsSupervised",
676 Profile::FromWebUI(web_ui())->IsSupervised()); 685 Profile::FromWebUI(web_ui())->IsSupervised());
677 686
678 #if !defined(OS_CHROMEOS) 687 #if !defined(OS_CHROMEOS)
679 values->SetBoolean( 688 values->SetBoolean(
680 "gpuEnabledAtStart", 689 "gpuEnabledAtStart",
681 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); 690 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref());
682 #endif 691 #endif
683 692
693 #if defined(OS_CHROMEOS)
694 values->SetBoolean("cupsPrintEnabled",
695 base::CommandLine::ForCurrentProcess()->HasSwitch(
696 ::switches::kEnableNativeCups));
697 values->SetString("cupsPrintLearnMoreURL",
698 chrome::kChromeUIMdCupsSettingsURL);
699 #endif // defined(OS_CHROMEOS)
700
684 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) 701 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
685 values->SetBoolean("cloudPrintHideNotificationsCheckbox", 702 values->SetBoolean("cloudPrintHideNotificationsCheckbox",
686 !cloud_print::PrivetNotificationService::IsEnabled()); 703 !cloud_print::PrivetNotificationService::IsEnabled());
687 #endif 704 #endif
688 705
689 values->SetBoolean("cloudPrintShowMDnsOptions", 706 values->SetBoolean("cloudPrintShowMDnsOptions",
690 cloud_print_mdns_ui_enabled_); 707 cloud_print_mdns_ui_enabled_);
691 708
692 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL); 709 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL);
693 710
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart, 846 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart,
830 base::Unretained(this))); 847 base::Unretained(this)));
831 web_ui()->RegisterMessageCallback( 848 web_ui()->RegisterMessageCallback(
832 "showAndroidAppsSettings", 849 "showAndroidAppsSettings",
833 base::Bind(&BrowserOptionsHandler::ShowAndroidAppsSettings, 850 base::Bind(&BrowserOptionsHandler::ShowAndroidAppsSettings,
834 base::Unretained(this))); 851 base::Unretained(this)));
835 web_ui()->RegisterMessageCallback( 852 web_ui()->RegisterMessageCallback(
836 "showAccessibilityTalkBackSettings", 853 "showAccessibilityTalkBackSettings",
837 base::Bind(&BrowserOptionsHandler::ShowAccessibilityTalkBackSettings, 854 base::Bind(&BrowserOptionsHandler::ShowAccessibilityTalkBackSettings,
838 base::Unretained(this))); 855 base::Unretained(this)));
856 web_ui()->RegisterMessageCallback(
857 "showCupsPrintDevicesPage",
858 base::Bind(&BrowserOptionsHandler::ShowCupsPrintDevicesPage,
859 base::Unretained(this)));
839 #else 860 #else
840 web_ui()->RegisterMessageCallback( 861 web_ui()->RegisterMessageCallback(
841 "becomeDefaultBrowser", 862 "becomeDefaultBrowser",
842 base::Bind(&BrowserOptionsHandler::BecomeDefaultBrowser, 863 base::Bind(&BrowserOptionsHandler::BecomeDefaultBrowser,
843 base::Unretained(this))); 864 base::Unretained(this)));
844 web_ui()->RegisterMessageCallback( 865 web_ui()->RegisterMessageCallback(
845 "restartBrowser", 866 "restartBrowser",
846 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser, 867 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser,
847 base::Unretained(this))); 868 base::Unretained(this)));
848 web_ui()->RegisterMessageCallback( 869 web_ui()->RegisterMessageCallback(
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 #endif 1719 #endif
1699 1720
1700 #if defined(OS_WIN) || defined(OS_MACOSX) 1721 #if defined(OS_WIN) || defined(OS_MACOSX)
1701 void BrowserOptionsHandler::ShowManageSSLCertificates( 1722 void BrowserOptionsHandler::ShowManageSSLCertificates(
1702 const base::ListValue* args) { 1723 const base::ListValue* args) {
1703 content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates")); 1724 content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates"));
1704 settings_utils::ShowManageSSLCertificates(web_ui()->GetWebContents()); 1725 settings_utils::ShowManageSSLCertificates(web_ui()->GetWebContents());
1705 } 1726 }
1706 #endif 1727 #endif
1707 1728
1729 #if defined(OS_CHROMEOS)
1730 void BrowserOptionsHandler::ShowCupsPrintDevicesPage(
1731 const base::ListValue* args) {
1732 // Navigate in current tab to CUPS printers management page.
1733 OpenURLParams params(GURL(chrome::kChromeUIMdCupsSettingsURL), Referrer(),
1734 WindowOpenDisposition::NEW_FOREGROUND_TAB,
1735 ui::PAGE_TRANSITION_LINK, false);
1736 web_ui()->GetWebContents()->OpenURL(params);
1737 }
1738 #endif // defined(OS_CHROMEOS)
1739
1708 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) 1740 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
1709 void BrowserOptionsHandler::ShowCloudPrintDevicesPage( 1741 void BrowserOptionsHandler::ShowCloudPrintDevicesPage(
1710 const base::ListValue* args) { 1742 const base::ListValue* args) {
1711 content::RecordAction(UserMetricsAction("Options_CloudPrintDevicesPage")); 1743 content::RecordAction(UserMetricsAction("Options_CloudPrintDevicesPage"));
1712 // Navigate in current tab to devices page. 1744 // Navigate in current tab to devices page.
1713 OpenURLParams params(GURL(chrome::kChromeUIDevicesURL), Referrer(), 1745 OpenURLParams params(GURL(chrome::kChromeUIDevicesURL), Referrer(),
1714 WindowOpenDisposition::CURRENT_TAB, 1746 WindowOpenDisposition::CURRENT_TAB,
1715 ui::PAGE_TRANSITION_LINK, false); 1747 ui::PAGE_TRANSITION_LINK, false);
1716 web_ui()->GetWebContents()->OpenURL(params); 1748 web_ui()->GetWebContents()->OpenURL(params);
1717 } 1749 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 2261
2230 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2262 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2231 #if defined(OS_CHROMEOS) 2263 #if defined(OS_CHROMEOS)
2232 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2264 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2233 #else 2265 #else
2234 return true; 2266 return true;
2235 #endif 2267 #endif
2236 } 2268 }
2237 2269
2238 } // namespace options 2270 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698