| 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 {
|
|
|