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

Unified Diff: content/browser/web_contents/web_contents_view_mac.mm

Issue 670653005: Fix Flash fullscreen focus regressions, and add interactive_ui_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove consts in ObjC code. 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 | « content/browser/web_contents/web_contents_view_mac.h ('k') | ppapi/ppapi_sources.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_view_mac.mm
diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm
index 6e883b60db92581376da5041593be6a5edb5438b..42348a97bca9cd9c2c15006740f5fcafc521d603 100644
--- a/content/browser/web_contents/web_contents_view_mac.mm
+++ b/content/browser/web_contents/web_contents_view_mac.mm
@@ -158,9 +158,18 @@ void WebContentsViewMac::SizeContents(const gfx::Size& size) {
// previous implementation.
}
+gfx::NativeView WebContentsViewMac::GetNativeViewForFocus() const {
+ RenderWidgetHostView* rwhv =
+ web_contents_->GetFullscreenRenderWidgetHostView();
+ if (!rwhv)
+ rwhv = web_contents_->GetRenderWidgetHostView();
+ return rwhv ? rwhv->GetNativeView() : nil;
+}
+
void WebContentsViewMac::Focus() {
- NSWindow* window = [cocoa_view_.get() window];
- [window makeFirstResponder:GetContentNativeView()];
+ gfx::NativeView native_view = GetNativeViewForFocus();
+ NSWindow* window = [native_view window];
+ [window makeFirstResponder:native_view];
if (![window isVisible])
return;
[window makeKeyAndOrderFront:nil];
@@ -170,21 +179,23 @@ void WebContentsViewMac::SetInitialFocus() {
if (web_contents_->FocusLocationBarByDefault())
web_contents_->SetFocusToLocationBar(false);
else
- [[cocoa_view_.get() window] makeFirstResponder:GetContentNativeView()];
+ Focus();
}
void WebContentsViewMac::StoreFocus() {
+ gfx::NativeView native_view = GetNativeViewForFocus();
// We're explicitly being asked to store focus, so don't worry if there's
// already a view saved.
focus_tracker_.reset(
- [[FocusTracker alloc] initWithWindow:[cocoa_view_ window]]);
+ [[FocusTracker alloc] initWithWindow:[native_view window]]);
}
void WebContentsViewMac::RestoreFocus() {
+ gfx::NativeView native_view = GetNativeViewForFocus();
// TODO(avi): Could we be restoring a view that's no longer in the key view
// chain?
if (!(focus_tracker_.get() &&
- [focus_tracker_ restoreFocusInWindow:[cocoa_view_ window]])) {
+ [focus_tracker_ restoreFocusInWindow:[native_view window]])) {
// Fall back to the default focus behavior if we could not restore focus.
// TODO(shess): If location-bar gets focus by default, this will
// select-all in the field. If there was a specific selection in
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.h ('k') | ppapi/ppapi_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698