| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/download/download_shelf.h" | 9 #include "chrome/browser/download/download_shelf.h" |
| 10 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 tab_contents()->interstitial_page()->Focus(); | 148 tab_contents()->interstitial_page()->Focus(); |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 | 151 |
| 152 if (tab_contents()->is_crashed() && sad_tab_ != NULL) { | 152 if (tab_contents()->is_crashed() && sad_tab_ != NULL) { |
| 153 sad_tab_->RequestFocus(); | 153 sad_tab_->RequestFocus(); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| 156 | 156 |
| 157 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); | 157 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); |
| 158 gtk_widget_grab_focus(rwhv ? rwhv->GetNativeView() : GetNativeView()); | 158 if (rwhv) |
| 159 rwhv->Focus(); |
| 159 } | 160 } |
| 160 | 161 |
| 161 void TabContentsViewViews::SetInitialFocus() { | 162 void TabContentsViewViews::SetInitialFocus() { |
| 162 if (tab_contents()->FocusLocationBarByDefault()) | 163 if (tab_contents()->FocusLocationBarByDefault()) |
| 163 tab_contents()->SetFocusToLocationBar(false); | 164 tab_contents()->SetFocusToLocationBar(false); |
| 164 else | 165 else |
| 165 Focus(); | 166 Focus(); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void TabContentsViewViews::StoreFocus() { | 169 void TabContentsViewViews::StoreFocus() { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 rwhv->SetSize(size); | 311 rwhv->SetSize(size); |
| 311 | 312 |
| 312 if (needs_resize) | 313 if (needs_resize) |
| 313 SetFloatingPosition(size); | 314 SetFloatingPosition(size); |
| 314 } | 315 } |
| 315 | 316 |
| 316 void TabContentsViewViews::SetFloatingPosition(const gfx::Size& size) { | 317 void TabContentsViewViews::SetFloatingPosition(const gfx::Size& size) { |
| 317 // TODO(anicolao): rework this once we have DOMUI views for dialogs | 318 // TODO(anicolao): rework this once we have DOMUI views for dialogs |
| 318 SetBounds(x(), y(), size.width(), size.height()); | 319 SetBounds(x(), y(), size.width(), size.height()); |
| 319 } | 320 } |
| OLD | NEW |