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

Side by Side Diff: content/browser/web_contents/web_contents_view_mac.mm

Issue 2005953002: [mac][views] Notify web_contents focused. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 GotFocus();
Avi (use Gerrit) 2016/05/30 16:13:33 Should this be necessary? RenderViewHostImpl::Ren
yamaxim 2016/05/30 16:57:21 It's not called for mac_views because WebContentsV
tapted 2016/05/31 12:01:50 So I think we want this to be triggered by -[Rende
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 25 matching lines...) Expand all
221 return [cocoa_view_ dropData]; 222 return [cocoa_view_ dropData];
222 } 223 }
223 224
224 void WebContentsViewMac::UpdateDragCursor(WebDragOperation operation) { 225 void WebContentsViewMac::UpdateDragCursor(WebDragOperation operation) {
225 [cocoa_view_ setCurrentDragOperation: operation]; 226 [cocoa_view_ setCurrentDragOperation: operation];
226 } 227 }
227 228
228 void WebContentsViewMac::GotFocus() { 229 void WebContentsViewMac::GotFocus() {
229 // This is only used in the views FocusManager stuff but it bleeds through 230 // This is only used in the views FocusManager stuff but it bleeds through
230 // all subclasses. http://crbug.com/21875 231 // all subclasses. http://crbug.com/21875
232 web_contents_->NotifyWebContentsFocused();
231 } 233 }
232 234
233 // This is called when the renderer asks us to take focus back (i.e., it has 235 // This is called when the renderer asks us to take focus back (i.e., it has
234 // iterated past the last focusable element on the page). 236 // iterated past the last focusable element on the page).
235 void WebContentsViewMac::TakeFocus(bool reverse) { 237 void WebContentsViewMac::TakeFocus(bool reverse) {
236 if (reverse) { 238 if (reverse) {
237 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()]; 239 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()];
238 } else { 240 } else {
239 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()]; 241 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()];
240 } 242 }
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 681
680 - (void)viewDidHide { 682 - (void)viewDidHide {
681 [self updateWebContentsVisibility]; 683 [self updateWebContentsVisibility];
682 } 684 }
683 685
684 - (void)viewDidUnhide { 686 - (void)viewDidUnhide {
685 [self updateWebContentsVisibility]; 687 [self updateWebContentsVisibility];
686 } 688 }
687 689
688 @end 690 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698