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

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 677843002: Updates the hotword settings page according to newest mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 { "fontSizeLabelLarge", IDS_OPTIONS_FONT_SIZE_LABEL_LARGE }, 261 { "fontSizeLabelLarge", IDS_OPTIONS_FONT_SIZE_LABEL_LARGE },
262 { "fontSizeLabelMedium", IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM }, 262 { "fontSizeLabelMedium", IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM },
263 { "fontSizeLabelSmall", IDS_OPTIONS_FONT_SIZE_LABEL_SMALL }, 263 { "fontSizeLabelSmall", IDS_OPTIONS_FONT_SIZE_LABEL_SMALL },
264 { "fontSizeLabelVeryLarge", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE }, 264 { "fontSizeLabelVeryLarge", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE },
265 { "fontSizeLabelVerySmall", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL }, 265 { "fontSizeLabelVerySmall", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL },
266 { "hideAdvancedSettings", IDS_SETTINGS_HIDE_ADVANCED_SETTINGS }, 266 { "hideAdvancedSettings", IDS_SETTINGS_HIDE_ADVANCED_SETTINGS },
267 { "homePageNtp", IDS_OPTIONS_HOMEPAGE_NTP }, 267 { "homePageNtp", IDS_OPTIONS_HOMEPAGE_NTP },
268 { "homePageShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON }, 268 { "homePageShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON },
269 { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB }, 269 { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB },
270 { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL }, 270 { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL },
271 { "hotwordAlwaysOnSearchEnable", IDS_HOTWORD_ALWAYS_ON_SEARCH_PREF_CHKBOX },
272 { "hotwordAudioHistoryEnable", IDS_HOTWORD_AUDIO_HISTORY_PREF_CHKBOX }, 271 { "hotwordAudioHistoryEnable", IDS_HOTWORD_AUDIO_HISTORY_PREF_CHKBOX },
273 { "hotwordSearchEnable", IDS_HOTWORD_SEARCH_PREF_CHKBOX }, 272 { "hotwordSearchEnable", IDS_HOTWORD_SEARCH_PREF_CHKBOX },
274 { "hotwordConfirmEnable", IDS_HOTWORD_CONFIRM_BUBBLE_ENABLE }, 273 { "hotwordConfirmEnable", IDS_HOTWORD_CONFIRM_BUBBLE_ENABLE },
275 { "hotwordConfirmDisable", IDS_HOTWORD_CONFIRM_BUBBLE_DISABLE }, 274 { "hotwordConfirmDisable", IDS_HOTWORD_CONFIRM_BUBBLE_DISABLE },
276 { "hotwordConfirmMessage", IDS_HOTWORD_SEARCH_PREF_DESCRIPTION }, 275 { "hotwordConfirmMessage", IDS_HOTWORD_SEARCH_PREF_DESCRIPTION },
276 { "hotwordNoDSPDesc", IDS_HOTWORD_SEARCH_NO_DSP_DESCRIPTION },
277 { "hotwordAlwaysOnDesc", IDS_HOTWORD_SEARCH_ALWAYS_ON_DESCRIPTION },
277 { "hotwordAudioLoggingEnable", IDS_HOTWORD_AUDIO_LOGGING_ENABLE }, 278 { "hotwordAudioLoggingEnable", IDS_HOTWORD_AUDIO_LOGGING_ENABLE },
278 { "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON }, 279 { "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON },
279 { "improveBrowsingExperience", IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE }, 280 { "improveBrowsingExperience", IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE },
280 { "languageAndSpellCheckSettingsButton", 281 { "languageAndSpellCheckSettingsButton",
281 IDS_OPTIONS_SETTINGS_LANGUAGE_AND_INPUT_SETTINGS }, 282 IDS_OPTIONS_SETTINGS_LANGUAGE_AND_INPUT_SETTINGS },
282 { "linkDoctorPref", IDS_OPTIONS_LINKDOCTOR_PREF }, 283 { "linkDoctorPref", IDS_OPTIONS_LINKDOCTOR_PREF },
283 { "manageAutofillSettings", IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS_LINK }, 284 { "manageAutofillSettings", IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS_LINK },
284 { "manageLanguages", IDS_OPTIONS_TRANSLATE_MANAGE_LANGUAGES }, 285 { "manageLanguages", IDS_OPTIONS_TRANSLATE_MANAGE_LANGUAGES },
285 { "managePasswords", IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS_LINK }, 286 { "managePasswords", IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS_LINK },
286 { "networkPredictionEnabledDescription", 287 { "networkPredictionEnabledDescription",
(...skipping 28 matching lines...) Expand all
315 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, 316 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION },
316 { "safeBrowsingEnableExtendedReporting", 317 { "safeBrowsingEnableExtendedReporting",
317 IDS_OPTIONS_SAFEBROWSING_ENABLE_EXTENDED_REPORTING }, 318 IDS_OPTIONS_SAFEBROWSING_ENABLE_EXTENDED_REPORTING },
318 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME }, 319 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME },
319 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME }, 320 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME },
320 { "sectionTitleUsers", IDS_PROFILES_OPTIONS_GROUP_NAME }, 321 { "sectionTitleUsers", IDS_PROFILES_OPTIONS_GROUP_NAME },
321 { "sectionTitleProxy", IDS_OPTIONS_PROXY_GROUP_NAME }, 322 { "sectionTitleProxy", IDS_OPTIONS_PROXY_GROUP_NAME },
322 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME }, 323 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME },
323 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME }, 324 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME },
324 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME }, 325 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME },
325 { "sectionTitleVoice", IDS_OPTIONS_VOICE_GROUP_NAME },
326 { "settingsTitle", IDS_SETTINGS_TITLE }, 326 { "settingsTitle", IDS_SETTINGS_TITLE },
327 { "showAdvancedSettings", IDS_SETTINGS_SHOW_ADVANCED_SETTINGS }, 327 { "showAdvancedSettings", IDS_SETTINGS_SHOW_ADVANCED_SETTINGS },
328 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT }, 328 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT },
329 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE }, 329 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE },
330 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE }, 330 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE },
331 { "spellingPref", IDS_OPTIONS_SPELLING_PREF }, 331 { "spellingPref", IDS_OPTIONS_SPELLING_PREF },
332 { "startupRestoreLastSession", IDS_OPTIONS_STARTUP_RESTORE_LAST_SESSION }, 332 { "startupRestoreLastSession", IDS_OPTIONS_STARTUP_RESTORE_LAST_SESSION },
333 { "startupSetPages", IDS_OPTIONS_STARTUP_SET_PAGES }, 333 { "startupSetPages", IDS_OPTIONS_STARTUP_SET_PAGES },
334 { "startupShowNewTab", IDS_OPTIONS_STARTUP_SHOW_NEWTAB }, 334 { "startupShowNewTab", IDS_OPTIONS_STARTUP_SHOW_NEWTAB },
335 { "startupShowPages", IDS_OPTIONS_STARTUP_SHOW_PAGES }, 335 { "startupShowPages", IDS_OPTIONS_STARTUP_SHOW_PAGES },
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 const base::ListValue* args) { 1614 const base::ListValue* args) {
1615 Profile* profile = Profile::FromWebUI(web_ui()); 1615 Profile* profile = Profile::FromWebUI(web_ui());
1616 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger"); 1616 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger");
1617 base::FundamentalValue enabled( 1617 base::FundamentalValue enabled(
1618 profile->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled)); 1618 profile->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled));
1619 if (group != "" && group != "Disabled" && 1619 if (group != "" && group != "Disabled" &&
1620 HotwordServiceFactory::IsHotwordAllowed(profile)) { 1620 HotwordServiceFactory::IsHotwordAllowed(profile)) {
1621 // Update the current error value. 1621 // Update the current error value.
1622 HotwordServiceFactory::IsServiceAvailable(profile); 1622 HotwordServiceFactory::IsServiceAvailable(profile);
1623 int error = HotwordServiceFactory::GetCurrentError(profile); 1623 int error = HotwordServiceFactory::GetCurrentError(profile);
1624 if (!error) { 1624 if (CommandLine::ForCurrentProcess()->HasSwitch(
1625 switches::kEnableExperimentalHotwording)) {
1626 if (HotwordServiceFactory::IsHotwordHardwareAvailable()) {
1627 web_ui()->CallJavascriptFunction(
1628 "BrowserOptions.showHotwordAlwaysOnSection");
1629 } else {
1630 web_ui()->CallJavascriptFunction(
1631 "BrowserOptions.showHotwordNoDSPSection");
1632 }
1633 } else if (!error) {
1625 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection", 1634 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection",
1626 enabled); 1635 enabled);
1627 } else { 1636 } else {
1628 base::string16 hotword_help_url = 1637 base::string16 hotword_help_url =
1629 base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL); 1638 base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL);
1630 base::StringValue error_message(l10n_util::GetStringUTF16(error)); 1639 base::StringValue error_message(l10n_util::GetStringUTF16(error));
1631 if (error == IDS_HOTWORD_GENERIC_ERROR_MESSAGE) { 1640 if (error == IDS_HOTWORD_GENERIC_ERROR_MESSAGE) {
1632 error_message = base::StringValue( 1641 error_message = base::StringValue(
1633 l10n_util::GetStringFUTF16(error, hotword_help_url)); 1642 l10n_util::GetStringFUTF16(error, hotword_help_url));
1634 } 1643 }
1635 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection", 1644 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection",
1636 enabled, error_message); 1645 enabled, error_message);
1637 } 1646 }
1638 if (CommandLine::ForCurrentProcess()->HasSwitch(
1639 switches::kEnableExperimentalHotwording)) {
1640 web_ui()->CallJavascriptFunction(
1641 "BrowserOptions.showHotwordAlwaysOnSection");
1642 }
1643 } 1647 }
1644 } 1648 }
1645 1649
1646 void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp( 1650 void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp(
1647 const base::ListValue* args) { 1651 const base::ListValue* args) {
1648 Profile* profile = Profile::FromWebUI(web_ui()); 1652 Profile* profile = Profile::FromWebUI(web_ui());
1649 1653
1650 bool retrain = false; 1654 bool retrain = false;
1651 bool success = args->GetBoolean(0, &retrain); 1655 bool success = args->GetBoolean(0, &retrain);
1652 DCHECK(success); 1656 DCHECK(success);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 1978
1975 void BrowserOptionsHandler::SetMetricsReportingCheckbox(bool checked, 1979 void BrowserOptionsHandler::SetMetricsReportingCheckbox(bool checked,
1976 bool disabled) { 1980 bool disabled) {
1977 web_ui()->CallJavascriptFunction( 1981 web_ui()->CallJavascriptFunction(
1978 "BrowserOptions.setMetricsReportingCheckboxState", 1982 "BrowserOptions.setMetricsReportingCheckboxState",
1979 base::FundamentalValue(checked), 1983 base::FundamentalValue(checked),
1980 base::FundamentalValue(disabled)); 1984 base::FundamentalValue(disabled));
1981 } 1985 }
1982 1986
1983 } // namespace options 1987 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698