Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: ui/accessibility/platform/atk_util_auralinux.cc

Issue 2709963004: Remove gconf usage from atk_util_auralinux (Closed)
Patch Set: Remove gconf config, move constants to top Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/accessibility/platform/atk_util_auralinux.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0b25fcb10fe87043b2534b3bce4b240689056f0c 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"
@@ -21,8 +21,11 @@ namespace {
typedef void (*gnome_accessibility_module_init)();
+const char kAccessibilityEnabled[] = "ACCESSIBILITY_ENABLED";
+const char kAtkBridgeModule[] = "gail:atk-bridge";
const char kAtkBridgePath[] = "gtk-2.0/modules/libatk-bridge.so";
const char kAtkBridgeSymbolName[] = "gnome_accessibility_module_init";
+const char kGtkModules[] = "GTK_MODULES";
gnome_accessibility_module_init g_accessibility_module_init = nullptr;
@@ -48,51 +51,26 @@ 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";
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ std::string gtk_modules;
+ if (!env->GetVar(kGtkModules, &gtk_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)
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
« no previous file with comments | « ui/accessibility/platform/atk_util_auralinux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698