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

Unified Diff: chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm

Issue 2666523002: Allow permission bubbles to participate in key event dispatch as if they were a Browser. (Closed)
Patch Set: comments, fix permission->type missed in a refactor Created 3 years, 11 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/website_settings/permission_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
index da462e64d86616263174dbfbc377ca8a2ed45a78..79974b03677e5df050637a490e8ea305ef21550b 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
@@ -142,37 +142,6 @@ const NSInteger kFullscreenLeftOffset = 40;
@end
-// The window used for the permission bubble controller.
-// Subclassed to allow browser-handled keyboard events to be passed from the
-// permission bubble to its parent window, which is a browser window.
-@interface PermissionBubbleWindow : InfoBubbleWindow
-@end
-
-@implementation PermissionBubbleWindow
-- (BOOL)performKeyEquivalent:(NSEvent*)event {
- // Before forwarding to parent, handle locally.
- if ([super performKeyEquivalent:event])
- return YES;
-
- // Only handle events if they should be forwarded to the parent window.
- if ([self allowShareParentKeyState]) {
- content::NativeWebKeyboardEvent wrappedEvent(event);
- if ([BrowserWindowUtils shouldHandleKeyboardEvent:wrappedEvent]) {
- // Turn off sharing of key window state while the keyboard event is
- // processed. This avoids recursion - with the key window state shared,
- // the parent window would just forward the event back to this class.
- [self setAllowShareParentKeyState:NO];
- BOOL eventHandled =
- [BrowserWindowUtils handleKeyboardEvent:event
- inWindow:[self parentWindow]];
- [self setAllowShareParentKeyState:YES];
- return eventHandled;
- }
- }
- return NO;
-}
-@end
-
@interface PermissionBubbleController ()
// Determines if the bubble has an anchor in a corner or no anchor at all.
@@ -239,12 +208,12 @@ const NSInteger kFullscreenLeftOffset = 40;
DCHECK(browser);
DCHECK(bridge);
browser_ = browser;
- base::scoped_nsobject<PermissionBubbleWindow> window(
- [[PermissionBubbleWindow alloc]
- initWithContentRect:ui::kWindowSizeDeterminedLater
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:NO]);
+ base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc]
+ initWithContentRect:ui::kWindowSizeDeterminedLater
+ styleMask:NSBorderlessWindowMask
+ backing:NSBackingStoreBuffered
+ defer:NO]);
+
[window setAllowedAnimations:info_bubble::kAnimateNone];
[window setReleasedWhenClosed:NO];
if ((self = [super initWithWindow:window
« no previous file with comments | « chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa_interactive_uitest.mm ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698