Chromium Code Reviews| Index: ui/accessibility/platform/atk_util_auralinux.cc |
| diff --git a/ui/accessibility/platform/atk_util_auralinux.cc b/ui/accessibility/platform/atk_util_auralinux.cc |
| index ed019d183d8139d11f9f556e82a55f721a6f9889..831ce835c61876f3f868b4da0984e00d8afdc53a 100644 |
| --- a/ui/accessibility/platform/atk_util_auralinux.cc |
| +++ b/ui/accessibility/platform/atk_util_auralinux.cc |
| @@ -3,16 +3,16 @@ |
| // found in the LICENSE file. |
| #include <atk/atk.h> |
| -#if defined(USE_GCONF) |
| -#include <gconf/gconf-client.h> |
| -#endif |
| #include <glib-2.0/gmodule.h> |
| #include "base/bind.h" |
| +#include "base/environment.h" |
| #include "base/files/file_path.h" |
| #include "base/location.h" |
| #include "base/logging.h" |
| #include "base/memory/singleton.h" |
| +#include "base/strings/string_split.h" |
| +#include "base/strings/string_util.h" |
| #include "base/task_runner.h" |
| #include "ui/accessibility/platform/atk_util_auralinux.h" |
| #include "ui/accessibility/platform/ax_platform_node_auralinux.h" |
| @@ -48,51 +48,29 @@ bool AccessibilityModuleInitOnFileThread() { |
| return true; |
| } |
| -#if defined(USE_GCONF) |
| - |
| -const char kAccessibilityEnabled[] = "ACCESSIBILITY_ENABLED"; |
| -const char kGnomeAccessibilityEnabledKey[] = |
| - "/desktop/gnome/interface/accessibility"; |
| - |
| bool PlatformShouldEnableAccessibility() { |
| - GConfClient* client = gconf_client_get_default(); |
| - if (!client) { |
| - LOG(ERROR) << "gconf_client_get_default failed"; |
| + const char kGtkModules[] = "GTK_MODULES"; |
|
dmazzoni
2017/02/24 01:24:07
Maybe put these at the top where the other constan
Tom (Use chromium acct)
2017/02/24 01:44:17
Done.
|
| + const char kAtkBridgeModule[] = "gail:atk-bridge"; |
| + std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| + std::string gtk_modules; |
| + if (!env->GetVar(kGtkModules, >k_modules)) |
| return false; |
| - } |
| - GError* error = nullptr; |
| - gboolean value = gconf_client_get_bool(client, |
| - kGnomeAccessibilityEnabledKey, |
| - &error); |
| - g_object_unref(client); |
| - |
| - if (error) { |
| - VLOG(1) << "gconf_client_get_bool failed"; |
| - g_error_free(error); |
| - return false; |
| + for (const std::string& module : |
| + base::SplitString(gtk_modules, base::kWhitespaceASCII, |
| + base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) { |
| + if (module == kAtkBridgeModule) |
| + return true; |
| } |
| - |
| - return value; |
| -} |
| - |
| -#else // !defined(USE_GCONF) |
| - |
| -bool PlatformShouldEnableAccessibility() { |
| - // TODO(iceman): implement this for non-GNOME desktops. |
| return false; |
| } |
| -#endif // defined(USE_GCONF) |
| - |
| bool ShouldEnableAccessibility() { |
| -#if defined(USE_GCONF) |
| + const char kAccessibilityEnabled[] = "ACCESSIBILITY_ENABLED"; |
|
dmazzoni
2017/02/24 01:24:07
same, move to top
Tom (Use chromium acct)
2017/02/24 01:44:17
Done.
|
| char* enable_accessibility = getenv(kAccessibilityEnabled); |
| if ((enable_accessibility && atoi(enable_accessibility) == 1) || |
| PlatformShouldEnableAccessibility()) |
| return true; |
| -#endif // defined(USE_GCONF) |
| - |
| return false; |
| } |
| @@ -183,18 +161,7 @@ AtkUtilAuraLinux* AtkUtilAuraLinux::GetInstance() { |
| return base::Singleton<AtkUtilAuraLinux>::get(); |
| } |
| -#if defined(USE_GCONF) |
| - |
| -AtkUtilAuraLinux::AtkUtilAuraLinux() |
| - : is_enabled_(false) { |
| -} |
| - |
| -#else |
| - |
| -AtkUtilAuraLinux::AtkUtilAuraLinux() { |
| -} |
| - |
| -#endif // defined(USE_GCONF) |
| +AtkUtilAuraLinux::AtkUtilAuraLinux() : is_enabled_(false) {} |
| void AtkUtilAuraLinux::Initialize( |
| scoped_refptr<base::TaskRunner> init_task_runner) { |
| @@ -218,8 +185,6 @@ void AtkUtilAuraLinux::Initialize( |
| AtkUtilAuraLinux::~AtkUtilAuraLinux() { |
| } |
| -#if defined(USE_GCONF) |
| - |
| void AtkUtilAuraLinux::CheckIfAccessibilityIsEnabledOnFileThread() { |
| is_enabled_ = AccessibilityModuleInitOnFileThread(); |
| } |
| @@ -234,14 +199,4 @@ void AtkUtilAuraLinux::FinishAccessibilityInitOnUIThread() { |
| g_accessibility_module_init(); |
| } |
| -#else |
| - |
| -void AtkUtilAuraLinux::CheckIfAccessibilityIsEnabledOnFileThread() { |
| -} |
| - |
| -void AtkUtilAuraLinux::FinishAccessibilityInitOnUIThread() { |
| -} |
| - |
| -#endif // defined(USE_GCONF) |
| - |
| } // namespace ui |