summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authorsidchat@chromium.org <sidchat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 19:55:15 +0000
committersidchat@chromium.org <sidchat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 19:55:15 +0000
commit5ffc108781d1d439bb7800a38975c1d022044bee (patch)
treea8d0f00d494ab6ac3ad1e8e0b7dc511eef2d2992 /chrome/browser/extensions
parent5aae4c66b3b7343677c64c4291982822459f2cba (diff)
downloadchromium_src-5ffc108781d1d439bb7800a38975c1d022044bee.zip
chromium_src-5ffc108781d1d439bb7800a38975c1d022044bee.tar.gz
chromium_src-5ffc108781d1d439bb7800a38975c1d022044bee.tar.bz2
Change detectLanguage() API to now return the top three languages as well their percentages. Added suitable unit testing to test that top three languages are returned as expected.
BUG=20666 TEST=none Review URL: http://codereview.chromium.org/223010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extension_browsertests_misc.cc2
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc5
2 files changed, 4 insertions, 3 deletions
diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc
index bab50d1..c03f553 100644
--- a/chrome/browser/extensions/extension_browsertests_misc.cc
+++ b/chrome/browser/extensions/extension_browsertests_misc.cc
@@ -83,7 +83,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, Toolstrip) {
// actually call the language detection API through the existing extension,
// and verify that the language returned is indeed French.
FilePath language_url = extension_test_data_dir.AppendASCII(
- "french_sentence.html");
+ "three_languages.html");
ui_test_utils::NavigateToURL(
browser(),
GURL(language_url.ToWStringHack()));
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index 89cb48c..0e551df8 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -855,8 +855,9 @@ void DetectTabLanguageFunction::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(type == NotificationType::TAB_LANGUAGE_DETERMINED);
- std::string language(*Details<std::string>(details).ptr());
- result_.reset(Value::CreateStringValue(language.c_str()));
+ ListValue* list = static_cast<ListValue*>(Details<ListValue>(details).
+ ptr()->DeepCopy());
+ result_.reset(list);
SendResponse(true);
Release(); // balanced in Run()
}