REVIEW: access GetApplicationLocale on sequence that allows IO
This commit is contained in:
parent
1912fbb073
commit
a1592446da
13 changed files with 70 additions and 19 deletions
|
@ -842,7 +842,7 @@ void App::SetDesktopName(const std::string& desktop_name) {
|
|||
}
|
||||
|
||||
std::string App::GetLocale() {
|
||||
return l10n_util::GetApplicationLocale("");
|
||||
return g_browser_process->GetApplicationLocale();
|
||||
}
|
||||
|
||||
bool App::MakeSingleInstance(
|
||||
|
|
|
@ -126,10 +126,13 @@ net::HttpAuth::Scheme GetAuthSchemeFromString(const std::string& scheme) {
|
|||
void SetUserAgentInIO(scoped_refptr<net::URLRequestContextGetter> getter,
|
||||
const std::string& accept_lang,
|
||||
const std::string& user_agent) {
|
||||
std::string accept_lang_header = net::HttpUtil::GenerateAcceptLanguageHeader(
|
||||
accept_lang.empty() ? getter->GetURLRequestContext()
|
||||
->http_user_agent_settings()
|
||||
->GetAcceptLanguage()
|
||||
: accept_lang);
|
||||
getter->GetURLRequestContext()->set_http_user_agent_settings(
|
||||
new net::StaticHttpUserAgentSettings(
|
||||
net::HttpUtil::GenerateAcceptLanguageHeader(accept_lang),
|
||||
user_agent));
|
||||
new net::StaticHttpUserAgentSettings(accept_lang_header, user_agent));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -642,7 +645,7 @@ void Session::SetUserAgent(const std::string& user_agent,
|
|||
mate::Arguments* args) {
|
||||
browser_context_->SetUserAgent(user_agent);
|
||||
|
||||
std::string accept_lang = l10n_util::GetApplicationLocale("");
|
||||
std::string accept_lang;
|
||||
args->GetNext(&accept_lang);
|
||||
|
||||
scoped_refptr<brightray::URLRequestContextGetter> getter(
|
||||
|
|
|
@ -202,10 +202,6 @@ void AtomBrowserClient::OverrideWebkitPrefs(
|
|||
WebContentsPreferences::OverrideWebkitPrefs(web_contents, prefs);
|
||||
}
|
||||
|
||||
std::string AtomBrowserClient::GetApplicationLocale() {
|
||||
return l10n_util::GetApplicationLocale("");
|
||||
}
|
||||
|
||||
void AtomBrowserClient::OverrideSiteInstanceForNavigation(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
content::BrowserContext* browser_context,
|
||||
|
|
|
@ -53,7 +53,6 @@ class AtomBrowserClient : public brightray::BrowserClient,
|
|||
CreateSpeechRecognitionManagerDelegate() override;
|
||||
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
|
||||
content::WebPreferences* prefs) override;
|
||||
std::string GetApplicationLocale() override;
|
||||
void OverrideSiteInstanceForNavigation(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
content::BrowserContext* browser_context,
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "device/geolocation/geolocation_delegate.h"
|
||||
#include "device/geolocation/geolocation_provider.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "v8/include/v8-debug.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
|
@ -129,6 +130,12 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
|
|||
JavascriptEnvironment::Initialize();
|
||||
}
|
||||
|
||||
int AtomBrowserMainParts::PreCreateThreads() {
|
||||
fake_browser_process_->SetApplicationLocale(
|
||||
l10n_util::GetApplicationLocale(""));
|
||||
return brightray::BrowserMainParts::PreCreateThreads();
|
||||
}
|
||||
|
||||
void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
||||
js_env_->OnMessageLoopCreated();
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
|||
// content::BrowserMainParts:
|
||||
void PreEarlyInitialization() override;
|
||||
void PostEarlyInitialization() override;
|
||||
int PreCreateThreads() override;
|
||||
void PreMainMessageLoopRun() override;
|
||||
bool MainMessageLoopRun(int* result_code) override;
|
||||
void PostMainMessageLoopStart() override;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "base/bind.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "content/public/browser/stream_handle.h"
|
||||
#include "content/public/browser/stream_info.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
@ -193,7 +194,7 @@ void PdfViewerHandler::GetStrings(const base::ListValue* args) {
|
|||
SET_STRING("tooltipZoomOut", "Zoom out");
|
||||
#undef SET_STRING
|
||||
|
||||
webui::SetLoadTimeDataDefaults(l10n_util::GetApplicationLocale(""),
|
||||
webui::SetLoadTimeDataDefaults(g_browser_process->GetApplicationLocale(),
|
||||
result.get());
|
||||
ResolveJavascriptCallback(*callback_id, *result);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue