blob: 084f7203cfb426b66832b6d439b5242ca0d0edec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/input_method/accessibility.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
namespace chromeos {
namespace input_method {
Accessibility::Accessibility(InputMethodManager* imm)
: imm_(imm) {
DCHECK(imm_);
imm_->AddObserver(this);
}
Accessibility::~Accessibility() {
DCHECK(imm_);
imm_->RemoveObserver(this);
}
void Accessibility::InputMethodChanged(InputMethodManager* imm,
Profile* profile,
bool show_message) {
DCHECK_EQ(imm, imm_);
if (!show_message)
return;
// Get the medium name of the changed input method (e.g. US, INTL, etc.)
const InputMethodDescriptor descriptor =
imm_->GetActiveIMEState()->GetCurrentInputMethod();
const std::string medium_name = base::UTF16ToUTF8(
imm_->GetInputMethodUtil()->GetInputMethodMediumName(descriptor));
AutomationManagerAura::GetInstance()->HandleAlert(profile, medium_name);
}
} // namespace input_method
} // namespace chromeos
|