diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index d07c591ca789..cb374ff4c945 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -9,7 +9,6 @@ #include "browser/network_delegate.h" #include "common/application_info.h" -#include "base/environment.h" #include "base/files/file_path.h" #include "base/path_service.h" #include "base/prefs/json_pref_store.h" @@ -20,31 +19,10 @@ #include "content/public/browser/resource_context.h" #include "content/public/browser/storage_partition.h" -#if defined(OS_LINUX) -#include "base/nix/xdg_util.h" -#endif - using content::BrowserThread; namespace brightray { -namespace { - -#if defined(OS_LINUX) -void OverrideLinuxAppDataPath() { - base::FilePath path; - if (PathService::Get(DIR_APP_DATA, &path)) - return; - scoped_ptr env(base::Environment::Create()); - path = base::nix::GetXDGDirectory(env.get(), - base::nix::kXdgConfigHomeEnvVar, - base::nix::kDotConfigDir); - PathService::Override(DIR_APP_DATA, path); -} -#endif - -} // namespace - class BrowserContext::ResourceContext : public content::ResourceContext { public: ResourceContext() : getter_(nullptr) {} @@ -69,10 +47,6 @@ BrowserContext::BrowserContext() : resource_context_(new ResourceContext) { } void BrowserContext::Initialize() { -#if defined(OS_LINUX) - OverrideLinuxAppDataPath(); -#endif - if (!PathService::Get(DIR_USER_DATA, &path_)) { PathService::Get(DIR_APP_DATA, &path_); path_ = path_.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName())); diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index e90a2f8a1c94..67d50d92306f 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -26,6 +26,13 @@ #include "browser/views/views_delegate.h" #endif +#if defined(OS_LINUX) +#include "base/environment.h" +#include "base/path_service.h" +#include "base/nix/xdg_util.h" +#include "browser/brightray_paths.h" +#endif + #if defined(OS_WIN) #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_win.h" @@ -34,9 +41,9 @@ namespace brightray { -#if defined(OS_WIN) namespace { +#if defined(OS_WIN) // gfx::Font callbacks void AdjustUIFont(LOGFONT* logfont) { l10n_util::AdjustUIFont(logfont); @@ -45,9 +52,22 @@ void AdjustUIFont(LOGFONT* logfont) { int GetMinimumFontSize() { return 10; } +#endif + +#if defined(OS_LINUX) +void OverrideLinuxAppDataPath() { + base::FilePath path; + if (PathService::Get(DIR_APP_DATA, &path)) + return; + scoped_ptr env(base::Environment::Create()); + path = base::nix::GetXDGDirectory(env.get(), + base::nix::kXdgConfigHomeEnvVar, + base::nix::kDotConfigDir); + PathService::Override(DIR_APP_DATA, path); +} +#endif } // namespace -#endif BrowserMainParts::BrowserMainParts() { } @@ -64,10 +84,13 @@ void BrowserMainParts::PreEarlyInitialization() { views::LinuxUI::SetInstance(BuildGtk2UI()); #endif +#if defined(OS_LINUX) + OverrideLinuxAppDataPath(); +#endif + InitProxyResolverV8(); } - void BrowserMainParts::ToolkitInitialized() { #if defined(USE_AURA) && defined(USE_X11) views::LinuxUI::instance()->Initialize();