summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/accessibility/accessibility_util.cc
blob: 04379c3be29a3ea3405e6e2991209acb6625967b (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
// Copyright (c) 2012 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/accessibility/accessibility_util.h"

#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "url/gurl.h"

// TODO(yoshiki): move the following method to accessibility_manager.cc and
// remove this file.

namespace chromeos {
namespace accessibility {

void EnableVirtualKeyboard(bool enabled) {
  PrefService* pref_service = g_browser_process->local_state();
  pref_service->SetBoolean(prefs::kVirtualKeyboardEnabled, enabled);
  pref_service->CommitPendingWrite();
}

bool IsVirtualKeyboardEnabled() {
  if (!g_browser_process) {
    return false;
  }
  PrefService* prefs = g_browser_process->local_state();
  bool virtual_keyboard_enabled = prefs &&
      prefs->GetBoolean(prefs::kVirtualKeyboardEnabled);
  return virtual_keyboard_enabled;
}

void ShowAccessibilityHelp(Browser* browser) {
  chrome::ShowSingletonTab(browser, GURL(chrome::kChromeAccessibilityHelpURL));
}

}  // namespace accessibility
}  // namespace chromeos