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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 8 years, 9 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 | Annotate | Revision Log
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 "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 5 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/scoped_nsobject.h" 9 #include "base/memory/scoped_nsobject.h"
10 #include "content/browser/renderer_host/render_view_host.h" 10 #include "content/browser/renderer_host/render_view_host.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // We're the current tab if we're in the view hierarchy, otherwise some other 71 // We're the current tab if we're in the view hierarchy, otherwise some other
72 // tab is. 72 // tab is.
73 return [[self view] superview] ? YES : NO; 73 return [[self view] superview] ? YES : NO;
74 } 74 }
75 75
76 - (void)willBecomeUnselectedTab { 76 - (void)willBecomeUnselectedTab {
77 // The RWHV is ripped out of the view hierarchy on tab switches, so it never 77 // The RWHV is ripped out of the view hierarchy on tab switches, so it never
78 // formally resigns first responder status. Handle this by explicitly sending 78 // formally resigns first responder status. Handle this by explicitly sending
79 // a Blur() message to the renderer, but only if the RWHV currently has focus. 79 // a Blur() message to the renderer, but only if the RWHV currently has focus.
80 RenderViewHost* rvh = [self webContents]->GetRenderViewHost(); 80 RenderViewHost* rvh = [self webContents]->GetRenderViewHost();
81 if (rvh && rvh->view() && rvh->view()->HasFocus()) 81 if (rvh && rvh->GetView() && rvh->GetView()->HasFocus())
82 rvh->Blur(); 82 rvh->Blur();
83 } 83 }
84 84
85 - (void)willBecomeSelectedTab { 85 - (void)willBecomeSelectedTab {
86 // Do not explicitly call Focus() here, as the RWHV may not actually have 86 // Do not explicitly call Focus() here, as the RWHV may not actually have
87 // focus (for example, if the omnibox has focus instead). The TabContents 87 // focus (for example, if the omnibox has focus instead). The TabContents
88 // logic will restore focus to the appropriate view. 88 // logic will restore focus to the appropriate view.
89 } 89 }
90 90
91 - (void)tabDidChange:(WebContents*)updatedContents { 91 - (void)tabDidChange:(WebContents*)updatedContents {
92 // Calling setContentView: here removes any first responder status 92 // Calling setContentView: here removes any first responder status
93 // the view may have, so avoid changing the view hierarchy unless 93 // the view may have, so avoid changing the view hierarchy unless
94 // the view is different. 94 // the view is different.
95 if ([self webContents] != updatedContents) { 95 if ([self webContents] != updatedContents) {
96 contents_ = updatedContents; 96 contents_ = updatedContents;
97 [self ensureContentsVisible]; 97 [self ensureContentsVisible];
98 } 98 }
99 } 99 }
100 100
101 @end 101 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/extension_view_mac.mm ('k') | chrome/browser/ui/cocoa/tabpose_window.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698