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

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

Issue 659233002: STASH: Epic Experimental patch for toolkit-views App List on Mac Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Fix a few things. Works@master 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_impl.cc ('k') | content/public/browser/content_browser_client.h » ('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 c27c9927397f02c273ef4721495a1a56ad8db365..853955e4ab23c2b6f3d9336418368217a0a165fe 100644
--- a/content/browser/web_contents/web_contents_view_mac.mm
+++ b/content/browser/web_contents/web_contents_view_mac.mm
@@ -159,6 +159,9 @@ void WebContentsViewMac::SizeContents(const gfx::Size& size) {
}
void WebContentsViewMac::Focus() {
+ if (delegate_ && delegate_->Focus())
+ return;
+
NSWindow* window = [cocoa_view_.get() window];
[window makeFirstResponder:GetContentNativeView()];
if (![window isVisible])
@@ -176,6 +179,10 @@ void WebContentsViewMac::SetInitialFocus() {
void WebContentsViewMac::StoreFocus() {
// We're explicitly being asked to store focus, so don't worry if there's
// already a view saved.
+ focus_tracker_.reset();
+ if (delegate_ && delegate_->StoreFocus())
+ return;
+
focus_tracker_.reset(
[[FocusTracker alloc] initWithWindow:[cocoa_view_ window]]);
}
@@ -183,6 +190,9 @@ void WebContentsViewMac::StoreFocus() {
void WebContentsViewMac::RestoreFocus() {
// TODO(avi): Could we be restoring a view that's no longer in the key view
// chain?
+ if (delegate_ && delegate_->RestoreFocus())
+ return;
+
if (!(focus_tracker_.get() &&
[focus_tracker_ restoreFocusInWindow:[cocoa_view_ window]])) {
// Fall back to the default focus behavior if we could not restore focus.
@@ -212,6 +222,9 @@ void WebContentsViewMac::GotFocus() {
// This is called when the renderer asks us to take focus back (i.e., it has
// iterated past the last focusable element on the page).
void WebContentsViewMac::TakeFocus(bool reverse) {
+ if (delegate_ && delegate_->TakeFocus(reverse))
+ return;
+
if (reverse) {
[[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()];
} else {
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698