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

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: Review Comments Created 6 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
« no previous file with comments | « chrome/browser/resources/options/browser_options.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 const base::ListValue* args) { 1616 const base::ListValue* args) {
1617 Profile* profile = Profile::FromWebUI(web_ui()); 1617 Profile* profile = Profile::FromWebUI(web_ui());
1618 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger"); 1618 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger");
1619 base::FundamentalValue enabled( 1619 base::FundamentalValue enabled(
1620 profile->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled)); 1620 profile->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled));
1621 if (group != "" && group != "Disabled" && 1621 if (group != "" && group != "Disabled" &&
1622 HotwordServiceFactory::IsHotwordAllowed(profile)) { 1622 HotwordServiceFactory::IsHotwordAllowed(profile)) {
1623 // Update the current error value. 1623 // Update the current error value.
1624 HotwordServiceFactory::IsServiceAvailable(profile); 1624 HotwordServiceFactory::IsServiceAvailable(profile);
1625 int error = HotwordServiceFactory::GetCurrentError(profile); 1625 int error = HotwordServiceFactory::GetCurrentError(profile);
1626 if (!error) { 1626 if (CommandLine::ForCurrentProcess()->HasSwitch(
1627 switches::kEnableExperimentalHotwording)) {
1628 if (HotwordServiceFactory::IsHotwordHardwareAvailable()) {
1629 web_ui()->CallJavascriptFunction(
1630 "BrowserOptions.showHotwordAlwaysOnSection");
1631 } else {
1632 web_ui()->CallJavascriptFunction(
1633 "BrowserOptions.showHotwordNoDSPSection");
1634 }
1635 } else if (!error) {
1627 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection", 1636 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection",
1628 enabled); 1637 enabled);
1629 } else { 1638 } else {
1630 base::string16 hotword_help_url = 1639 base::string16 hotword_help_url =
1631 base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL); 1640 base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL);
1632 base::StringValue error_message(l10n_util::GetStringUTF16(error)); 1641 base::StringValue error_message(l10n_util::GetStringUTF16(error));
1633 if (error == IDS_HOTWORD_GENERIC_ERROR_MESSAGE) { 1642 if (error == IDS_HOTWORD_GENERIC_ERROR_MESSAGE) {
1634 error_message = base::StringValue( 1643 error_message = base::StringValue(
1635 l10n_util::GetStringFUTF16(error, hotword_help_url)); 1644 l10n_util::GetStringFUTF16(error, hotword_help_url));
1636 } 1645 }
1637 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection", 1646 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection",
1638 enabled, error_message); 1647 enabled, error_message);
1639 } 1648 }
1640 if (CommandLine::ForCurrentProcess()->HasSwitch(
1641 switches::kEnableExperimentalHotwording)) {
1642 web_ui()->CallJavascriptFunction(
1643 "BrowserOptions.showHotwordAlwaysOnSection");
1644 }
1645 } 1649 }
1646 } 1650 }
1647 1651
1648 void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp( 1652 void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp(
1649 const base::ListValue* args) { 1653 const base::ListValue* args) {
1650 Profile* profile = Profile::FromWebUI(web_ui()); 1654 Profile* profile = Profile::FromWebUI(web_ui());
1651 1655
1652 bool retrain = false; 1656 bool retrain = false;
1653 bool success = args->GetBoolean(0, &retrain); 1657 bool success = args->GetBoolean(0, &retrain);
1654 DCHECK(success); 1658 DCHECK(success);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 1980
1977 void BrowserOptionsHandler::SetMetricsReportingCheckbox(bool checked, 1981 void BrowserOptionsHandler::SetMetricsReportingCheckbox(bool checked,
1978 bool disabled) { 1982 bool disabled) {
1979 web_ui()->CallJavascriptFunction( 1983 web_ui()->CallJavascriptFunction(
1980 "BrowserOptions.setMetricsReportingCheckboxState", 1984 "BrowserOptions.setMetricsReportingCheckboxState",
1981 base::FundamentalValue(checked), 1985 base::FundamentalValue(checked),
1982 base::FundamentalValue(disabled)); 1986 base::FundamentalValue(disabled));
1983 } 1987 }
1984 1988
1985 } // namespace options 1989 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/browser_options.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698