Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 2874313002: Fix is_browser_shortcut; add a test.
Patch Set: SendKeyPressSync Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index 3ddde63bcce6dc21dcdc039133f8898c510d971f..d9cc8b301968ee882bea91803d0b6be6bd6f8913 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/debug/stack_trace.h"
#include "base/logging.h"
#import "base/mac/sdk_forward_declarations.h"
#include "base/message_loop/message_loop.h"
@@ -582,32 +583,41 @@ void BrowserWindowCocoa::ShowAppMenu() {
content::KeyboardEventProcessingResult
BrowserWindowCocoa::PreHandleKeyboardEvent(
const NativeWebKeyboardEvent& event) {
+ base::debug::StackTrace s;
+ LOG(ERROR) << "BrowserWindowCocoa::PreHandleKeyboardEvent\n" << s.ToString();
// Handle ESC to dismiss permission bubbles, but still forward it
// to the window afterwards.
if (event.windows_key_code == ui::VKEY_ESCAPE)
[controller_ dismissPermissionBubble];
- if (![BrowserWindowUtils shouldHandleKeyboardEvent:event])
+ if (![BrowserWindowUtils shouldHandleKeyboardEvent:event]) {
+ LOG(ERROR) << " > early exit; shouldn't handle event";
return content::KeyboardEventProcessingResult::NOT_HANDLED;
+ }
if (event.GetType() == blink::WebInputEvent::kRawKeyDown &&
[controller_
handledByExtensionCommand:event.os_event
- priority:ui::AcceleratorManager::kHighPriority])
+ priority:ui::AcceleratorManager::kHighPriority]) {
+ LOG(ERROR) << " > handled by extension command";
return content::KeyboardEventProcessingResult::HANDLED;
+ }
int id = [BrowserWindowUtils getCommandId:event];
- if (id == -1)
+ if (id == -1) {
+ LOG(ERROR) << " > not handled; no command id";
return content::KeyboardEventProcessingResult::NOT_HANDLED;
+ }
if (browser_->command_controller()->IsReservedCommandOrKey(id, event)) {
using Result = content::KeyboardEventProcessingResult;
- return [BrowserWindowUtils handleKeyboardEvent:event.os_event
- inWindow:window()]
- ? Result::HANDLED
- : Result::NOT_HANDLED;
+ bool result = [BrowserWindowUtils handleKeyboardEvent:event.os_event
+ inWindow:window()];
+ LOG(ERROR) << " > handleKeyboardEvent: returned " << result;
+ return result ? Result::HANDLED : Result::NOT_HANDLED;
}
+ LOG(ERROR) << " > returning default";
return content::KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT;
}
« no previous file with comments | « chrome/browser/browser_keyevents_browsertest.cc ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698