Chromium Code Reviews| Index: chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
| diff --git a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
| index 06bfc0f172ca4a6c131908e5f44ce4aa609f4ea8..8a1e53cf83383cbba5dfefee968683e48c5d7ad5 100644 |
| --- a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
| +++ b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
| @@ -14,12 +14,14 @@ |
| #include "chrome/browser/extensions/api/automation_internal/automation_event_router.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/common/extensions/chrome_extension_messages.h" |
| +#include "chrome/grit/generated_resources.h" |
| #include "content/public/browser/ax_event_notification_details.h" |
| #include "content/public/browser/browser_context.h" |
| #include "ui/accessibility/ax_action_data.h" |
| #include "ui/accessibility/ax_enums.h" |
| #include "ui/aura/env.h" |
| #include "ui/aura/window.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| #include "ui/views/accessibility/ax_aura_obj_wrapper.h" |
| #include "ui/views/view.h" |
| #include "ui/views/widget/widget.h" |
| @@ -31,6 +33,18 @@ |
| using content::BrowserContext; |
| using extensions::AutomationEventRouter; |
| +namespace { |
| + |
| +bool IsScreenOffAlert(const std::string& text) { |
| + return text == l10n_util::GetStringUTF8(IDS_A11Y_ALERT_SCREEN_OFF); |
| +} |
| + |
| +bool IsScreenOnAlert(const std::string& text) { |
| + return text == l10n_util::GetStringUTF8(IDS_A11Y_ALERT_SCREEN_ON); |
| +} |
| + |
| +} // namespace |
| + |
| // static |
| AutomationManagerAura* AutomationManagerAura::GetInstance() { |
| return base::Singleton<AutomationManagerAura>::get(); |
| @@ -76,13 +90,18 @@ void AutomationManagerAura::HandleEvent(BrowserContext* context, |
| void AutomationManagerAura::HandleAlert(content::BrowserContext* context, |
| const std::string& text) { |
| - if (!enabled_) |
| + if (!enabled_ && !IsScreenOnAlert(text)) |
| return; |
| views::AXAuraObjWrapper* obj = |
| static_cast<AXRootObjWrapper*>(current_tree_->GetRoot()) |
| ->GetAlertForText(text); |
| SendEvent(context, obj, ui::AX_EVENT_ALERT); |
| + |
| + if (IsScreenOffAlert(text)) |
|
David Tseng
2017/02/03 00:27:15
I wouldn't want to check against this string every
Qiang(Joe) Xu
2017/02/03 02:46:54
Screen on/off info may come from chromeos::power_m
|
| + Disable(); |
| + else if (IsScreenOnAlert(text)) |
| + Enable(context); |
| } |
| void AutomationManagerAura::PerformAction( |