diff options
author | rlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-19 17:59:29 +0000 |
---|---|---|
committer | rlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-19 17:59:29 +0000 |
commit | d11ebebbd91b153ef77a1f98ca991caec86b530f (patch) | |
tree | d420a48a35fed13c6aa29f115ade6bd978ebd73a | |
parent | 0bb0c5a32a4348037c515372c5aa4b4bd5c0893f (diff) | |
download | chromium_src-d11ebebbd91b153ef77a1f98ca991caec86b530f.zip chromium_src-d11ebebbd91b153ef77a1f98ca991caec86b530f.tar.gz chromium_src-d11ebebbd91b153ef77a1f98ca991caec86b530f.tar.bz2 |
Revert 277718 "[Hotword] Remove non-English languages due to fea..."
Reverting because we do want the feature in M37.
> [Hotword] Remove non-English languages due to feature getting bumped to next milestone.
>
> BUG=385301
>
> Review URL: https://codereview.chromium.org/337243003
BUG=345806
TBR=rlp@chromium.org
Review URL: https://codereview.chromium.org/340413003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278420 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 19 insertions, 7 deletions
diff --git a/chrome/browser/resources/hotword_helper/manager.js b/chrome/browser/resources/hotword_helper/manager.js index 5b4249a..298835d 100644 --- a/chrome/browser/resources/hotword_helper/manager.js +++ b/chrome/browser/resources/hotword_helper/manager.js @@ -175,7 +175,11 @@ OptInManager.prototype.isEligibleUrl = function(url) { 'https://encrypted.google.' ]; var tlds = [ - 'com' + 'com', + 'co.uk', + 'de', + 'fr', + 'ru' ]; // Check URLs which do not have locale-based TLDs first. diff --git a/chrome/browser/resources/hotword_helper/manifest.json b/chrome/browser/resources/hotword_helper/manifest.json index 5d64c6d..eb21576 100644 --- a/chrome/browser/resources/hotword_helper/manifest.json +++ b/chrome/browser/resources/hotword_helper/manifest.json @@ -13,6 +13,10 @@ "permissions": [ "*://*.google.com/*", + "*://*.google.ru/*", + "*://*.google.co.uk/*", + "*://*.google.fr/*", + "*://*.google.de/*", "chrome://newtab/", "hotwordPrivate", "tabs" @@ -21,6 +25,10 @@ "externally_connectable": { "matches": [ "*://*.google.com/*", + "*://*.google.ru/*", + "*://*.google.co.uk/*", + "*://*.google.fr/*", + "*://*.google.de/*", "chrome://newtab/" ] }, diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc index 8d1ccdf..7e67c64 100644 --- a/chrome/browser/search/hotword_service.cc +++ b/chrome/browser/search/hotword_service.cc @@ -45,7 +45,9 @@ namespace { // Allowed languages for hotwording. static const char* kSupportedLocales[] = { "en", - "en_us", + "de", + "fr", + "ru" }; // Enum describing the state of the hotword preference. @@ -166,7 +168,7 @@ bool HotwordService::DoesHotwordSupportLanguage(Profile* profile) { StringToLowerASCII(&normalized_locale); for (size_t i = 0; i < arraysize(kSupportedLocales); i++) { - if (kSupportedLocales[i] == normalized_locale) + if (normalized_locale.compare(0, 2, kSupportedLocales[i]) == 0) return true; } return false; diff --git a/chrome/browser/search/hotword_service_unittest.cc b/chrome/browser/search/hotword_service_unittest.cc index a603361..9170741 100644 --- a/chrome/browser/search/hotword_service_unittest.cc +++ b/chrome/browser/search/hotword_service_unittest.cc @@ -101,12 +101,10 @@ TEST_F(HotwordServiceTest, IsHotwordAllowedLocale) { EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile.get())); SetApplicationLocale(static_cast<Profile*>(profile.get()), "en_us"); EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile.get())); - SetApplicationLocale(static_cast<Profile*>(profile.get()), "en_gb"); - EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(profile.get())); SetApplicationLocale(static_cast<Profile*>(profile.get()), "de_DE"); - EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(profile.get())); + EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile.get())); SetApplicationLocale(static_cast<Profile*>(profile.get()), "fr_fr"); - EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(profile.get())); + EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile.get())); // Test that incognito even with a valid locale and valid field trial // still returns false. |