OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "chrome/browser/ui/browser_finder.h" | 59 #include "chrome/browser/ui/browser_finder.h" |
60 #include "chrome/browser/ui/chrome_select_file_policy.h" | 60 #include "chrome/browser/ui/chrome_select_file_policy.h" |
61 #include "chrome/browser/ui/passwords/manage_passwords_view_utils_desktop.h" | 61 #include "chrome/browser/ui/passwords/manage_passwords_view_utils_desktop.h" |
62 #include "chrome/browser/ui/webui/favicon_source.h" | 62 #include "chrome/browser/ui/webui/favicon_source.h" |
63 #include "chrome/browser/ui/webui/profile_helper.h" | 63 #include "chrome/browser/ui/webui/profile_helper.h" |
64 #include "chrome/common/chrome_constants.h" | 64 #include "chrome/common/chrome_constants.h" |
65 #include "chrome/common/chrome_features.h" | 65 #include "chrome/common/chrome_features.h" |
66 #include "chrome/common/chrome_paths.h" | 66 #include "chrome/common/chrome_paths.h" |
67 #include "chrome/common/chrome_switches.h" | 67 #include "chrome/common/chrome_switches.h" |
68 #include "chrome/common/extensions/extension_constants.h" | 68 #include "chrome/common/extensions/extension_constants.h" |
| 69 #include "chrome/common/features.h" |
69 #include "chrome/common/pref_names.h" | 70 #include "chrome/common/pref_names.h" |
70 #include "chrome/common/url_constants.h" | 71 #include "chrome/common/url_constants.h" |
71 #include "chrome/grit/chromium_strings.h" | 72 #include "chrome/grit/chromium_strings.h" |
72 #include "chrome/grit/generated_resources.h" | 73 #include "chrome/grit/generated_resources.h" |
73 #include "chrome/grit/locale_settings.h" | 74 #include "chrome/grit/locale_settings.h" |
74 #include "components/browser_sync/profile_sync_service.h" | 75 #include "components/browser_sync/profile_sync_service.h" |
75 #include "components/metrics/metrics_pref_names.h" | 76 #include "components/metrics/metrics_pref_names.h" |
76 #include "components/policy/core/common/policy_map.h" | 77 #include "components/policy/core/common/policy_map.h" |
77 #include "components/policy/core/common/policy_namespace.h" | 78 #include "components/policy/core/common/policy_namespace.h" |
78 #include "components/policy/core/common/policy_service.h" | 79 #include "components/policy/core/common/policy_service.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 #include "chrome/browser/ui/browser_window.h" | 137 #include "chrome/browser/ui/browser_window.h" |
137 #include "chromeos/chromeos_switches.h" | 138 #include "chromeos/chromeos_switches.h" |
138 #include "chromeos/dbus/dbus_thread_manager.h" | 139 #include "chromeos/dbus/dbus_thread_manager.h" |
139 #include "chromeos/dbus/power_manager_client.h" | 140 #include "chromeos/dbus/power_manager_client.h" |
140 #include "components/arc/arc_bridge_service.h" | 141 #include "components/arc/arc_bridge_service.h" |
141 #include "components/user_manager/user.h" | 142 #include "components/user_manager/user.h" |
142 #include "components/user_manager/user_manager.h" | 143 #include "components/user_manager/user_manager.h" |
143 #include "ui/gfx/image/image_skia.h" | 144 #include "ui/gfx/image/image_skia.h" |
144 #endif // defined(OS_CHROMEOS) | 145 #endif // defined(OS_CHROMEOS) |
145 | 146 |
146 #if defined(ENABLE_SERVICE_DISCOVERY) | 147 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
147 #include "chrome/browser/printing/cloud_print/privet_notifications.h" | 148 #include "chrome/browser/printing/cloud_print/privet_notifications.h" |
148 #endif | 149 #endif |
149 | 150 |
150 #if defined(USE_ASH) | 151 #if defined(USE_ASH) |
151 #include "ash/common/wm_shell.h" // nogncheck | 152 #include "ash/common/wm_shell.h" // nogncheck |
152 #endif | 153 #endif |
153 | 154 |
154 using base::UserMetricsAction; | 155 using base::UserMetricsAction; |
155 using content::BrowserContext; | 156 using content::BrowserContext; |
156 using content::BrowserThread; | 157 using content::BrowserThread; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 weak_ptr_factory_(this) { | 193 weak_ptr_factory_(this) { |
193 #if !defined(OS_CHROMEOS) | 194 #if !defined(OS_CHROMEOS) |
194 // The worker pointer is reference counted. While it is running, the | 195 // The worker pointer is reference counted. While it is running, the |
195 // message loops of the FILE and UI thread will hold references to it | 196 // message loops of the FILE and UI thread will hold references to it |
196 // and it will be automatically freed once all its tasks have finished. | 197 // and it will be automatically freed once all its tasks have finished. |
197 default_browser_worker_ = new shell_integration::DefaultBrowserWorker( | 198 default_browser_worker_ = new shell_integration::DefaultBrowserWorker( |
198 base::Bind(&BrowserOptionsHandler::OnDefaultBrowserWorkerFinished, | 199 base::Bind(&BrowserOptionsHandler::OnDefaultBrowserWorkerFinished, |
199 weak_ptr_factory_.GetWeakPtr())); | 200 weak_ptr_factory_.GetWeakPtr())); |
200 #endif // !defined(OS_CHROMEOS) | 201 #endif // !defined(OS_CHROMEOS) |
201 | 202 |
202 #if defined(ENABLE_SERVICE_DISCOVERY) | 203 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
203 cloud_print_mdns_ui_enabled_ = true; | 204 cloud_print_mdns_ui_enabled_ = true; |
204 #endif // defined(ENABLE_SERVICE_DISCOVERY) | 205 #endif |
205 } | 206 } |
206 | 207 |
207 BrowserOptionsHandler::~BrowserOptionsHandler() { | 208 BrowserOptionsHandler::~BrowserOptionsHandler() { |
208 browser_sync::ProfileSyncService* sync_service( | 209 browser_sync::ProfileSyncService* sync_service( |
209 ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 210 ProfileSyncServiceFactory::GetInstance()->GetForProfile( |
210 Profile::FromWebUI(web_ui()))); | 211 Profile::FromWebUI(web_ui()))); |
211 if (sync_service) | 212 if (sync_service) |
212 sync_service->RemoveObserver(this); | 213 sync_service->RemoveObserver(this); |
213 | 214 |
214 if (template_url_service_) | 215 if (template_url_service_) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) | 551 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) |
551 | 552 |
552 #if defined(OS_CHROMEOS) && defined(USE_ASH) | 553 #if defined(OS_CHROMEOS) && defined(USE_ASH) |
553 { "setWallpaper", IDS_SET_WALLPAPER_BUTTON }, | 554 { "setWallpaper", IDS_SET_WALLPAPER_BUTTON }, |
554 #endif // defined(OS_CHROMEOS) && defined(USE_ASH) | 555 #endif // defined(OS_CHROMEOS) && defined(USE_ASH) |
555 | 556 |
556 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 557 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
557 { "backgroundModeCheckbox", IDS_OPTIONS_SYSTEM_ENABLE_BACKGROUND_MODE }, | 558 { "backgroundModeCheckbox", IDS_OPTIONS_SYSTEM_ENABLE_BACKGROUND_MODE }, |
558 #endif // defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 559 #endif // defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
559 | 560 |
560 #if defined(ENABLE_SERVICE_DISCOVERY) | 561 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
561 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON }, | 562 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON }, |
562 { "cloudPrintEnableNotificationsLabel", | 563 { "cloudPrintEnableNotificationsLabel", |
563 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, | 564 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, |
564 #endif // defined(ENABLE_SERVICE_DISCOVERY) | 565 #endif |
565 }; | 566 }; |
566 | 567 |
567 RegisterStrings(values, resources, arraysize(resources)); | 568 RegisterStrings(values, resources, arraysize(resources)); |
568 RegisterTitle(values, "doNotTrackConfirmOverlay", | 569 RegisterTitle(values, "doNotTrackConfirmOverlay", |
569 IDS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_TITLE); | 570 IDS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_TITLE); |
570 RegisterTitle(values, "spellingConfirmOverlay", | 571 RegisterTitle(values, "spellingConfirmOverlay", |
571 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); | 572 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); |
572 #if defined(ENABLE_PRINT_PREVIEW) | 573 #if defined(ENABLE_PRINT_PREVIEW) |
573 RegisterCloudPrintValues(values); | 574 RegisterCloudPrintValues(values); |
574 #endif | 575 #endif |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 | 674 |
674 values->SetBoolean("profileIsSupervised", | 675 values->SetBoolean("profileIsSupervised", |
675 Profile::FromWebUI(web_ui())->IsSupervised()); | 676 Profile::FromWebUI(web_ui())->IsSupervised()); |
676 | 677 |
677 #if !defined(OS_CHROMEOS) | 678 #if !defined(OS_CHROMEOS) |
678 values->SetBoolean( | 679 values->SetBoolean( |
679 "gpuEnabledAtStart", | 680 "gpuEnabledAtStart", |
680 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); | 681 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); |
681 #endif | 682 #endif |
682 | 683 |
683 #if defined(ENABLE_SERVICE_DISCOVERY) | 684 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
684 values->SetBoolean("cloudPrintHideNotificationsCheckbox", | 685 values->SetBoolean("cloudPrintHideNotificationsCheckbox", |
685 !cloud_print::PrivetNotificationService::IsEnabled()); | 686 !cloud_print::PrivetNotificationService::IsEnabled()); |
686 #endif | 687 #endif |
687 | 688 |
688 values->SetBoolean("cloudPrintShowMDnsOptions", | 689 values->SetBoolean("cloudPrintShowMDnsOptions", |
689 cloud_print_mdns_ui_enabled_); | 690 cloud_print_mdns_ui_enabled_); |
690 | 691 |
691 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL); | 692 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL); |
692 | 693 |
693 values->SetString("languagesLearnMoreURL", | 694 values->SetString("languagesLearnMoreURL", |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 web_ui()->RegisterMessageCallback( | 852 web_ui()->RegisterMessageCallback( |
852 "restartBrowser", | 853 "restartBrowser", |
853 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser, | 854 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser, |
854 base::Unretained(this))); | 855 base::Unretained(this))); |
855 web_ui()->RegisterMessageCallback( | 856 web_ui()->RegisterMessageCallback( |
856 "showNetworkProxySettings", | 857 "showNetworkProxySettings", |
857 base::Bind(&BrowserOptionsHandler::ShowNetworkProxySettings, | 858 base::Bind(&BrowserOptionsHandler::ShowNetworkProxySettings, |
858 base::Unretained(this))); | 859 base::Unretained(this))); |
859 #endif // defined(OS_CHROMEOS) | 860 #endif // defined(OS_CHROMEOS) |
860 | 861 |
861 #if defined(ENABLE_SERVICE_DISCOVERY) | 862 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
862 if (cloud_print_mdns_ui_enabled_) { | 863 if (cloud_print_mdns_ui_enabled_) { |
863 web_ui()->RegisterMessageCallback( | 864 web_ui()->RegisterMessageCallback( |
864 "showCloudPrintDevicesPage", | 865 "showCloudPrintDevicesPage", |
865 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage, | 866 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage, |
866 base::Unretained(this))); | 867 base::Unretained(this))); |
867 } | 868 } |
868 #endif | 869 #endif |
869 web_ui()->RegisterMessageCallback( | 870 web_ui()->RegisterMessageCallback( |
870 "requestGoogleNowAvailable", | 871 "requestGoogleNowAvailable", |
871 base::Bind(&BrowserOptionsHandler::HandleRequestGoogleNowAvailable, | 872 base::Bind(&BrowserOptionsHandler::HandleRequestGoogleNowAvailable, |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 #endif | 1702 #endif |
1702 | 1703 |
1703 #if defined(OS_WIN) || defined(OS_MACOSX) | 1704 #if defined(OS_WIN) || defined(OS_MACOSX) |
1704 void BrowserOptionsHandler::ShowManageSSLCertificates( | 1705 void BrowserOptionsHandler::ShowManageSSLCertificates( |
1705 const base::ListValue* args) { | 1706 const base::ListValue* args) { |
1706 content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates")); | 1707 content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates")); |
1707 settings_utils::ShowManageSSLCertificates(web_ui()->GetWebContents()); | 1708 settings_utils::ShowManageSSLCertificates(web_ui()->GetWebContents()); |
1708 } | 1709 } |
1709 #endif | 1710 #endif |
1710 | 1711 |
1711 #if defined(ENABLE_SERVICE_DISCOVERY) | 1712 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
1712 | |
1713 void BrowserOptionsHandler::ShowCloudPrintDevicesPage( | 1713 void BrowserOptionsHandler::ShowCloudPrintDevicesPage( |
1714 const base::ListValue* args) { | 1714 const base::ListValue* args) { |
1715 content::RecordAction(UserMetricsAction("Options_CloudPrintDevicesPage")); | 1715 content::RecordAction(UserMetricsAction("Options_CloudPrintDevicesPage")); |
1716 // Navigate in current tab to devices page. | 1716 // Navigate in current tab to devices page. |
1717 OpenURLParams params(GURL(chrome::kChromeUIDevicesURL), Referrer(), | 1717 OpenURLParams params(GURL(chrome::kChromeUIDevicesURL), Referrer(), |
1718 WindowOpenDisposition::CURRENT_TAB, | 1718 WindowOpenDisposition::CURRENT_TAB, |
1719 ui::PAGE_TRANSITION_LINK, false); | 1719 ui::PAGE_TRANSITION_LINK, false); |
1720 web_ui()->GetWebContents()->OpenURL(params); | 1720 web_ui()->GetWebContents()->OpenURL(params); |
1721 } | 1721 } |
1722 | |
1723 #endif | 1722 #endif |
1724 | 1723 |
1725 void BrowserOptionsHandler::SetHotwordAudioHistorySectionVisible( | 1724 void BrowserOptionsHandler::SetHotwordAudioHistorySectionVisible( |
1726 const base::string16& audio_history_state, | 1725 const base::string16& audio_history_state, |
1727 bool success, bool logging_enabled) { | 1726 bool success, bool logging_enabled) { |
1728 bool visible = logging_enabled && success; | 1727 bool visible = logging_enabled && success; |
1729 web_ui()->CallJavascriptFunctionUnsafe( | 1728 web_ui()->CallJavascriptFunctionUnsafe( |
1730 "BrowserOptions.setAudioHistorySectionVisible", | 1729 "BrowserOptions.setAudioHistorySectionVisible", |
1731 base::FundamentalValue(visible), base::StringValue(audio_history_state)); | 1730 base::FundamentalValue(visible), base::StringValue(audio_history_state)); |
1732 } | 1731 } |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 | 2233 |
2235 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2234 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
2236 #if defined(OS_CHROMEOS) | 2235 #if defined(OS_CHROMEOS) |
2237 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2236 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
2238 #else | 2237 #else |
2239 return true; | 2238 return true; |
2240 #endif | 2239 #endif |
2241 } | 2240 } |
2242 | 2241 |
2243 } // namespace options | 2242 } // namespace options |
OLD | NEW |