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

Unified Diff: chrome/browser/extensions/external_component_loader.cc

Issue 141013015: [Hotword] Set up hotwording to be externally loaded component extension. Only load if the field tri… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: removing changes that snuck in Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/external_component_loader.cc
diff --git a/chrome/browser/extensions/external_component_loader.cc b/chrome/browser/extensions/external_component_loader.cc
index ecfc18bd44fc9a0558e92dbc6f11fa79f8c52fa4..9d82fbabe3dbd57e2b175108a2a443185635b942 100644
--- a/chrome/browser/extensions/external_component_loader.cc
+++ b/chrome/browser/extensions/external_component_loader.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/extensions/external_component_loader.h"
#include "base/command_line.h"
+#include "base/i18n/case_conversion.h"
+#include "base/metrics/field_trial.h"
#include "base/prefs/pref_change_registrar.h"
#include "base/prefs/pref_service.h"
#include "base/values.h"
@@ -16,6 +18,7 @@
#include "chrome/common/pref_names.h"
#include "components/user_prefs/pref_registry_syncable.h"
#include "content/public/browser/browser_thread.h"
+#include "ui/base/l10n/l10n_util.h"
namespace extensions {
@@ -58,6 +61,26 @@ void ExternalComponentLoader::StartLoading() {
prefs_->SetString(appId + ".external_update_url",
extension_urls::GetWebstoreUpdateUrl().spec());
+ std::string group = base::FieldTrialList::FindFullName("VoiceTrigger");
+ if (!group.empty() && group != "Disabled") {
+ std::string locale =
+#if defined(OS_CHROMEOS)
+ // On ChromeOS locale is per-profile.
+ profile_->GetPrefs()->GetString(prefs::kApplicationLocale);
+#else
+ g_browser_process->GetApplicationLocale();
+#endif
+ // Only available for English now.
+ std::string normalized_locale = l10n_util::NormalizeLocale(locale);
+ if (!(strcmp(normalized_locale.c_str(), "en")) ||
+ !(strcmp(normalized_locale.c_str(), "en_us")) ||
+ !(strcmp(normalized_locale.c_str(), "en_US"))) {
+ std::string hotwordId = extension_misc::kHotwordExtensionId;
+ prefs_->SetString(hotwordId + ".external_update_url",
+ extension_urls::GetWebstoreUpdateUrl().spec());
+ }
+ }
+
if (CommandLine::ForCurrentProcess()->
GetSwitchValueASCII(switches::kEnableEnhancedBookmarks) != "0") {
std::string ext_id = GetEnhancedBookmarksExtensionId();
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698