Commit 55a772ae authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

cros: Remove hard coded top row key mode for kiosk app.

And expose prefs::kLanguageSendFunctionKeys via
ChromeOSInfoPrivate for apps that need the function keys.

BUG=338390

Review URL: https://codereview.chromium.org/162783002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251421 0039d316-1c4b-4281-b951-d872f2087c98
parent 3d95d176
......@@ -6,7 +6,6 @@
#include "apps/shell_window.h"
#include "apps/shell_window_registry.h"
#include "ash/wm/window_state.h"
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/lazy_instance.h"
......@@ -33,9 +32,7 @@ namespace chromeos {
namespace {
// AppWindowHandler watches for app window and exits the session when the
// last app window is closed. It also initializes the kiosk app window so
// that it receives all function keys as a temp solution before underlying
// http:://crbug.com/166928 is fixed..
// last app window is closed.
class AppWindowHandler : public ShellWindowRegistry::Observer {
public:
AppWindowHandler() : window_registry_(NULL) {}
......@@ -50,13 +47,7 @@ class AppWindowHandler : public ShellWindowRegistry::Observer {
private:
// apps::ShellWindowRegistry::Observer overrides:
virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE {
// Set flags to allow kiosk app to receive all function keys.
// TODO(xiyuan): Remove this after http:://crbug.com/166928.
ash::wm::WindowState* window_state =
ash::wm::GetWindowState(shell_window->GetNativeWindow());
window_state->set_top_row_keys_are_function_keys(true);
}
virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE {}
virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window)
OVERRIDE {}
virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE {
......
......@@ -68,6 +68,9 @@ const char kPropertyScreenMagnifierEnabled[] = "a11yScreenMagnifierEnabled";
// Key which corresponds to the auto click A11Y property in JS.
const char kPropertyAutoclickEnabled[] = "a11yAutoClickEnabled";
// Key which corresponds to the send-function-keys property in JS.
const char kPropertySendFunctionsKeys[] = "sendFunctionKeys";
// Property not found error message.
const char kPropertyNotFound[] = "Property '*' does not exist.";
......@@ -80,7 +83,8 @@ const struct {
{ kPropertySpokenFeedbackEnabled, prefs::kSpokenFeedbackEnabled },
{ kPropertyHighContrastEnabled, prefs::kHighContrastEnabled },
{ kPropertyScreenMagnifierEnabled, prefs::kScreenMagnifierEnabled },
{ kPropertyAutoclickEnabled, prefs::kAutoclickEnabled }
{ kPropertyAutoclickEnabled, prefs::kAutoclickEnabled },
{ kPropertySendFunctionsKeys, prefs::kLanguageSendFunctionKeys }
};
const char* GetBoolPrefNameForApiProperty(const char* api_name) {
......
......@@ -26,6 +26,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeOSInfoPrivateTest) {
ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
prefs::kAutoclickEnabled));
ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
prefs::kLanguageSendFunctionKeys));
ASSERT_TRUE(RunComponentExtensionTest("chromeos_info_private")) << message_;
// Check that accessability settings have been all flipped by the test.
......@@ -37,4 +40,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeOSInfoPrivateTest) {
prefs::kScreenMagnifierEnabled));
ASSERT_TRUE(profile()->GetPrefs()->GetBoolean(
prefs::kAutoclickEnabled));
ASSERT_TRUE(profile()->GetPrefs()->GetBoolean(
prefs::kLanguageSendFunctionKeys));
}
......@@ -44,6 +44,7 @@
"a11yHighContrastEnabled" : {"type": "boolean", "optional": "true", "description": "If true, all displays have high contrast mode turned on."},
"a11yScreenMagnifierEnabled" : {"type": "boolean", "optional": "true", "description": "If true, all displays have screen magnifier turned on."},
"a11yAutoClickEnabled" : {"type": "boolean", "optional": "true", "description": "If true, auto mouse click accessibility feature is turned on."},
"sendFunctionKeys" : {"type": "boolean", "optional": "true", "description": "If true, the ChromeOS top row keys send function keys."},
"supportedTimezones" : {
"type": "array",
"items": {
......@@ -73,7 +74,8 @@
"a11ySpokenFeedbackEnabled",
"a11yHighContrastEnabled",
"a11yScreenMagnifierEnabled",
"a11yAutoClickEnabled"],
"a11yAutoClickEnabled",
"sendFunctionKeys"],
"description": "Chrome OS system property name"
},
{
......
......@@ -68,20 +68,22 @@ function timezoneSetTest() {
));
}
function a11ySetTest() {
function prefsTest() {
chrome.chromeosInfoPrivate.set('a11yLargeCursorEnabled', true);
chrome.chromeosInfoPrivate.set('a11yStickyKeysEnabled', true);
chrome.chromeosInfoPrivate.set('a11ySpokenFeedbackEnabled', true);
chrome.chromeosInfoPrivate.set('a11yHighContrastEnabled', true);
chrome.chromeosInfoPrivate.set('a11yScreenMagnifierEnabled', true);
chrome.chromeosInfoPrivate.set('a11yAutoClickEnabled', true);
chrome.chromeosInfoPrivate.set('sendFunctionKeys', true);
chrome.chromeosInfoPrivate.get(
['a11yLargeCursorEnabled',
'a11yStickyKeysEnabled',
'a11ySpokenFeedbackEnabled',
'a11yHighContrastEnabled',
'a11yScreenMagnifierEnabled',
'a11yAutoClickEnabled'],
'a11yAutoClickEnabled',
'sendFunctionKeys'],
pass(
function(values) {
chrome.test.assertEq(values['a11yLargeCursorEnabled'], true);
......@@ -90,6 +92,7 @@ function a11ySetTest() {
chrome.test.assertEq(values['a11yHighContrastEnabled'], true);
chrome.test.assertEq(values['a11yScreenMagnifierEnabled'], true);
chrome.test.assertEq(values['a11yAutoClickEnabled'], true);
chrome.test.assertEq(values['sendFunctionKeys'], true);
}
));
}
......@@ -106,11 +109,12 @@ var tests = generateTestsForKeys(['hwid',
'a11yHighContrastEnabled',
'a11yScreenMagnifierEnabled',
'a11yAutoClickEnabled',
'sendFunctionKeys',
'timezone',
'supportedTimezones'])
// Add chrome.chromeosInfoPrivate.set() test.
tests.push(timezoneSetTest);
tests.push(a11ySetTest);
tests.push(prefsTest);
chrome.test.runTests(tests);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment