Commit ca0e9998 authored by sadrul's avatar sadrul Committed by Commit bot

ash: Remove WindowState::top_row_keys_are_function_keys.

This code has been dead since 2014 when its only use was removed
(crrev.com/251421). So remove the code.

BUG=none

Review-Url: https://codereview.chromium.org/2163223004
Cr-Commit-Position: refs/heads/master@{#406703}
parent eea862d5
...@@ -305,7 +305,6 @@ WindowState::WindowState(WmWindow* window) ...@@ -305,7 +305,6 @@ WindowState::WindowState(WmWindow* window)
panel_attached_(true), panel_attached_(true),
ignored_by_shelf_(false), ignored_by_shelf_(false),
can_consume_system_keys_(false), can_consume_system_keys_(false),
top_row_keys_are_function_keys_(false),
unminimize_to_restore_bounds_(false), unminimize_to_restore_bounds_(false),
in_immersive_fullscreen_(false), in_immersive_fullscreen_(false),
hide_shelf_when_fullscreen_(true), hide_shelf_when_fullscreen_(true),
......
...@@ -269,15 +269,6 @@ class ASH_EXPORT WindowState { ...@@ -269,15 +269,6 @@ class ASH_EXPORT WindowState {
can_consume_system_keys_ = can_consume_system_keys; can_consume_system_keys_ = can_consume_system_keys;
} }
// True if this window has requested that the top-row keys (back, forward,
// brightness, volume) should be treated as function keys.
bool top_row_keys_are_function_keys() const {
return top_row_keys_are_function_keys_;
}
void set_top_row_keys_are_function_keys(bool value) {
top_row_keys_are_function_keys_ = value;
}
// True if the window is in "immersive full screen mode" which is slightly // True if the window is in "immersive full screen mode" which is slightly
// different from the normal fullscreen mode by allowing the user to reveal // different from the normal fullscreen mode by allowing the user to reveal
// the top portion of the window through a touch / mouse gesture. It might // the top portion of the window through a touch / mouse gesture. It might
...@@ -375,7 +366,6 @@ class ASH_EXPORT WindowState { ...@@ -375,7 +366,6 @@ class ASH_EXPORT WindowState {
bool panel_attached_; bool panel_attached_;
bool ignored_by_shelf_; bool ignored_by_shelf_;
bool can_consume_system_keys_; bool can_consume_system_keys_;
bool top_row_keys_are_function_keys_;
std::unique_ptr<DragDetails> drag_details_; std::unique_ptr<DragDetails> drag_details_;
bool unminimize_to_restore_bounds_; bool unminimize_to_restore_bounds_;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "ash/common/wm/window_state.h" #include "ash/common/wm/window_state.h"
#include "ash/sticky_keys/sticky_keys_controller.h" #include "ash/sticky_keys/sticky_keys_controller.h"
#include "ash/wm/window_state_aura.h"
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
...@@ -425,12 +424,8 @@ bool EventRewriter::IsLastKeyboardOfType(DeviceType device_type) const { ...@@ -425,12 +424,8 @@ bool EventRewriter::IsLastKeyboardOfType(DeviceType device_type) const {
bool EventRewriter::TopRowKeysAreFunctionKeys(const ui::KeyEvent& event) const { bool EventRewriter::TopRowKeysAreFunctionKeys(const ui::KeyEvent& event) const {
const PrefService* prefs = GetPrefService(); const PrefService* prefs = GetPrefService();
if (prefs && prefs->FindPreference(prefs::kLanguageSendFunctionKeys) && return prefs && prefs->FindPreference(prefs::kLanguageSendFunctionKeys) &&
prefs->GetBoolean(prefs::kLanguageSendFunctionKeys)) prefs->GetBoolean(prefs::kLanguageSendFunctionKeys);
return true;
ash::wm::WindowState* state = ash::wm::GetActiveWindowState();
return state ? state->top_row_keys_are_function_keys() : false;
} }
int EventRewriter::GetRemappedModifierMasks(const PrefService& pref_service, int EventRewriter::GetRemappedModifierMasks(const PrefService& pref_service,
......
...@@ -1996,25 +1996,12 @@ TEST_F(EventRewriterAshTest, TopRowKeysAreFunctionKeys) { ...@@ -1996,25 +1996,12 @@ TEST_F(EventRewriterAshTest, TopRowKeysAreFunctionKeys) {
ui::KeyEvent press_f1(ui::ET_KEY_PRESSED, ui::VKEY_F1, ui::DomCode::F1, ui::KeyEvent press_f1(ui::ET_KEY_PRESSED, ui::VKEY_F1, ui::DomCode::F1,
ui::EF_NONE, ui::DomKey::F1, ui::EventTimeForNow()); ui::EF_NONE, ui::DomKey::F1, ui::EventTimeForNow());
// Simulate an apps v2 window that has requested top row keys as function
// keys. The event should not be rewritten.
window_state->set_top_row_keys_are_function_keys(true);
ui::EventDispatchDetails details = Send(&press_f1);
ASSERT_FALSE(details.dispatcher_destroyed);
PopEvents(&events);
EXPECT_EQ(1u, events.size());
EXPECT_EQ(
GetExpectedResultAsString(ui::ET_KEY_PRESSED, ui::VKEY_F1,
ui::DomCode::F1, ui::EF_NONE, ui::DomKey::F1),
GetKeyEventAsString(*static_cast<ui::KeyEvent*>(events[0])));
// The event should also not be rewritten if the send-function-keys pref is // The event should also not be rewritten if the send-function-keys pref is
// additionally set, for both apps v2 and regular windows. // additionally set, for both apps v2 and regular windows.
BooleanPrefMember send_function_keys_pref; BooleanPrefMember send_function_keys_pref;
send_function_keys_pref.Init(prefs::kLanguageSendFunctionKeys, prefs()); send_function_keys_pref.Init(prefs::kLanguageSendFunctionKeys, prefs());
send_function_keys_pref.SetValue(true); send_function_keys_pref.SetValue(true);
window_state->set_top_row_keys_are_function_keys(false); ui::EventDispatchDetails details = Send(&press_f1);
details = Send(&press_f1);
ASSERT_FALSE(details.dispatcher_destroyed); ASSERT_FALSE(details.dispatcher_destroyed);
PopEvents(&events); PopEvents(&events);
EXPECT_EQ(1u, events.size()); EXPECT_EQ(1u, events.size());
......
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