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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_view.mm

Issue 2743993003: cocoa: add experimental tabstrip keyboard focus support (Closed)
Patch Set: fix histogram Created 3 years, 9 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
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_controller.mm ('k') | chrome/common/chrome_features.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tabs/tab_view.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.mm b/chrome/browser/ui/cocoa/tabs/tab_view.mm
index 3804cfa6e64268254a1c1f0da9010bfc88d5640b..bb9175af9f5677a3e63c981354514038b24dce2a 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_view.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_view.mm
@@ -4,6 +4,7 @@
#import "chrome/browser/ui/cocoa/tabs/tab_view.h"
+#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/mac/sdk_forward_declarations.h"
@@ -16,6 +17,7 @@
#import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h"
#import "chrome/browser/ui/cocoa/themed_window.h"
#import "chrome/browser/ui/cocoa/view_id_util.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/grit/theme_resources.h"
#include "skia/ext/skia_utils_mac.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMFadeTruncatingTextFieldCell.h"
@@ -33,6 +35,10 @@
// The color of the icons in dark mode theme.
const SkColor kDarkModeIconColor = SkColorSetARGB(0xFF, 0xC4, 0xC4, 0xC4);
+bool IsTabStripKeyboardFocusEnabled() {
+ return base::FeatureList::IsEnabled(features::kTabStripKeyboardFocus);
+}
+
} // namespace
// The amount of time in seconds during which each type of glow increases, holds
@@ -789,6 +795,27 @@ - (void)windowDidChangeActive {
[self setNeedsDisplay:YES];
}
+- (BOOL)acceptsFirstResponder {
+ return IsTabStripKeyboardFocusEnabled() ? YES : NO;
+}
+
+- (BOOL)becomeFirstResponder {
+ return IsTabStripKeyboardFocusEnabled() ? YES : NO;
+}
+
+- (void)drawFocusRingMask {
+ if (!IsTabStripKeyboardFocusEnabled())
+ return;
+ if ([titleView_ isHidden])
+ NSRectFill([self bounds]);
+ else
+ NSRectFill([titleView_ frame]);
+}
+
+- (NSRect)focusRingMaskBounds {
+ return [self bounds];
+}
+
@end // @implementation TabView
@implementation TabView (TabControllerInterface)
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_controller.mm ('k') | chrome/common/chrome_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698