Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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()) { |
|
sky
2011/11/28 23:36:08
This seems fine, but I wonder why we don't have it
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |