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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/shell_window.h" | 10 #include "apps/shell_window.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" | 38 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" |
39 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" | 39 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" |
40 #include "chrome/browser/profiles/profile.h" | 40 #include "chrome/browser/profiles/profile.h" |
41 #include "chrome/browser/profiles/profile_info_cache.h" | 41 #include "chrome/browser/profiles/profile_info_cache.h" |
42 #include "chrome/browser/profiles/profile_info_util.h" | 42 #include "chrome/browser/profiles/profile_info_util.h" |
43 #include "chrome/browser/profiles/profile_manager.h" | 43 #include "chrome/browser/profiles/profile_manager.h" |
44 #include "chrome/browser/profiles/profile_metrics.h" | 44 #include "chrome/browser/profiles/profile_metrics.h" |
45 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 45 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
46 #include "chrome/browser/profiles/profile_window.h" | 46 #include "chrome/browser/profiles/profile_window.h" |
47 #include "chrome/browser/profiles/profiles_state.h" | 47 #include "chrome/browser/profiles/profiles_state.h" |
48 #include "chrome/browser/safe_browsing/download_feedback_service.h" | |
48 #include "chrome/browser/search/hotword_service.h" | 49 #include "chrome/browser/search/hotword_service.h" |
49 #include "chrome/browser/search/hotword_service_factory.h" | 50 #include "chrome/browser/search/hotword_service_factory.h" |
50 #include "chrome/browser/search/search.h" | 51 #include "chrome/browser/search/search.h" |
51 #include "chrome/browser/search_engines/template_url.h" | 52 #include "chrome/browser/search_engines/template_url.h" |
52 #include "chrome/browser/search_engines/template_url_service.h" | 53 #include "chrome/browser/search_engines/template_url_service.h" |
53 #include "chrome/browser/search_engines/template_url_service_factory.h" | 54 #include "chrome/browser/search_engines/template_url_service_factory.h" |
54 #include "chrome/browser/signin/signin_manager.h" | 55 #include "chrome/browser/signin/signin_manager.h" |
55 #include "chrome/browser/signin/signin_manager_factory.h" | 56 #include "chrome/browser/signin/signin_manager_factory.h" |
56 #include "chrome/browser/sync/profile_sync_service.h" | 57 #include "chrome/browser/sync/profile_sync_service.h" |
57 #include "chrome/browser/sync/profile_sync_service_factory.h" | 58 #include "chrome/browser/sync/profile_sync_service_factory.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 #if defined(ENABLE_MDNS) | 127 #if defined(ENABLE_MDNS) |
127 #include "chrome/browser/local_discovery/privet_notifications.h" | 128 #include "chrome/browser/local_discovery/privet_notifications.h" |
128 #endif | 129 #endif |
129 | 130 |
130 using base::UserMetricsAction; | 131 using base::UserMetricsAction; |
131 using content::BrowserContext; | 132 using content::BrowserContext; |
132 using content::BrowserThread; | 133 using content::BrowserThread; |
133 using content::DownloadManager; | 134 using content::DownloadManager; |
134 using content::OpenURLParams; | 135 using content::OpenURLParams; |
135 using content::Referrer; | 136 using content::Referrer; |
137 using safe_browsing::DownloadFeedbackService; | |
136 | 138 |
137 namespace options { | 139 namespace options { |
138 | 140 |
139 namespace { | 141 namespace { |
140 | 142 |
141 bool ShouldShowMultiProfilesUserList(chrome::HostDesktopType desktop_type) { | 143 bool ShouldShowMultiProfilesUserList(chrome::HostDesktopType desktop_type) { |
142 #if defined(OS_CHROMEOS) | 144 #if defined(OS_CHROMEOS) |
143 // On Chrome OS we use different UI for multi-profiles. | 145 // On Chrome OS we use different UI for multi-profiles. |
144 return false; | 146 return false; |
145 #else | 147 #else |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 { "proxiesLabelExtension", IDS_OPTIONS_EXTENSION_PROXIES_LABEL }, | 294 { "proxiesLabelExtension", IDS_OPTIONS_EXTENSION_PROXIES_LABEL }, |
293 { "proxiesLabelSystem", IDS_OPTIONS_SYSTEM_PROXIES_LABEL, | 295 { "proxiesLabelSystem", IDS_OPTIONS_SYSTEM_PROXIES_LABEL, |
294 IDS_PRODUCT_NAME }, | 296 IDS_PRODUCT_NAME }, |
295 { "resetProfileSettings", IDS_RESET_PROFILE_SETTINGS_BUTTON }, | 297 { "resetProfileSettings", IDS_RESET_PROFILE_SETTINGS_BUTTON }, |
296 { "resetProfileSettingsDescription", | 298 { "resetProfileSettingsDescription", |
297 IDS_RESET_PROFILE_SETTINGS_DESCRIPTION }, | 299 IDS_RESET_PROFILE_SETTINGS_DESCRIPTION }, |
298 { "resetProfileSettingsSectionTitle", | 300 { "resetProfileSettingsSectionTitle", |
299 IDS_RESET_PROFILE_SETTINGS_SECTION_TITLE }, | 301 IDS_RESET_PROFILE_SETTINGS_SECTION_TITLE }, |
300 { "safeBrowsingEnableProtection", | 302 { "safeBrowsingEnableProtection", |
301 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, | 303 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, |
304 { "safeBrowsingEnableDownloadFeedback", | |
305 IDS_OPTIONS_SAFEBROWSING_ENABLEDOWNLOADFEEDBACK }, | |
302 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME }, | 306 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME }, |
303 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME }, | 307 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME }, |
304 { "sectionTitleUsers", IDS_PROFILES_OPTIONS_GROUP_NAME }, | 308 { "sectionTitleUsers", IDS_PROFILES_OPTIONS_GROUP_NAME }, |
305 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME }, | 309 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME }, |
306 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME }, | 310 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME }, |
307 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME }, | 311 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME }, |
308 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT }, | 312 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT }, |
309 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE }, | 313 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE }, |
310 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE }, | 314 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE }, |
311 { "spellingPref", IDS_OPTIONS_SPELLING_PREF }, | 315 { "spellingPref", IDS_OPTIONS_SPELLING_PREF }, |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
572 !local_discovery::PrivetNotificationService::IsEnabled()); | 576 !local_discovery::PrivetNotificationService::IsEnabled()); |
573 #endif | 577 #endif |
574 | 578 |
575 values->SetBoolean("cloudPrintShowMDnsOptions", | 579 values->SetBoolean("cloudPrintShowMDnsOptions", |
576 cloud_print_mdns_ui_enabled_); | 580 cloud_print_mdns_ui_enabled_); |
577 | 581 |
578 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL); | 582 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL); |
579 | 583 |
580 values->SetString("languagesLearnMoreURL", | 584 values->SetString("languagesLearnMoreURL", |
581 chrome::kLanguageSettingsLearnMoreUrl); | 585 chrome::kLanguageSettingsLearnMoreUrl); |
586 | |
587 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | |
588 DownloadFeedbackService::DownloadReportingStatus reporting_pref = | |
589 static_cast<DownloadFeedbackService::DownloadReportingStatus>( | |
590 pref_service->GetInteger( | |
591 prefs::kSafeBrowsingDownloadReportingEnabled)); | |
592 values->SetBoolean( | |
593 "sbDownloadFeedbackEnabled", | |
594 reporting_pref == DownloadFeedbackService::kDownloadReportingEnabled); | |
582 } | 595 } |
583 | 596 |
584 #if defined(ENABLE_FULL_PRINTING) | 597 #if defined(ENABLE_FULL_PRINTING) |
585 void BrowserOptionsHandler::RegisterCloudPrintValues( | 598 void BrowserOptionsHandler::RegisterCloudPrintValues( |
586 base::DictionaryValue* values) { | 599 base::DictionaryValue* values) { |
587 values->SetString("cloudPrintOptionLabel", | 600 values->SetString("cloudPrintOptionLabel", |
588 l10n_util::GetStringFUTF16( | 601 l10n_util::GetStringFUTF16( |
589 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, | 602 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, |
590 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); | 603 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); |
591 | 604 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
707 web_ui()->RegisterMessageCallback( | 720 web_ui()->RegisterMessageCallback( |
708 "showCloudPrintDevicesPage", | 721 "showCloudPrintDevicesPage", |
709 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage, | 722 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage, |
710 base::Unretained(this))); | 723 base::Unretained(this))); |
711 } | 724 } |
712 #endif | 725 #endif |
713 web_ui()->RegisterMessageCallback( | 726 web_ui()->RegisterMessageCallback( |
714 "requestHotwordAvailable", | 727 "requestHotwordAvailable", |
715 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable, | 728 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable, |
716 base::Unretained(this))); | 729 base::Unretained(this))); |
730 web_ui()->RegisterMessageCallback( | |
731 "downloadFeedbackStatusChanged", | |
732 base::Bind(&BrowserOptionsHandler::DownloadFeedbackStatusChanged, | |
Dan Beam
2014/02/12 22:53:04
nit: HandleDownloadFeedbackStatusChanged
felt
2014/02/13 05:17:58
Done.
| |
733 base::Unretained(this))); | |
717 } | 734 } |
718 | 735 |
719 void BrowserOptionsHandler::Uninitialize() { | 736 void BrowserOptionsHandler::Uninitialize() { |
720 registrar_.RemoveAll(); | 737 registrar_.RemoveAll(); |
721 } | 738 } |
722 | 739 |
723 void BrowserOptionsHandler::OnStateChanged() { | 740 void BrowserOptionsHandler::OnStateChanged() { |
724 UpdateSyncState(); | 741 UpdateSyncState(); |
725 } | 742 } |
726 | 743 |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1525 void BrowserOptionsHandler::HandleRequestHotwordAvailable( | 1542 void BrowserOptionsHandler::HandleRequestHotwordAvailable( |
1526 const base::ListValue* args) { | 1543 const base::ListValue* args) { |
1527 Profile* profile = Profile::FromWebUI(web_ui()); | 1544 Profile* profile = Profile::FromWebUI(web_ui()); |
1528 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger"); | 1545 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger"); |
1529 if (group != "" && group != "Disabled" && | 1546 if (group != "" && group != "Disabled" && |
1530 HotwordServiceFactory::IsServiceAvailable(profile)) { | 1547 HotwordServiceFactory::IsServiceAvailable(profile)) { |
1531 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection"); | 1548 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection"); |
1532 } | 1549 } |
1533 } | 1550 } |
1534 | 1551 |
1552 void BrowserOptionsHandler::DownloadFeedbackStatusChanged( | |
1553 const base::ListValue* args) { | |
1554 bool enabled = false; | |
1555 args->GetBoolean(0, &enabled); | |
Dan Beam
2014/02/12 22:53:04
nit:
bool success = args->GetBoolean(0, &enable
felt
2014/02/13 05:17:58
Done.
| |
1556 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | |
1557 if (enabled) { | |
1558 pref_service->SetInteger( | |
1559 prefs::kSafeBrowsingDownloadReportingEnabled, | |
1560 DownloadFeedbackService::kDownloadReportingEnabled); | |
1561 } else { | |
1562 pref_service->SetInteger( | |
1563 prefs::kSafeBrowsingDownloadReportingEnabled, | |
1564 DownloadFeedbackService::kDownloadReportingDisabled); | |
1565 } | |
Dan Beam
2014/02/12 22:53:04
nit:
pref_service->SetInteger(
prefs::kSa
felt
2014/02/13 05:17:58
Done.
| |
1566 } | |
1567 | |
1535 #if defined(OS_CHROMEOS) | 1568 #if defined(OS_CHROMEOS) |
1536 void BrowserOptionsHandler::HandleOpenWallpaperManager( | 1569 void BrowserOptionsHandler::HandleOpenWallpaperManager( |
1537 const base::ListValue* args) { | 1570 const base::ListValue* args) { |
1538 wallpaper_manager_util::OpenWallpaperManager(); | 1571 wallpaper_manager_util::OpenWallpaperManager(); |
1539 } | 1572 } |
1540 | 1573 |
1541 void BrowserOptionsHandler::VirtualKeyboardChangeCallback( | 1574 void BrowserOptionsHandler::VirtualKeyboardChangeCallback( |
1542 const base::ListValue* args) { | 1575 const base::ListValue* args) { |
1543 bool enabled = false; | 1576 bool enabled = false; |
1544 args->GetBoolean(0, &enabled); | 1577 args->GetBoolean(0, &enabled); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1705 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { | 1738 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { |
1706 bool has_users = !Profile::FromWebUI(web_ui())-> | 1739 bool has_users = !Profile::FromWebUI(web_ui())-> |
1707 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty(); | 1740 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty(); |
1708 base::FundamentalValue has_users_value(has_users); | 1741 base::FundamentalValue has_users_value(has_users); |
1709 web_ui()->CallJavascriptFunction( | 1742 web_ui()->CallJavascriptFunction( |
1710 "BrowserOptions.updateManagesSupervisedUsers", | 1743 "BrowserOptions.updateManagesSupervisedUsers", |
1711 has_users_value); | 1744 has_users_value); |
1712 } | 1745 } |
1713 | 1746 |
1714 } // namespace options | 1747 } // namespace options |
OLD | NEW |