Commit 597a867b authored by rdsmith@chromium.org's avatar rdsmith@chromium.org

Changed argument to GetAcceptLangs() to a BrowserContext.


Review URL: http://codereview.chromium.org/8475024

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110719 0039d316-1c4b-4281-b951-d872f2087c98
parent a63094c5
......@@ -651,8 +651,9 @@ std::string ChromeContentBrowserClient::GetApplicationLocale() {
return g_browser_process->GetApplicationLocale();
}
std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) {
Profile* profile = Profile::FromBrowserContext(tab->browser_context());
std::string ChromeContentBrowserClient::GetAcceptLangs(
content::BrowserContext* context) {
Profile* profile = Profile::FromBrowserContext(context);
return profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
}
......
......@@ -42,7 +42,8 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
int child_process_id) OVERRIDE;
virtual std::string GetApplicationLocale() OVERRIDE;
virtual std::string GetAcceptLangs(const TabContents* tab) OVERRIDE;
virtual std::string GetAcceptLangs(
content::BrowserContext* context) OVERRIDE;
virtual SkBitmap* GetDefaultFavicon() OVERRIDE;
virtual bool AllowAppCache(const GURL& manifest_url,
const GURL& first_party,
......
......@@ -6,8 +6,8 @@
#include <vector>
#include "base/bind.h"
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/file_util.h"
#include "base/format_macros.h"
#include "base/i18n/case_conversion.h"
......@@ -25,6 +25,7 @@
#include "content/browser/download/download_request_handle.h"
#include "content/browser/download/download_stats.h"
#include "content/browser/download/interrupt_reasons.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/download_manager_delegate.h"
......@@ -630,8 +631,10 @@ bool DownloadItem::MatchesQuery(const string16& query) const {
// "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD"
std::string languages;
TabContents* tab = GetTabContents();
if (tab)
languages = content::GetContentClient()->browser()->GetAcceptLangs(tab);
if (tab) {
languages = content::GetContentClient()->browser()->GetAcceptLangs(
tab->browser_context());
}
string16 url_formatted(net::FormatUrl(GetURL(), languages));
if (base::i18n::StringSearchIgnoringCaseAndAccents(query, url_formatted))
return true;
......
......@@ -1154,7 +1154,8 @@ void SavePackage::GetSaveInfo() {
tab_contents(), &website_save_dir, &download_save_dir);
std::string mime_type = tab_contents()->contents_mime_type();
std::string accept_languages =
content::GetContentClient()->browser()->GetAcceptLangs(tab_contents());
content::GetContentClient()->browser()->GetAcceptLangs(
tab_contents()->browser_context());
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
......
......@@ -102,7 +102,8 @@ std::string MockContentBrowserClient::GetApplicationLocale() {
return std::string();
}
std::string MockContentBrowserClient::GetAcceptLangs(const TabContents* tab) {
std::string MockContentBrowserClient::GetAcceptLangs(
content::BrowserContext* context) {
return std::string();
}
......
......@@ -49,7 +49,8 @@ class MockContentBrowserClient : public ContentBrowserClient {
virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
int child_process_id) OVERRIDE;
virtual std::string GetApplicationLocale() OVERRIDE;
virtual std::string GetAcceptLangs(const TabContents* tab) OVERRIDE;
virtual std::string GetAcceptLangs(
content::BrowserContext* context) OVERRIDE;
virtual SkBitmap* GetDefaultFavicon() OVERRIDE;
virtual bool AllowAppCache(const GURL& manifest_url,
const GURL& first_party,
......
......@@ -344,7 +344,8 @@ const string16& TabContents::GetTitle() const {
// that are shown on top of existing pages.
NavigationEntry* entry = controller_.GetTransientEntry();
std::string accept_languages =
content::GetContentClient()->browser()->GetAcceptLangs(this);
content::GetContentClient()->browser()->GetAcceptLangs(
this->browser_context());
if (entry) {
return entry->GetTitleForDisplay(accept_languages);
}
......@@ -1780,7 +1781,8 @@ void TabContents::RunJavaScriptMessage(
title_type = content::JavaScriptDialogCreator::DIALOG_TITLE_FORMATTED_URL;
title = net::FormatUrl(
frame_url.GetOrigin(),
content::GetContentClient()->browser()->GetAcceptLangs(this));
content::GetContentClient()->browser()->GetAcceptLangs(
this->browser_context()));
}
dialog_creator_ = delegate_->GetJavaScriptDialogCreator();
......@@ -1916,7 +1918,8 @@ void TabContents::LoadStateChanged(const GURL& url,
upload_position_ = upload_position;
upload_size_ = upload_size;
load_state_host_ = net::IDNToUnicode(url.host(),
content::GetContentClient()->browser()->GetAcceptLangs(this));
content::GetContentClient()->browser()->GetAcceptLangs(
this->browser_context()));
if (load_state_.state == net::LOAD_STATE_READING_RESPONSE)
SetNotWaitingForResponse();
if (IsLoading())
......
......@@ -165,7 +165,8 @@ class ContentBrowserClient {
// Returns the languages used in the Accept-Languages HTTP header.
// (Not called GetAcceptLanguages so it doesn't clash with win32).
virtual std::string GetAcceptLangs(const TabContents* tab) = 0;
virtual std::string GetAcceptLangs(
content::BrowserContext* context) = 0;
// Returns the default favicon. The callee doesn't own the given bitmap.
virtual SkBitmap* GetDefaultFavicon() = 0;
......
......@@ -115,7 +115,8 @@ std::string ShellContentBrowserClient::GetApplicationLocale() {
return std::string();
}
std::string ShellContentBrowserClient::GetAcceptLangs(const TabContents* tab) {
std::string ShellContentBrowserClient::GetAcceptLangs(
content::BrowserContext* context) {
return std::string();
}
......
......@@ -62,7 +62,8 @@ class ShellContentBrowserClient : public ContentBrowserClient
virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
int child_process_id) OVERRIDE;
virtual std::string GetApplicationLocale() OVERRIDE;
virtual std::string GetAcceptLangs(const TabContents* tab) OVERRIDE;
virtual std::string GetAcceptLangs(
content::BrowserContext* context) OVERRIDE;
virtual SkBitmap* GetDefaultFavicon() OVERRIDE;
virtual bool AllowAppCache(const GURL& manifest_url,
const GURL& first_party,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment