| 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/tab_contents_view_views.h" | 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/ui/constrained_window.h" | 10 #include "chrome/browser/ui/constrained_window.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 views::View* last_focused_view = | 211 views::View* last_focused_view = |
| 212 view_storage->RetrieveView(last_focused_view_storage_id_); | 212 view_storage->RetrieveView(last_focused_view_storage_id_); |
| 213 | 213 |
| 214 if (!last_focused_view) { | 214 if (!last_focused_view) { |
| 215 SetInitialFocus(); | 215 SetInitialFocus(); |
| 216 } else { | 216 } else { |
| 217 views::FocusManager* focus_manager = GetFocusManager(); | 217 views::FocusManager* focus_manager = GetFocusManager(); |
| 218 // If you hit this DCHECK, please report it to Jay (jcampan). | 218 // If you hit this DCHECK, please report it to Jay (jcampan). |
| 219 DCHECK(focus_manager != NULL) << "No focus manager when restoring focus."; | 219 DCHECK(focus_manager != NULL) << "No focus manager when restoring focus."; |
| 220 | 220 |
| 221 if (last_focused_view->IsFocusableInRootView() && focus_manager && | 221 if (last_focused_view->IsFocusable() && focus_manager && |
| 222 focus_manager->ContainsView(last_focused_view)) { | 222 focus_manager->ContainsView(last_focused_view)) { |
| 223 last_focused_view->RequestFocus(); | 223 last_focused_view->RequestFocus(); |
| 224 } else { | 224 } else { |
| 225 // The focused view may not belong to the same window hierarchy (e.g. | 225 // The focused view may not belong to the same window hierarchy (e.g. |
| 226 // if the location bar was focused and the tab is dragged out), or it may | 226 // if the location bar was focused and the tab is dragged out), or it may |
| 227 // no longer be focusable (e.g. if the location bar was focused and then | 227 // no longer be focusable (e.g. if the location bar was focused and then |
| 228 // we switched to fullscreen mode). In that case we default to the | 228 // we switched to fullscreen mode). In that case we default to the |
| 229 // default focus. | 229 // default focus. |
| 230 SetInitialFocus(); | 230 SetInitialFocus(); |
| 231 } | 231 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 tab_contents_->HideContents(); | 458 tab_contents_->HideContents(); |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 | 461 |
| 462 void TabContentsViewViews::OnNativeWidgetSizeChanged( | 462 void TabContentsViewViews::OnNativeWidgetSizeChanged( |
| 463 const gfx::Size& new_size) { | 463 const gfx::Size& new_size) { |
| 464 if (overlaid_view_) | 464 if (overlaid_view_) |
| 465 overlaid_view_->SetBounds(gfx::Rect(new_size)); | 465 overlaid_view_->SetBounds(gfx::Rect(new_size)); |
| 466 views::Widget::OnNativeWidgetSizeChanged(new_size); | 466 views::Widget::OnNativeWidgetSizeChanged(new_size); |
| 467 } | 467 } |
| OLD | NEW |