| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 tab_contents()->interstitial_page()->Focus(); | 154 tab_contents()->interstitial_page()->Focus(); |
| 155 return; | 155 return; |
| 156 } | 156 } |
| 157 | 157 |
| 158 if (tab_contents()->is_crashed() && sad_tab_ != NULL) { | 158 if (tab_contents()->is_crashed() && sad_tab_ != NULL) { |
| 159 sad_tab_->RequestFocus(); | 159 sad_tab_->RequestFocus(); |
| 160 return; | 160 return; |
| 161 } | 161 } |
| 162 | 162 |
| 163 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); | 163 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); |
| 164 gtk_widget_grab_focus(rwhv ? rwhv->GetNativeView() : GetNativeView()); | 164 if (rwhv) |
| 165 rwhv->Focus(); |
| 165 } | 166 } |
| 166 | 167 |
| 167 void TabContentsViewViews::SetInitialFocus() { | 168 void TabContentsViewViews::SetInitialFocus() { |
| 168 if (tab_contents()->FocusLocationBarByDefault()) | 169 if (tab_contents()->FocusLocationBarByDefault()) |
| 169 tab_contents()->SetFocusToLocationBar(false); | 170 tab_contents()->SetFocusToLocationBar(false); |
| 170 else | 171 else |
| 171 Focus(); | 172 Focus(); |
| 172 } | 173 } |
| 173 | 174 |
| 174 void TabContentsViewViews::StoreFocus() { | 175 void TabContentsViewViews::StoreFocus() { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 rwhv->SetSize(size); | 317 rwhv->SetSize(size); |
| 317 | 318 |
| 318 if (needs_resize) | 319 if (needs_resize) |
| 319 SetFloatingPosition(size); | 320 SetFloatingPosition(size); |
| 320 } | 321 } |
| 321 | 322 |
| 322 void TabContentsViewViews::SetFloatingPosition(const gfx::Size& size) { | 323 void TabContentsViewViews::SetFloatingPosition(const gfx::Size& size) { |
| 323 // TODO(anicolao): rework this once we have DOMUI views for dialogs | 324 // TODO(anicolao): rework this once we have DOMUI views for dialogs |
| 324 SetBounds(x(), y(), size.width(), size.height()); | 325 SetBounds(x(), y(), size.width(), size.height()); |
| 325 } | 326 } |
| OLD | NEW |