| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/tab_contents_container_view.h" | 5 #include "chrome/browser/views/tab_contents_container_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // with tabs such as the WebContents that instruct the RenderView that it got | 131 // with tabs such as the WebContents that instruct the RenderView that it got |
| 132 // focus when they actually get the focus. When switching from one WebContents | 132 // focus when they actually get the focus. When switching from one WebContents |
| 133 // tab that has focus to another WebContents tab that had focus, since the | 133 // tab that has focus to another WebContents tab that had focus, since the |
| 134 // TabContentsContainerView already has focus, Focus() would not be called and | 134 // TabContentsContainerView already has focus, Focus() would not be called and |
| 135 // the RenderView would not get notified it got focused. | 135 // the RenderView would not get notified it got focused. |
| 136 // By clearing the focused view before-hand, we ensure Focus() will be called. | 136 // By clearing the focused view before-hand, we ensure Focus() will be called. |
| 137 GetRootView()->FocusView(NULL); | 137 GetRootView()->FocusView(NULL); |
| 138 View::RequestFocus(); | 138 View::RequestFocus(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool TabContentsContainerView::GetAccessibleRole(VARIANT* role) { | 141 bool TabContentsContainerView::GetAccessibleRole( |
| 142 AccessibilityTypes::Role* role) { |
| 142 DCHECK(role); | 143 DCHECK(role); |
| 143 | 144 |
| 144 role->vt = VT_I4; | 145 *role = AccessibilityTypes::ROLE_GROUPING; |
| 145 role->lVal = ROLE_SYSTEM_GROUPING; | |
| 146 return true; | 146 return true; |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool TabContentsContainerView::ShouldLookupAccelerators( | 149 bool TabContentsContainerView::ShouldLookupAccelerators( |
| 150 const views::KeyEvent& e) { | 150 const views::KeyEvent& e) { |
| 151 // Don't look-up accelerators if we are showing a non-crashed WebContents. | 151 // Don't look-up accelerators if we are showing a non-crashed WebContents. |
| 152 // We'll first give the page a chance to process the key events. If it does | 152 // We'll first give the page a chance to process the key events. If it does |
| 153 // not process them, they'll be returned to us and we'll treat them as | 153 // not process them, they'll be returned to us and we'll treat them as |
| 154 // accelerators then. | 154 // accelerators then. |
| 155 if (tab_contents_ && !tab_contents_->is_crashed() && | 155 if (tab_contents_ && !tab_contents_->is_crashed() && |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (focus_manager->GetFocusedView() == this) | 221 if (focus_manager->GetFocusedView() == this) |
| 222 Focus(); | 222 Focus(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void TabContentsContainerView::TabContentsDestroyed(TabContents* contents) { | 225 void TabContentsContainerView::TabContentsDestroyed(TabContents* contents) { |
| 226 // Sometimes, a TabContents is destroyed before we know about it. This allows | 226 // Sometimes, a TabContents is destroyed before we know about it. This allows |
| 227 // us to clean up our state in case this happens. | 227 // us to clean up our state in case this happens. |
| 228 DCHECK(contents == tab_contents_); | 228 DCHECK(contents == tab_contents_); |
| 229 SetTabContents(NULL); | 229 SetTabContents(NULL); |
| 230 } | 230 } |
| OLD | NEW |