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

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

Issue 992173002: Delete the old hotwording integration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hotword-remove-disable-option
Patch Set: Rebase Created 5 years, 9 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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 // checks it. 1786 // checks it.
1787 if (HotwordServiceFactory::IsHotwordAllowed(profile)) { 1787 if (HotwordServiceFactory::IsHotwordAllowed(profile)) {
1788 // Update the current error value. 1788 // Update the current error value.
1789 HotwordServiceFactory::IsServiceAvailable(profile); 1789 HotwordServiceFactory::IsServiceAvailable(profile);
1790 int error = HotwordServiceFactory::GetCurrentError(profile); 1790 int error = HotwordServiceFactory::GetCurrentError(profile);
1791 1791
1792 std::string function_name; 1792 std::string function_name;
1793 bool always_on = false; 1793 bool always_on = false;
1794 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); 1794 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile);
1795 bool authenticated = signin && signin->IsAuthenticated(); 1795 bool authenticated = signin && signin->IsAuthenticated();
1796 if (HotwordService::IsExperimentalHotwordingEnabled()) { 1796 if (HotwordServiceFactory::IsHotwordHardwareAvailable() &&
1797 if (HotwordServiceFactory::IsAlwaysOnAvailable() && 1797 authenticated) {
1798 authenticated) { 1798 function_name = "BrowserOptions.showHotwordAlwaysOnSection";
1799 function_name = "BrowserOptions.showHotwordAlwaysOnSection"; 1799 always_on = true;
1800 always_on = true; 1800 // Show the retrain link if always-on is enabled.
1801 // Show the retrain link if always-on is enabled. 1801 if (profile->GetPrefs()->GetBoolean(
1802 if (profile->GetPrefs()->GetBoolean( 1802 prefs::kHotwordAlwaysOnSearchEnabled)) {
1803 prefs::kHotwordAlwaysOnSearchEnabled)) { 1803 web_ui()->CallJavascriptFunction(
1804 web_ui()->CallJavascriptFunction( 1804 "BrowserOptions.setHotwordRetrainLinkVisible",
1805 "BrowserOptions.setHotwordRetrainLinkVisible", 1805 base::FundamentalValue(true));
1806 base::FundamentalValue(true));
1807 }
1808 } else {
1809 function_name = "BrowserOptions.showHotwordNoDspSection";
1810 } 1806 }
1811 } else { 1807 } else {
1812 function_name = "BrowserOptions.showHotwordSection"; 1808 function_name = "BrowserOptions.showHotwordNoDspSection";
1813 } 1809 }
1814 1810
1815 // Audio history should be displayed if it's enabled regardless of the 1811 // Audio history should be displayed if it's enabled regardless of the
1816 // hotword error state if the user is signed in. If the user is not signed 1812 // hotword error state if the user is signed in. If the user is not signed
1817 // in, audio history is meaningless. This is only displayed if always-on 1813 // in, audio history is meaningless. This is only displayed if always-on
1818 // hotwording is available. 1814 // hotwording is available.
1819 if (HotwordService::IsExperimentalHotwordingEnabled() && 1815 if (authenticated && always_on) {
1820 authenticated && always_on) {
1821 std::string user_display_name = signin->GetAuthenticatedUsername(); 1816 std::string user_display_name = signin->GetAuthenticatedUsername();
1822 DCHECK(!user_display_name.empty()); 1817 DCHECK(!user_display_name.empty());
1823 base::string16 audio_history_state = 1818 base::string16 audio_history_state =
1824 l10n_util::GetStringFUTF16(IDS_HOTWORD_AUDIO_HISTORY_ENABLED, 1819 l10n_util::GetStringFUTF16(IDS_HOTWORD_AUDIO_HISTORY_ENABLED,
1825 base::ASCIIToUTF16(user_display_name)); 1820 base::ASCIIToUTF16(user_display_name));
1826 HotwordService* hotword_service = 1821 HotwordService* hotword_service =
1827 HotwordServiceFactory::GetForProfile(profile); 1822 HotwordServiceFactory::GetForProfile(profile);
1828 if (hotword_service) { 1823 if (hotword_service) {
1829 hotword_service->GetAudioHistoryHandler()->GetAudioHistoryEnabled( 1824 hotword_service->GetAudioHistoryHandler()->GetAudioHistoryEnabled(
1830 base::Bind( 1825 base::Bind(
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, 2178 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns,
2184 const policy::PolicyMap& previous, 2179 const policy::PolicyMap& previous,
2185 const policy::PolicyMap& current) { 2180 const policy::PolicyMap& current) {
2186 std::set<std::string> different_keys; 2181 std::set<std::string> different_keys;
2187 current.GetDifferingKeys(previous, &different_keys); 2182 current.GetDifferingKeys(previous, &different_keys);
2188 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) 2183 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled))
2189 SetupMetricsReportingCheckbox(); 2184 SetupMetricsReportingCheckbox();
2190 } 2185 }
2191 2186
2192 } // namespace options 2187 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698