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