| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/views/accessible_view_helper.h" | 5 #include "chrome/browser/views/accessible_view_helper.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "chrome/browser/accessibility_events.h" | 8 #include "chrome/browser/accessibility_events.h" |
| 9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
| 10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
| 11 #include "views/widget/widget.h" |
| 11 | 12 |
| 12 using views::View; | 13 using views::View; |
| 13 | 14 |
| 14 AccessibleViewHelper::AccessibleViewHelper( | 15 AccessibleViewHelper::AccessibleViewHelper( |
| 15 View* view_tree, Profile* profile) | 16 View* view_tree, Profile* profile) |
| 16 : accessibility_event_router_(AccessibilityEventRouterViews::GetInstance()), | 17 : accessibility_event_router_(AccessibilityEventRouterViews::GetInstance()), |
| 17 profile_(profile), | 18 profile_(profile), |
| 18 view_tree_(view_tree) { | 19 view_tree_(view_tree) { |
| 19 if (!accessibility_event_router_->AddViewTree(view_tree_, profile)) | 20 if (!accessibility_event_router_->AddViewTree(view_tree_, profile)) |
| 20 view_tree_ = NULL; | 21 view_tree_ = NULL; |
| 22 |
| 23 #if defined(OS_LINUX) |
| 24 GtkWidget* widget = view_tree->GetWidget()->GetNativeView(); |
| 25 widget_helper_.reset(new AccessibleWidgetHelper(widget, profile)); |
| 26 #endif |
| 21 } | 27 } |
| 22 | 28 |
| 23 AccessibleViewHelper::~AccessibleViewHelper() { | 29 AccessibleViewHelper::~AccessibleViewHelper() { |
| 24 if (!window_title_.empty()) { | 30 if (!window_title_.empty()) { |
| 25 AccessibilityWindowInfo info(profile_, window_title_); | 31 AccessibilityWindowInfo info(profile_, window_title_); |
| 26 NotificationService::current()->Notify( | 32 NotificationService::current()->Notify( |
| 27 NotificationType::ACCESSIBILITY_WINDOW_CLOSED, | 33 NotificationType::ACCESSIBILITY_WINDOW_CLOSED, |
| 28 Source<Profile>(profile_), | 34 Source<Profile>(profile_), |
| 29 Details<AccessibilityWindowInfo>(&info)); | 35 Details<AccessibilityWindowInfo>(&info)); |
| 30 } | 36 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 70 } |
| 65 | 71 |
| 66 void AccessibleViewHelper::SetViewName(View* view, int string_id) { | 72 void AccessibleViewHelper::SetViewName(View* view, int string_id) { |
| 67 if (!view_tree_) | 73 if (!view_tree_) |
| 68 return; | 74 return; |
| 69 | 75 |
| 70 std::string name = l10n_util::GetStringUTF8(string_id); | 76 std::string name = l10n_util::GetStringUTF8(string_id); |
| 71 accessibility_event_router_->SetViewName(view, name); | 77 accessibility_event_router_->SetViewName(view, name); |
| 72 managed_views_.push_back(view); | 78 managed_views_.push_back(view); |
| 73 } | 79 } |
| OLD | NEW |