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

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

Issue 460113005: Adds the audio history and always on hotwording settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review Comment Modifications Created 6 years, 4 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 "apps/app_window.h" 10 #include "apps/app_window.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 { "fontSizeLabelLarge", IDS_OPTIONS_FONT_SIZE_LABEL_LARGE }, 270 { "fontSizeLabelLarge", IDS_OPTIONS_FONT_SIZE_LABEL_LARGE },
271 { "fontSizeLabelMedium", IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM }, 271 { "fontSizeLabelMedium", IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM },
272 { "fontSizeLabelSmall", IDS_OPTIONS_FONT_SIZE_LABEL_SMALL }, 272 { "fontSizeLabelSmall", IDS_OPTIONS_FONT_SIZE_LABEL_SMALL },
273 { "fontSizeLabelVeryLarge", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE }, 273 { "fontSizeLabelVeryLarge", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE },
274 { "fontSizeLabelVerySmall", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL }, 274 { "fontSizeLabelVerySmall", IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL },
275 { "hideAdvancedSettings", IDS_SETTINGS_HIDE_ADVANCED_SETTINGS }, 275 { "hideAdvancedSettings", IDS_SETTINGS_HIDE_ADVANCED_SETTINGS },
276 { "homePageNtp", IDS_OPTIONS_HOMEPAGE_NTP }, 276 { "homePageNtp", IDS_OPTIONS_HOMEPAGE_NTP },
277 { "homePageShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON }, 277 { "homePageShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON },
278 { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB }, 278 { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB },
279 { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL }, 279 { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL },
280 { "hotwordAlwaysOnSearchEnable", IDS_HOTWORD_ALWAYS_ON_SEARCH_PREF_CHKBOX },
281 { "hotwordAudioHistoryEnable", IDS_HOTWORD_AUDIO_HISTORY_PREF_CHKBOX },
280 { "hotwordSearchEnable", IDS_HOTWORD_SEARCH_PREF_CHKBOX }, 282 { "hotwordSearchEnable", IDS_HOTWORD_SEARCH_PREF_CHKBOX },
281 { "hotwordConfirmEnable", IDS_HOTWORD_CONFIRM_BUBBLE_ENABLE }, 283 { "hotwordConfirmEnable", IDS_HOTWORD_CONFIRM_BUBBLE_ENABLE },
282 { "hotwordConfirmDisable", IDS_HOTWORD_CONFIRM_BUBBLE_DISABLE }, 284 { "hotwordConfirmDisable", IDS_HOTWORD_CONFIRM_BUBBLE_DISABLE },
283 { "hotwordConfirmMessage", IDS_HOTWORD_SEARCH_PREF_DESCRIPTION }, 285 { "hotwordConfirmMessage", IDS_HOTWORD_SEARCH_PREF_DESCRIPTION },
284 { "hotwordAudioLoggingEnable", IDS_HOTWORD_AUDIO_LOGGING_ENABLE }, 286 { "hotwordAudioLoggingEnable", IDS_HOTWORD_AUDIO_LOGGING_ENABLE },
285 { "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON }, 287 { "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON },
286 { "improveBrowsingExperience", IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE }, 288 { "improveBrowsingExperience", IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE },
287 { "languageAndSpellCheckSettingsButton", 289 { "languageAndSpellCheckSettingsButton",
288 IDS_OPTIONS_SETTINGS_LANGUAGE_AND_INPUT_SETTINGS }, 290 IDS_OPTIONS_SETTINGS_LANGUAGE_AND_INPUT_SETTINGS },
289 { "linkDoctorPref", IDS_OPTIONS_LINKDOCTOR_PREF }, 291 { "linkDoctorPref", IDS_OPTIONS_LINKDOCTOR_PREF },
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); 1581 CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
1580 web_ui()->GetWebContents()->OpenURL(params); 1582 web_ui()->GetWebContents()->OpenURL(params);
1581 } 1583 }
1582 1584
1583 #endif 1585 #endif
1584 1586
1585 void BrowserOptionsHandler::HandleRequestHotwordAvailable( 1587 void BrowserOptionsHandler::HandleRequestHotwordAvailable(
1586 const base::ListValue* args) { 1588 const base::ListValue* args) {
1587 Profile* profile = Profile::FromWebUI(web_ui()); 1589 Profile* profile = Profile::FromWebUI(web_ui());
1588 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger"); 1590 std::string group = base::FieldTrialList::FindFullName("VoiceTrigger");
1591 base::FundamentalValue enabled(
1592 profile->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled));
1589 if (group != "" && group != "Disabled" && 1593 if (group != "" && group != "Disabled" &&
1590 HotwordServiceFactory::IsHotwordAllowed(profile)) { 1594 HotwordServiceFactory::IsHotwordAllowed(profile)) {
1591 // Update the current error value. 1595 // Update the current error value.
1592 HotwordServiceFactory::IsServiceAvailable(profile); 1596 HotwordServiceFactory::IsServiceAvailable(profile);
1593 int error = HotwordServiceFactory::GetCurrentError(profile); 1597 int error = HotwordServiceFactory::GetCurrentError(profile);
1594 if (!error) { 1598 if (!error) {
1595 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection"); 1599 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection",
1600 enabled);
1596 } else { 1601 } else {
1597 base::FundamentalValue enabled(
1598 profile->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled));
1599 base::string16 hotword_help_url = 1602 base::string16 hotword_help_url =
1600 base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL); 1603 base::ASCIIToUTF16(chrome::kHotwordLearnMoreURL);
1601 base::StringValue error_message(l10n_util::GetStringUTF16(error)); 1604 base::StringValue error_message(l10n_util::GetStringUTF16(error));
1602 if (error == IDS_HOTWORD_GENERIC_ERROR_MESSAGE) { 1605 if (error == IDS_HOTWORD_GENERIC_ERROR_MESSAGE) {
1603 error_message = base::StringValue( 1606 error_message = base::StringValue(
1604 l10n_util::GetStringFUTF16(error, hotword_help_url)); 1607 l10n_util::GetStringFUTF16(error, hotword_help_url));
1605 } 1608 }
1606 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection", 1609 web_ui()->CallJavascriptFunction("BrowserOptions.showHotwordSection",
1607 enabled, error_message); 1610 enabled, error_message);
1608 } 1611 }
1612 if (CommandLine::ForCurrentProcess()->HasSwitch(
1613 switches::kEnableExperimentalHotwording)) {
1614 web_ui()->CallJavascriptFunction(
1615 "BrowserOptions.showHotwordAlwaysOnSection");
1616 }
1609 } 1617 }
1610 } 1618 }
1611 1619
1612 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup( 1620 void BrowserOptionsHandler::HandleLaunchEasyUnlockSetup(
1613 const base::ListValue* args) { 1621 const base::ListValue* args) {
1614 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup(); 1622 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->LaunchSetup();
1615 } 1623 }
1616 1624
1617 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators( 1625 void BrowserOptionsHandler::HandleRefreshExtensionControlIndicators(
1618 const base::ListValue* args) { 1626 const base::ListValue* args) {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 extension = extensions::GetExtensionOverridingProxy( 1874 extension = extensions::GetExtensionOverridingProxy(
1867 Profile::FromWebUI(web_ui())); 1875 Profile::FromWebUI(web_ui()));
1868 AppendExtensionData("proxy", extension, &extension_controlled); 1876 AppendExtensionData("proxy", extension, &extension_controlled);
1869 1877
1870 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", 1878 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators",
1871 extension_controlled); 1879 extension_controlled);
1872 #endif // defined(OS_WIN) 1880 #endif // defined(OS_WIN)
1873 } 1881 }
1874 1882
1875 } // namespace options 1883 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698