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 @@ ...@@ -6,7 +6,6 @@
#include "apps/shell_window.h" #include "apps/shell_window.h"
#include "apps/shell_window_registry.h" #include "apps/shell_window_registry.h"
#include "ash/wm/window_state.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
...@@ -33,9 +32,7 @@ namespace chromeos { ...@@ -33,9 +32,7 @@ namespace chromeos {
namespace { namespace {
// AppWindowHandler watches for app window and exits the session when the // AppWindowHandler watches for app window and exits the session when the
// last app window is closed. It also initializes the kiosk app window so // last app window is closed.
// that it receives all function keys as a temp solution before underlying
// http:://crbug.com/166928 is fixed..
class AppWindowHandler : public ShellWindowRegistry::Observer { class AppWindowHandler : public ShellWindowRegistry::Observer {
public: public:
AppWindowHandler() : window_registry_(NULL) {} AppWindowHandler() : window_registry_(NULL) {}
...@@ -50,13 +47,7 @@ class AppWindowHandler : public ShellWindowRegistry::Observer { ...@@ -50,13 +47,7 @@ class AppWindowHandler : public ShellWindowRegistry::Observer {
private: private:
// apps::ShellWindowRegistry::Observer overrides: // apps::ShellWindowRegistry::Observer overrides:
virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE { 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 OnShellWindowIconChanged(apps::ShellWindow* shell_window) virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window)
OVERRIDE {} OVERRIDE {}
virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE { virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE {
......
...@@ -68,6 +68,9 @@ const char kPropertyScreenMagnifierEnabled[] = "a11yScreenMagnifierEnabled"; ...@@ -68,6 +68,9 @@ const char kPropertyScreenMagnifierEnabled[] = "a11yScreenMagnifierEnabled";
// Key which corresponds to the auto click A11Y property in JS. // Key which corresponds to the auto click A11Y property in JS.
const char kPropertyAutoclickEnabled[] = "a11yAutoClickEnabled"; const char kPropertyAutoclickEnabled[] = "a11yAutoClickEnabled";
// Key which corresponds to the send-function-keys property in JS.
const char kPropertySendFunctionsKeys[] = "sendFunctionKeys";
// Property not found error message. // Property not found error message.
const char kPropertyNotFound[] = "Property '*' does not exist."; const char kPropertyNotFound[] = "Property '*' does not exist.";
...@@ -80,7 +83,8 @@ const struct { ...@@ -80,7 +83,8 @@ const struct {
{ kPropertySpokenFeedbackEnabled, prefs::kSpokenFeedbackEnabled }, { kPropertySpokenFeedbackEnabled, prefs::kSpokenFeedbackEnabled },
{ kPropertyHighContrastEnabled, prefs::kHighContrastEnabled }, { kPropertyHighContrastEnabled, prefs::kHighContrastEnabled },
{ kPropertyScreenMagnifierEnabled, prefs::kScreenMagnifierEnabled }, { kPropertyScreenMagnifierEnabled, prefs::kScreenMagnifierEnabled },
{ kPropertyAutoclickEnabled, prefs::kAutoclickEnabled } { kPropertyAutoclickEnabled, prefs::kAutoclickEnabled },
{ kPropertySendFunctionsKeys, prefs::kLanguageSendFunctionKeys }
}; };
const char* GetBoolPrefNameForApiProperty(const char* api_name) { const char* GetBoolPrefNameForApiProperty(const char* api_name) {
......
...@@ -26,6 +26,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeOSInfoPrivateTest) { ...@@ -26,6 +26,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeOSInfoPrivateTest) {
ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
prefs::kAutoclickEnabled)); prefs::kAutoclickEnabled));
ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
prefs::kLanguageSendFunctionKeys));
ASSERT_TRUE(RunComponentExtensionTest("chromeos_info_private")) << message_; ASSERT_TRUE(RunComponentExtensionTest("chromeos_info_private")) << message_;
// Check that accessability settings have been all flipped by the test. // Check that accessability settings have been all flipped by the test.
...@@ -37,4 +40,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeOSInfoPrivateTest) { ...@@ -37,4 +40,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeOSInfoPrivateTest) {
prefs::kScreenMagnifierEnabled)); prefs::kScreenMagnifierEnabled));
ASSERT_TRUE(profile()->GetPrefs()->GetBoolean( ASSERT_TRUE(profile()->GetPrefs()->GetBoolean(
prefs::kAutoclickEnabled)); prefs::kAutoclickEnabled));
ASSERT_TRUE(profile()->GetPrefs()->GetBoolean(
prefs::kLanguageSendFunctionKeys));
} }
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
"a11yHighContrastEnabled" : {"type": "boolean", "optional": "true", "description": "If true, all displays have high contrast mode turned on."}, "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."}, "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."}, "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" : { "supportedTimezones" : {
"type": "array", "type": "array",
"items": { "items": {
...@@ -73,7 +74,8 @@ ...@@ -73,7 +74,8 @@
"a11ySpokenFeedbackEnabled", "a11ySpokenFeedbackEnabled",
"a11yHighContrastEnabled", "a11yHighContrastEnabled",
"a11yScreenMagnifierEnabled", "a11yScreenMagnifierEnabled",
"a11yAutoClickEnabled"], "a11yAutoClickEnabled",
"sendFunctionKeys"],
"description": "Chrome OS system property name" "description": "Chrome OS system property name"
}, },
{ {
......
...@@ -68,20 +68,22 @@ function timezoneSetTest() { ...@@ -68,20 +68,22 @@ function timezoneSetTest() {
)); ));
} }
function a11ySetTest() { function prefsTest() {
chrome.chromeosInfoPrivate.set('a11yLargeCursorEnabled', true); chrome.chromeosInfoPrivate.set('a11yLargeCursorEnabled', true);
chrome.chromeosInfoPrivate.set('a11yStickyKeysEnabled', true); chrome.chromeosInfoPrivate.set('a11yStickyKeysEnabled', true);
chrome.chromeosInfoPrivate.set('a11ySpokenFeedbackEnabled', true); chrome.chromeosInfoPrivate.set('a11ySpokenFeedbackEnabled', true);
chrome.chromeosInfoPrivate.set('a11yHighContrastEnabled', true); chrome.chromeosInfoPrivate.set('a11yHighContrastEnabled', true);
chrome.chromeosInfoPrivate.set('a11yScreenMagnifierEnabled', true); chrome.chromeosInfoPrivate.set('a11yScreenMagnifierEnabled', true);
chrome.chromeosInfoPrivate.set('a11yAutoClickEnabled', true); chrome.chromeosInfoPrivate.set('a11yAutoClickEnabled', true);
chrome.chromeosInfoPrivate.set('sendFunctionKeys', true);
chrome.chromeosInfoPrivate.get( chrome.chromeosInfoPrivate.get(
['a11yLargeCursorEnabled', ['a11yLargeCursorEnabled',
'a11yStickyKeysEnabled', 'a11yStickyKeysEnabled',
'a11ySpokenFeedbackEnabled', 'a11ySpokenFeedbackEnabled',
'a11yHighContrastEnabled', 'a11yHighContrastEnabled',
'a11yScreenMagnifierEnabled', 'a11yScreenMagnifierEnabled',
'a11yAutoClickEnabled'], 'a11yAutoClickEnabled',
'sendFunctionKeys'],
pass( pass(
function(values) { function(values) {
chrome.test.assertEq(values['a11yLargeCursorEnabled'], true); chrome.test.assertEq(values['a11yLargeCursorEnabled'], true);
...@@ -90,6 +92,7 @@ function a11ySetTest() { ...@@ -90,6 +92,7 @@ function a11ySetTest() {
chrome.test.assertEq(values['a11yHighContrastEnabled'], true); chrome.test.assertEq(values['a11yHighContrastEnabled'], true);
chrome.test.assertEq(values['a11yScreenMagnifierEnabled'], true); chrome.test.assertEq(values['a11yScreenMagnifierEnabled'], true);
chrome.test.assertEq(values['a11yAutoClickEnabled'], true); chrome.test.assertEq(values['a11yAutoClickEnabled'], true);
chrome.test.assertEq(values['sendFunctionKeys'], true);
} }
)); ));
} }
...@@ -106,11 +109,12 @@ var tests = generateTestsForKeys(['hwid', ...@@ -106,11 +109,12 @@ var tests = generateTestsForKeys(['hwid',
'a11yHighContrastEnabled', 'a11yHighContrastEnabled',
'a11yScreenMagnifierEnabled', 'a11yScreenMagnifierEnabled',
'a11yAutoClickEnabled', 'a11yAutoClickEnabled',
'sendFunctionKeys',
'timezone', 'timezone',
'supportedTimezones']) 'supportedTimezones'])
// Add chrome.chromeosInfoPrivate.set() test. // Add chrome.chromeosInfoPrivate.set() test.
tests.push(timezoneSetTest); tests.push(timezoneSetTest);
tests.push(a11ySetTest); tests.push(prefsTest);
chrome.test.runTests(tests); 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