Index: android_webview/browser/aw_content_browser_client.cc |
=================================================================== |
--- android_webview/browser/aw_content_browser_client.cc (revision 192622) |
+++ android_webview/browser/aw_content_browser_client.cc (working copy) |
@@ -26,8 +26,11 @@ |
#include "net/ssl/ssl_info.h" |
#include "ui/base/resource/resource_bundle.h" |
+namespace android_webview { |
namespace { |
+AwBrowserContext* g_browser_context; |
+ |
class AwAccessTokenStore : public content::AccessTokenStore { |
public: |
AwAccessTokenStore() { } |
@@ -51,14 +54,22 @@ |
} |
-namespace android_webview { |
+std::string AwContentBrowserClient::GetAcceptLangsImpl() { |
+ // Start with the currnet locale. |
+ std::string langs = base::android::GetDefaultLocale(); |
-// static |
-AwContentBrowserClient* AwContentBrowserClient::FromContentBrowserClient( |
- content::ContentBrowserClient* client) { |
- return static_cast<AwContentBrowserClient*>(client); |
+ // If we're not en-US, add in en-US which will be |
+ // used with a lower q-value. |
+ if (StringToLowerASCII(langs) != "en-us") { |
+ langs += ",en-US"; |
+ } |
+ return langs; |
} |
+AwBrowserContext* AwContentBrowserClient::GetAwBrowserContext() { |
+ return g_browser_context; |
+} |
+ |
AwContentBrowserClient::AwContentBrowserClient( |
JniDependencyFactory* native_factory) |
: native_factory_(native_factory) { |
@@ -68,9 +79,11 @@ |
} |
browser_context_.reset( |
new AwBrowserContext(user_data_dir, native_factory_)); |
+ g_browser_context = browser_context_.get(); |
} |
AwContentBrowserClient::~AwContentBrowserClient() { |
+ g_browser_context = NULL; |
} |
void AwContentBrowserClient::AddCertificate(net::URLRequest* request, |
@@ -83,10 +96,6 @@ |
net::android::StoreCertificate(cert_type, cert_data, cert_size); |
} |
-AwBrowserContext* AwContentBrowserClient::GetAwBrowserContext() { |
- return browser_context_.get(); |
-} |
- |
content::BrowserMainParts* AwContentBrowserClient::CreateBrowserMainParts( |
const content::MainFunctionParams& parameters) { |
return new AwBrowserMainParts(browser_context_.get()); |
@@ -151,15 +160,7 @@ |
std::string AwContentBrowserClient::GetAcceptLangs( |
content::BrowserContext* context) { |
- // Start with the currnet locale. |
- std::string langs = GetApplicationLocale(); |
- |
- // If we're not en-US, add in en-US which will be |
- // used with a lower q-value. |
- if (StringToLowerASCII(langs) != "en-us") { |
- langs += ",en-US"; |
- } |
- return langs; |
+ return GetAcceptLangsImpl(); |
} |
gfx::ImageSkia* AwContentBrowserClient::GetDefaultFavicon() { |
@@ -340,12 +341,6 @@ |
NOTIMPLEMENTED(); |
} |
-void AwContentBrowserClient::ClearInspectorSettings( |
- content::RenderViewHost* rvh) { |
- // TODO(boliu): Implement persisting inspector settings. |
- NOTIMPLEMENTED(); |
-} |
- |
void AwContentBrowserClient::ClearCache(content::RenderViewHost* rvh) { |
RemoveHttpDiskCache(rvh->GetProcess()->GetBrowserContext(), |
rvh->GetProcess()->GetID()); |