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

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

Issue 1990453002: Fix hanging on browser shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 46ad3be53be8341c11e50c91f17197f360e8b567..98e98dff1698acd2f21e282cc5771f1a5fe05431 100644
--- a/ui/accessibility/platform/atk_util_auralinux.cc
+++ b/ui/accessibility/platform/atk_util_auralinux.cc
@@ -53,7 +53,45 @@ const char kAccessibilityEnabled[] = "ACCESSIBILITY_ENABLED";
const char kGnomeAccessibilityEnabledKey[] =
"/desktop/gnome/interface/accessibility";
-#endif
+bool PlatformShouldEnableAccessibility() {
+ GConfClient* client = gconf_client_get_default();
+ if (!client) {
+ LOG(ERROR) << "gconf_client_get_default failed";
+ 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;
+ }
+
+ return value;
+}
+
+#else // !defined(USE_GCONF)
+
+bool PlatformShouldEnableAccessibility() {
+ // TODO(iceman): implement this for non-GNOME desktops.
+ return false;
+}
+
+#endif // defined(USE_GCONF)
+
+bool ShouldEnableAccessibility() {
+ char* enable_accessibility = getenv(kAccessibilityEnabled);
+ if ((enable_accessibility && atoi(enable_accessibility) == 1) ||
+ PlatformShouldEnableAccessibility())
+ return true;
+
+ return false;
+}
} // namespace
@@ -161,6 +199,9 @@ void AtkUtilAuraLinux::Initialize(
// Register our util class.
g_type_class_unref(g_type_class_ref(ATK_UTIL_AURALINUX_TYPE));
+ if (!ShouldEnableAccessibility())
+ return;
+
init_task_runner->PostTaskAndReply(
FROM_HERE,
base::Bind(
@@ -177,33 +218,7 @@ AtkUtilAuraLinux::~AtkUtilAuraLinux() {
#if defined(USE_GCONF)
void AtkUtilAuraLinux::CheckIfAccessibilityIsEnabledOnFileThread() {
- char* enable_accessibility = getenv(kAccessibilityEnabled);
- if ((enable_accessibility && atoi(enable_accessibility) == 1) ||
- CheckPlatformAccessibilitySupportOnFileThread())
- is_enabled_ = AccessibilityModuleInitOnFileThread();
-}
-
-bool AtkUtilAuraLinux::CheckPlatformAccessibilitySupportOnFileThread() {
- GConfClient* client = gconf_client_get_default();
- if (!client) {
- LOG(ERROR) << "gconf_client_get_default failed";
- return false;
- }
-
- GError* error = nullptr;
- bool is_enabled = 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;
- }
-
- return is_enabled;
+ is_enabled_ = AccessibilityModuleInitOnFileThread();
}
void AtkUtilAuraLinux::FinishAccessibilityInitOnUIThread() {
« 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