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

Unified Diff: chrome/browser/translate/translate_manager.cc

Issue 9791078: Stop sending/saving cookies for translate server requests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: c_str Created 8 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/translate/translate_manager.cc
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 171b4cde1bc60a0be950ecb1b88f0ef741e9fb6e..4158484bc03108d3689efd95b207fd7fc810637f 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -11,6 +11,7 @@
#include "base/memory/singleton.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
+#include "base/stringprintf.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/values.h"
@@ -47,6 +48,7 @@
#include "content/public/common/url_fetcher.h"
#include "grit/browser_resources.h"
#include "net/base/escape.h"
+#include "net/base/load_flags.h"
#include "net/url_request/url_request_status.h"
#include "ui/base/resource/resource_bundle.h"
@@ -155,14 +157,14 @@ const LanguageCodeSynonym kLanguageCodeSynonyms[] = {
const char* const kTranslateScriptURL =
"https://translate.google.com/translate_a/element.js?"
- "cb=cr.googleTranslate.onTranslateElementLoad";
+ "cb=cr.googleTranslate.onTranslateElementLoad&hl=%s";
const char* const kTranslateScriptHeader =
"Google-Translate-Element-Mode: library";
const char* const kReportLanguageDetectionErrorURL =
// TODO(palmer): bug 112236. Make this https://.
"http://translate.google.com/translate_error";
const char* const kLanguageListFetchURL =
- "https://translate.googleapis.com/translate_a/l?client=chrome&cb=sl";
+ "https://translate.googleapis.com/translate_a/l?client=chrome&cb=sl&hl=%s";
const int kMaxRetryLanguageListFetch = 5;
const int kTranslateScriptExpirationDelayDays = 1;
@@ -807,8 +809,13 @@ void TranslateManager::FetchLanguageListFromTranslateServer(
return;
}
+ std::string language_list_fetch_url = base::StringPrintf(
+ kLanguageListFetchURL,
+ GetLanguageCode(g_browser_process->GetApplicationLocale()).c_str());
language_list_request_pending_.reset(content::URLFetcher::Create(
- 1, GURL(kLanguageListFetchURL), content::URLFetcher::GET, this));
+ 1, GURL(language_list_fetch_url), content::URLFetcher::GET, this));
+ language_list_request_pending_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
+ net::LOAD_DO_NOT_SAVE_COOKIES);
language_list_request_pending_->SetRequestContext(
g_browser_process->system_request_context());
language_list_request_pending_->SetMaxRetries(kMaxRetryLanguageListFetch);
@@ -824,8 +831,13 @@ void TranslateManager::RequestTranslateScript() {
if (translate_script_request_pending_.get() != NULL)
return;
+ std::string translate_script_url = base::StringPrintf(
+ kTranslateScriptURL,
+ GetLanguageCode(g_browser_process->GetApplicationLocale()).c_str());
translate_script_request_pending_.reset(content::URLFetcher::Create(
- 0, GURL(kTranslateScriptURL), content::URLFetcher::GET, this));
+ 0, GURL(translate_script_url), content::URLFetcher::GET, this));
+ translate_script_request_pending_->SetLoadFlags(
+ net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES);
translate_script_request_pending_->SetRequestContext(
g_browser_process->system_request_context());
translate_script_request_pending_->SetExtraRequestHeaders(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698