Index: chrome/browser/ui/views/frame/browser_view.cc |
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc |
index 0dc58c7a66de814403a1c0ac66f649707a117531..b39783fb509d5e73454ee3f535cc97c7b86c0154 100644 |
--- a/chrome/browser/ui/views/frame/browser_view.cc |
+++ b/chrome/browser/ui/views/frame/browser_view.cc |
@@ -113,6 +113,7 @@ |
#include "components/signin/core/common/profile_management_switches.h" |
#include "components/translate/core/browser/language_state.h" |
#include "content/public/browser/download_manager.h" |
+#include "content/public/browser/keyboard_event_processing_result.h" |
#include "content/public/browser/notification_service.h" |
#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/render_view_host.h" |
@@ -1306,20 +1307,18 @@ void BrowserView::ShowAppMenu() { |
toolbar_->app_menu_button()->Activate(nullptr); |
} |
-bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
- bool* is_keyboard_shortcut) { |
- *is_keyboard_shortcut = false; |
- |
+content::KeyboardEventProcessingResult BrowserView::PreHandleKeyboardEvent( |
+ const NativeWebKeyboardEvent& event) { |
if ((event.type() != blink::WebInputEvent::RawKeyDown) && |
(event.type() != blink::WebInputEvent::KeyUp)) { |
- return false; |
+ return content::KeyboardEventProcessingResult::NOT_HANDLED; |
} |
views::FocusManager* focus_manager = GetFocusManager(); |
DCHECK(focus_manager); |
if (focus_manager->shortcut_handling_suspended()) |
- return false; |
+ return content::KeyboardEventProcessingResult::NOT_HANDLED; |
ui::Accelerator accelerator = |
ui::GetAcceleratorFromNativeWebKeyboardEvent(event); |
@@ -1337,22 +1336,22 @@ bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
if (browser_->is_app()) { |
// Let all keys fall through to a v1 app's web content, even accelerators. |
- // We don't have to flip |is_keyboard_shortcut| here. If we do that, the app |
+ // We don't use NOT_HANDLED_IS_SHORTCUT here. If we do that, the app |
// might not be able to see a subsequent Char event. See OnHandleInputEvent |
// in content/renderer/render_widget.cc for details. |
- return false; |
+ return content::KeyboardEventProcessingResult::NOT_HANDLED; |
} |
#if defined(OS_CHROMEOS) |
if (ash_util::IsAcceleratorDeprecated(accelerator)) { |
- if (event.type() == blink::WebInputEvent::RawKeyDown) |
- *is_keyboard_shortcut = true; |
- return false; |
+ return (event.type() == blink::WebInputEvent::RawKeyDown) |
+ ? content::KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT |
+ : content::KeyboardEventProcessingResult::NOT_HANDLED; |
} |
#endif // defined(OS_CHROMEOS) |
if (frame_->PreHandleKeyboardEvent(event)) |
- return true; |
+ return content::KeyboardEventProcessingResult::HANDLED; |
chrome::BrowserCommandController* controller = browser_->command_controller(); |
@@ -1374,20 +1373,25 @@ bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
// Executing the command may cause |this| object to be destroyed. |
if (controller->IsReservedCommandOrKey(id, event)) { |
UpdateAcceleratorMetrics(accelerator, id); |
- return chrome::ExecuteCommand(browser_.get(), id); |
+ return chrome::ExecuteCommand(browser_.get(), id) |
+ ? content::KeyboardEventProcessingResult::HANDLED |
+ : content::KeyboardEventProcessingResult::NOT_HANDLED; |
} |
if (id != -1) { |
// |accelerator| is a non-reserved browser shortcut (e.g. Ctrl+f). |
- if (event.type() == blink::WebInputEvent::RawKeyDown) |
- *is_keyboard_shortcut = true; |
- } else if (processed) { |
+ return (event.type() == blink::WebInputEvent::RawKeyDown) |
+ ? content::KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT |
+ : content::KeyboardEventProcessingResult::NOT_HANDLED; |
+ } |
+ |
+ if (processed) { |
// |accelerator| is a non-browser shortcut (e.g. F4-F10 on Ash). Report |
// that we handled it. |
- return true; |
+ return content::KeyboardEventProcessingResult::HANDLED; |
} |
- return false; |
+ return content::KeyboardEventProcessingResult::NOT_HANDLED; |
} |
void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |