Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #import "content/browser/web_contents/web_contents_view_mac.h" | 7 #import "content/browser/web_contents/web_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 return rwhv ? rwhv->GetNativeView() : nil; | 176 return rwhv ? rwhv->GetNativeView() : nil; |
| 177 } | 177 } |
| 178 | 178 |
| 179 void WebContentsViewMac::Focus() { | 179 void WebContentsViewMac::Focus() { |
| 180 gfx::NativeView native_view = GetNativeViewForFocus(); | 180 gfx::NativeView native_view = GetNativeViewForFocus(); |
| 181 NSWindow* window = [native_view window]; | 181 NSWindow* window = [native_view window]; |
| 182 [window makeFirstResponder:native_view]; | 182 [window makeFirstResponder:native_view]; |
| 183 if (![window isVisible]) | 183 if (![window isVisible]) |
| 184 return; | 184 return; |
| 185 [window makeKeyAndOrderFront:nil]; | 185 [window makeKeyAndOrderFront:nil]; |
| 186 web_contents_->NotifyWebContentsFocused(); | |
|
tapted
2016/05/27 11:50:37
I don't think this is the right place for it. Aura
Avi (use Gerrit)
2016/05/27 15:42:36
Agreed.
I'm trusting in the Views people that plu
yamaxim
2016/05/30 12:32:38
I wrap it with GotFocus, if you can say a better p
| |
| 186 } | 187 } |
| 187 | 188 |
| 188 void WebContentsViewMac::SetInitialFocus() { | 189 void WebContentsViewMac::SetInitialFocus() { |
| 189 if (web_contents_->FocusLocationBarByDefault()) | 190 if (web_contents_->FocusLocationBarByDefault()) |
| 190 web_contents_->SetFocusToLocationBar(false); | 191 web_contents_->SetFocusToLocationBar(false); |
| 191 else | 192 else |
| 192 Focus(); | 193 Focus(); |
| 193 } | 194 } |
| 194 | 195 |
| 195 void WebContentsViewMac::StoreFocus() { | 196 void WebContentsViewMac::StoreFocus() { |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 | 680 |
| 680 - (void)viewDidHide { | 681 - (void)viewDidHide { |
| 681 [self updateWebContentsVisibility]; | 682 [self updateWebContentsVisibility]; |
| 682 } | 683 } |
| 683 | 684 |
| 684 - (void)viewDidUnhide { | 685 - (void)viewDidUnhide { |
| 685 [self updateWebContentsVisibility]; | 686 [self updateWebContentsVisibility]; |
| 686 } | 687 } |
| 687 | 688 |
| 688 @end | 689 @end |
| OLD | NEW |