| 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 "content/browser/tab_contents/tab_contents_view_win.h" | 5 #include "content/browser/tab_contents/tab_contents_view_win.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_view_host.h" | 7 #include "content/browser/renderer_host/render_view_host.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_view_win.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 9 #include "content/browser/tab_contents/constrained_window.h" | |
| 10 #include "content/browser/tab_contents/interstitial_page.h" | 9 #include "content/browser/tab_contents/interstitial_page.h" |
| 11 #include "content/browser/tab_contents/tab_contents.h" | 10 #include "content/browser/tab_contents/tab_contents.h" |
| 12 #include "content/browser/tab_contents/tab_contents_delegate.h" | 11 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 13 #include "content/browser/tab_contents/tab_contents_view_win_delegate.h" | 12 #include "content/browser/tab_contents/tab_contents_view_win_delegate.h" |
| 14 | 13 |
| 15 TabContentsViewWin::TabContentsViewWin(TabContents* tab_contents, | 14 TabContentsViewWin::TabContentsViewWin(TabContents* tab_contents, |
| 16 TabContentsViewWinDelegate* delegate) | 15 TabContentsViewWinDelegate* delegate) |
| 17 : parent_(NULL), | 16 : parent_(NULL), |
| 18 tab_contents_(tab_contents), | 17 tab_contents_(tab_contents), |
| 19 delegate_(delegate), | 18 delegate_(delegate), |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 95 |
| 97 void TabContentsViewWin::RenderViewCreated(RenderViewHost* host) { | 96 void TabContentsViewWin::RenderViewCreated(RenderViewHost* host) { |
| 98 } | 97 } |
| 99 | 98 |
| 100 void TabContentsViewWin::Focus() { | 99 void TabContentsViewWin::Focus() { |
| 101 if (tab_contents_->interstitial_page()) { | 100 if (tab_contents_->interstitial_page()) { |
| 102 tab_contents_->interstitial_page()->Focus(); | 101 tab_contents_->interstitial_page()->Focus(); |
| 103 return; | 102 return; |
| 104 } | 103 } |
| 105 | 104 |
| 106 if (tab_contents_->constrained_window_count() > 0) { | |
| 107 ConstrainedWindow* window = *tab_contents_->constrained_window_begin(); | |
| 108 DCHECK(window); | |
| 109 window->FocusConstrainedWindow(); | |
| 110 return; | |
| 111 } | |
| 112 | |
| 113 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 105 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
| 114 if (rwhv) { | 106 if (rwhv) { |
| 115 rwhv->Focus(); | 107 rwhv->Focus(); |
| 116 } else { | 108 } else { |
| 117 SetFocus(hwnd()); | 109 SetFocus(hwnd()); |
| 118 } | 110 } |
| 119 } | 111 } |
| 120 | 112 |
| 121 void TabContentsViewWin::SetInitialFocus() { | 113 void TabContentsViewWin::SetInitialFocus() { |
| 122 if (tab_contents_->FocusLocationBarByDefault()) | 114 if (tab_contents_->FocusLocationBarByDefault()) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 233 |
| 242 gfx::Size size(window_pos->cx, window_pos->cy); | 234 gfx::Size size(window_pos->cx, window_pos->cy); |
| 243 if (tab_contents_->interstitial_page()) | 235 if (tab_contents_->interstitial_page()) |
| 244 tab_contents_->interstitial_page()->SetSize(size); | 236 tab_contents_->interstitial_page()->SetSize(size); |
| 245 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 237 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
| 246 if (rwhv) | 238 if (rwhv) |
| 247 rwhv->SetSize(size); | 239 rwhv->SetSize(size); |
| 248 | 240 |
| 249 return 0; | 241 return 0; |
| 250 } | 242 } |
| OLD | NEW |