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

Unified Diff: chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm

Issue 642143004: [Cocoa] Make TabContentsContainerView more testable for interactive_ui_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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/browser_focus_uitest.cc ('k') | chrome/test/base/interactive_test_utils_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm
diff --git a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm
index a54c6ac70ef0d900050ad4e950e941789ffd65b9..3963d871a73b35f6ff9b8753ee57abdce33007fd 100644
--- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm
@@ -12,6 +12,7 @@
#import "chrome/browser/themes/theme_properties.h"
#import "chrome/browser/themes/theme_service.h"
#import "chrome/browser/ui/cocoa/themed_window.h"
+#include "chrome/browser/ui/view_ids.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
@@ -165,6 +166,28 @@ class FullscreenObserver : public WebContentsObserver {
[[self layer] setBackgroundColor:cgBackgroundColor];
}
+- (ViewID)viewID {
+ return VIEW_ID_TAB_CONTAINER;
+}
+
+- (BOOL)acceptsFirstResponder {
+ return [[self subviews] count] > 0 &&
+ [[[self subviews] objectAtIndex:0] acceptsFirstResponder];
+}
+
+// When receiving a click-to-focus in the solid color area surrounding the
+// WebContents' native view, immediately transfer focus to WebContents' native
+// view.
+- (BOOL)becomeFirstResponder {
+ if (![self acceptsFirstResponder])
+ return NO;
+ return [[self window] makeFirstResponder:[[self subviews] objectAtIndex:0]];
+}
+
+- (BOOL)canBecomeKeyView {
+ return NO; // Tab/Shift-Tab should focus the subview, not this view.
+}
+
@end // @implementation TabContentsContainerView
@implementation TabContentsController
« no previous file with comments | « chrome/browser/ui/browser_focus_uitest.cc ('k') | chrome/test/base/interactive_test_utils_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698