summaryrefslogtreecommitdiffstats
path: root/chrome/browser/translate/translate_manager.h
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-03 23:01:10 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-03 23:01:10 +0000
commit50501181e41c307f353432ba8aa176a366999611 (patch)
tree01f7d2ce058cb87b28c50f36c301d6017916b7a2 /chrome/browser/translate/translate_manager.h
parent32e851ac4653283d8602cdf20ac1c689416389c8 (diff)
downloadchromium_src-50501181e41c307f353432ba8aa176a366999611.zip
chromium_src-50501181e41c307f353432ba8aa176a366999611.tar.gz
chromium_src-50501181e41c307f353432ba8aa176a366999611.tar.bz2
The browser would crash when pressing the translate button in the infobar when the locale is Norvegian,
Filipino or any Chrome languages that the translation server does not support. The crash would happen in the translate infobar, the source index would be -1 and would cause us to crash accessing that index in a vector. This CL fixes that by cleaning up the list of supported languages, so they match Chrome's locales. Also it makes sure we don't create an infobar if for any reason one of the language (source or target) is not supported. BUG=37218 TEST=For each language Chrome can be run into, select that language and open www.google.com. Check that the info-bar is shown for languages supported by the Google translate server (see the list at http://translate.google.com/) and for the supported language translating works. Review URL: http://codereview.chromium.org/661434 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40558 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/translate/translate_manager.h')
-rw-r--r--chrome/browser/translate/translate_manager.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h
index f14dfdd..7ac1eb8 100644
--- a/chrome/browser/translate/translate_manager.h
+++ b/chrome/browser/translate/translate_manager.h
@@ -11,6 +11,7 @@
#include "base/singleton.h"
#include "base/task.h"
+#include "chrome/browser/translate/translate_infobars_delegates.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
@@ -58,6 +59,13 @@ class TranslateManager : public NotificationObserver {
// preference in |prefs|.
void InitAcceptLanguages(PrefService* prefs);
+ // Convenience method that adds a translate infobar to |tab|.
+ void AddTranslateInfoBar(TabContents* tab,
+ TranslateInfoBarDelegate::TranslateState state,
+ const GURL& url,
+ const std::string& original_language,
+ const std::string& target_language);
+
NotificationRegistrar notification_registrar_;
// A map that associates a profile with its parsed "accept languages".