mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-04-16 19:57:23 +02:00
Make navigator.language return the same value as CefSettings.locale (issue #429).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@382 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
268675fdbe
commit
e7e289a7c6
@ -14,6 +14,7 @@
|
|||||||
#include "browser_devtools_callargs.h"
|
#include "browser_devtools_callargs.h"
|
||||||
#include "browser_devtools_client.h"
|
#include "browser_devtools_client.h"
|
||||||
#include "browser_impl.h"
|
#include "browser_impl.h"
|
||||||
|
#include "cef_context.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
@ -32,7 +33,7 @@ BrowserDevToolsClient::BrowserDevToolsClient(CefBrowserImpl* browser,
|
|||||||
dev_tools_agent_(agent),
|
dev_tools_agent_(agent),
|
||||||
web_view_(browser->UIT_GetWebView()) {
|
web_view_(browser->UIT_GetWebView()) {
|
||||||
web_tools_frontend_.reset(WebDevToolsFrontend::create(web_view_, this,
|
web_tools_frontend_.reset(WebDevToolsFrontend::create(web_view_, this,
|
||||||
WebString::fromUTF8("en-US")));
|
WebString::fromUTF8(_Context->locale())));
|
||||||
dev_tools_agent_->attach(this);
|
dev_tools_agent_->attach(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ WebKit::WebData BrowserWebKitInit::loadResource(const char* name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebKit::WebString BrowserWebKitInit::defaultLocale() {
|
WebKit::WebString BrowserWebKitInit::defaultLocale() {
|
||||||
return ASCIIToUTF16("en-US");
|
return ASCIIToUTF16(_Context->locale());
|
||||||
}
|
}
|
||||||
|
|
||||||
WebKit::WebStorageNamespace* BrowserWebKitInit::createLocalStorageNamespace(
|
WebKit::WebStorageNamespace* BrowserWebKitInit::createLocalStorageNamespace(
|
||||||
|
@ -972,6 +972,15 @@ CefRefPtr<CefBrowserImpl> CefContext::GetBrowserByID(int id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CefContext::locale() const
|
||||||
|
{
|
||||||
|
std::string localeStr = CefString(&settings_.locale);
|
||||||
|
if (!localeStr.empty())
|
||||||
|
return localeStr;
|
||||||
|
|
||||||
|
return "en-US";
|
||||||
|
}
|
||||||
|
|
||||||
void CefContext::UIT_FinishShutdown(base::WaitableEvent* browser_shutdown_event,
|
void CefContext::UIT_FinishShutdown(base::WaitableEvent* browser_shutdown_event,
|
||||||
base::WaitableEvent* uithread_shutdown_event)
|
base::WaitableEvent* uithread_shutdown_event)
|
||||||
{
|
{
|
||||||
|
@ -53,6 +53,9 @@ public:
|
|||||||
|
|
||||||
const CefSettings& settings() const { return settings_; }
|
const CefSettings& settings() const { return settings_; }
|
||||||
|
|
||||||
|
// Return the locale specified in CefSettings or the default value of "en-US".
|
||||||
|
std::string locale() const;
|
||||||
|
|
||||||
// The BrowserRequestContext object is managed by CefProcessIOThread.
|
// The BrowserRequestContext object is managed by CefProcessIOThread.
|
||||||
void set_request_context(BrowserRequestContext* request_context)
|
void set_request_context(BrowserRequestContext* request_context)
|
||||||
{ request_context_ = request_context; }
|
{ request_context_ = request_context; }
|
||||||
|
@ -86,10 +86,7 @@ void CefProcessUIThread::Init() {
|
|||||||
// Provides path resolution required for locating locale pack files.
|
// Provides path resolution required for locating locale pack files.
|
||||||
ui::RegisterPathProvider();
|
ui::RegisterPathProvider();
|
||||||
|
|
||||||
std::string localeStr = CefString(&settings.locale);
|
webkit_glue::InitializeResourceBundle(_Context->locale());
|
||||||
if (localeStr.empty())
|
|
||||||
localeStr = "en-US";
|
|
||||||
webkit_glue::InitializeResourceBundle(localeStr);
|
|
||||||
|
|
||||||
PlatformInit();
|
PlatformInit();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user