summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/tips_handler.cc
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 02:04:38 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 02:04:38 +0000
commit4f2b1c4ccdc76ccf4d3f537cbd662f84c122751f (patch)
tree973461f71c7df75553eddc53b447d52fe0df4323 /chrome/browser/dom_ui/tips_handler.cc
parentbe623b0f2ec23b3032fc6c8b61d6062accf51bb7 (diff)
downloadchromium_src-4f2b1c4ccdc76ccf4d3f537cbd662f84c122751f.zip
chromium_src-4f2b1c4ccdc76ccf4d3f537cbd662f84c122751f.tar.gz
chromium_src-4f2b1c4ccdc76ccf4d3f537cbd662f84c122751f.tar.bz2
Ensure that tips change when the Chrome language changes.
BUG= http://crbug.com/21394 TEST= Change chrome language. Close and reopen browser. Tips should appear in new language, or, if not available, they should not appear. Review URL: http://codereview.chromium.org/199073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/tips_handler.cc')
-rw-r--r--chrome/browser/dom_ui/tips_handler.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/tips_handler.cc b/chrome/browser/dom_ui/tips_handler.cc
index 4690c27..be9ffba 100644
--- a/chrome/browser/dom_ui/tips_handler.cc
+++ b/chrome/browser/dom_ui/tips_handler.cc
@@ -4,6 +4,7 @@
#include "base/string_util.h"
#include "base/values.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/dom_ui/tips_handler.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/web_resource/web_resource_service.h"
@@ -35,6 +36,20 @@ void TipsHandler::HandleGetTips(const Value* content) {
int current_tip_index;
std::string current_tip;
+ // If tips are not correct for our locale, do not send. Wait for update.
+ // We need to check here because the new tab page calls for tips before
+ // the tip service starts up.
+ PrefService* current_prefs = dom_ui_->GetProfile()->GetPrefs();
+ if (current_prefs->HasPrefPath(prefs::kNTPTipsServer)) {
+ std::wstring server = current_prefs->GetString(prefs::kNTPTipsServer);
+ std::wstring locale = ASCIIToWide(
+ g_browser_process->GetApplicationLocale());
+ if (!EndsWith(server, locale, false)) {
+ dom_ui_->CallJavascriptFunction(L"tips", list_value);
+ return;
+ }
+ }
+
if (tips_cache_ != NULL && tips_cache_->GetSize() >= 0) {
if (tips_cache_->GetInteger(
WebResourceService::kCurrentTipPrefName, &current_tip_index) &&