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

Side by Side Diff: chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc

Issue 8659014: Check that we have a focus manager in aura before trying to set focus. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update, add print preview handler unittest also, same fix. Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview_handler_unittest.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_aur a.h" 5 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_aur a.h"
6 6
7 #include "chrome/browser/ui/view_ids.h" 7 #include "chrome/browser/ui/view_ids.h"
8 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" 8 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
9 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" 9 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
10 #include "content/browser/tab_contents/interstitial_page.h" 10 #include "content/browser/tab_contents/interstitial_page.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 void NativeTabContentsContainerAura::RequestFocus() { 108 void NativeTabContentsContainerAura::RequestFocus() {
109 // This is a hack to circumvent the fact that a the OnFocus() method is not 109 // This is a hack to circumvent the fact that a the OnFocus() method is not
110 // invoked when RequestFocus() is called on an already focused view. 110 // invoked when RequestFocus() is called on an already focused view.
111 // The TabContentsContainer is the view focused when the TabContents has 111 // The TabContentsContainer is the view focused when the TabContents has
112 // focus. When switching between from one tab that has focus to another tab 112 // focus. When switching between from one tab that has focus to another tab
113 // that should also have focus, RequestFocus() is invoked one the 113 // that should also have focus, RequestFocus() is invoked one the
114 // TabContentsContainer. In order to make sure OnFocus() is invoked we need 114 // TabContentsContainer. In order to make sure OnFocus() is invoked we need
115 // to clear the focus before hands. 115 // to clear the focus before hands.
116 { 116 if (GetFocusManager()) {
117 // Disable notifications. Clear focus will assign the focus to the main 117 // Disable notifications. Clear focus will assign the focus to the main
118 // browser window. Because this change of focus was not user requested, 118 // browser window. Because this change of focus was not user requested,
119 // don't send it to listeners. 119 // don't send it to listeners.
120 views::AutoNativeNotificationDisabler local_notification_disabler; 120 views::AutoNativeNotificationDisabler local_notification_disabler;
121 GetFocusManager()->ClearFocus(); 121 GetFocusManager()->ClearFocus();
122 } 122 }
123 View::RequestFocus(); 123 View::RequestFocus();
124 } 124 }
125 125
126 void NativeTabContentsContainerAura::AboutToRequestFocusFromTabTraversal( 126 void NativeTabContentsContainerAura::AboutToRequestFocusFromTabTraversal(
(...skipping 14 matching lines...) Expand all
141 } 141 }
142 142
143 //////////////////////////////////////////////////////////////////////////////// 143 ////////////////////////////////////////////////////////////////////////////////
144 // NativeTabContentsContainer, public: 144 // NativeTabContentsContainer, public:
145 145
146 // static 146 // static
147 NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer( 147 NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer(
148 TabContentsContainer* container) { 148 TabContentsContainer* container) {
149 return new NativeTabContentsContainerAura(container); 149 return new NativeTabContentsContainerAura(container);
150 } 150 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698