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

Unified Diff: chrome/browser/dom_ui/tips_handler.cc

Issue 199073: Ensure that tips change when the Chrome language changes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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/browser/web_resource/web_resource_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/tips_handler.cc
===================================================================
--- chrome/browser/dom_ui/tips_handler.cc (revision 25805)
+++ chrome/browser/dom_ui/tips_handler.cc (working copy)
@@ -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 @@
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) &&
« no previous file with comments | « no previous file | chrome/browser/web_resource/web_resource_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698