| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_factory.h" | 7 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 9 #include "content/browser/renderer_host/render_widget_host_view_win.h" | 9 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 10 #include "content/browser/tab_contents/interstitial_page_impl.h" | 10 #include "content/browser/tab_contents/interstitial_page_impl.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 void TabContentsViewWin::CreateView(const gfx::Size& initial_size) { | 68 void TabContentsViewWin::CreateView(const gfx::Size& initial_size) { |
| 69 initial_size_ = initial_size; | 69 initial_size_ = initial_size; |
| 70 | 70 |
| 71 set_window_style(WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); | 71 set_window_style(WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); |
| 72 | 72 |
| 73 Init(TempParent::Get()->hwnd(), gfx::Rect(initial_size_)); | 73 Init(TempParent::Get()->hwnd(), gfx::Rect(initial_size_)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 RenderWidgetHostView* TabContentsViewWin::CreateViewForWidget( | 76 RenderWidgetHostView* TabContentsViewWin::CreateViewForWidget( |
| 77 RenderWidgetHost* render_widget_host) { | 77 content::RenderWidgetHost* render_widget_host) { |
| 78 if (render_widget_host->GetView()) { | 78 if (render_widget_host->GetView()) { |
| 79 // During testing, the view will already be set up in most cases to the | 79 // During testing, the view will already be set up in most cases to the |
| 80 // test view, so we don't want to clobber it with a real one. To verify that | 80 // test view, so we don't want to clobber it with a real one. To verify that |
| 81 // this actually is happening (and somebody isn't accidentally creating the | 81 // this actually is happening (and somebody isn't accidentally creating the |
| 82 // view twice), we check for the RVH Factory, which will be set when we're | 82 // view twice), we check for the RVH Factory, which will be set when we're |
| 83 // making special ones (which go along with the special views). | 83 // making special ones (which go along with the special views). |
| 84 DCHECK(RenderViewHostFactory::has_factory()); | 84 DCHECK(RenderViewHostFactory::has_factory()); |
| 85 return render_widget_host->GetView(); | 85 return render_widget_host->GetView(); |
| 86 } | 86 } |
| 87 | 87 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Our size matches what we want but the renderers size may not match. | 135 // Our size matches what we want but the renderers size may not match. |
| 136 // Pretend we were resized so that the renderers size is updated too. | 136 // Pretend we were resized so that the renderers size is updated too. |
| 137 if (tab_contents_->GetInterstitialPage()) | 137 if (tab_contents_->GetInterstitialPage()) |
| 138 tab_contents_->GetInterstitialPage()->SetSize(size); | 138 tab_contents_->GetInterstitialPage()->SetSize(size); |
| 139 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 139 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
| 140 if (rwhv) | 140 if (rwhv) |
| 141 rwhv->SetSize(size); | 141 rwhv->SetSize(size); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 void TabContentsViewWin::RenderViewCreated(RenderViewHost* host) { | 145 void TabContentsViewWin::RenderViewCreated(content::RenderViewHost* host) { |
| 146 } | 146 } |
| 147 | 147 |
| 148 void TabContentsViewWin::Focus() { | 148 void TabContentsViewWin::Focus() { |
| 149 if (tab_contents_->GetInterstitialPage()) { | 149 if (tab_contents_->GetInterstitialPage()) { |
| 150 tab_contents_->GetInterstitialPage()->Focus(); | 150 tab_contents_->GetInterstitialPage()->Focus(); |
| 151 return; | 151 return; |
| 152 } | 152 } |
| 153 | 153 |
| 154 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 154 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
| 155 if (rwhv) { | 155 if (rwhv) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 282 |
| 283 gfx::Size size(window_pos->cx, window_pos->cy); | 283 gfx::Size size(window_pos->cx, window_pos->cy); |
| 284 if (tab_contents_->GetInterstitialPage()) | 284 if (tab_contents_->GetInterstitialPage()) |
| 285 tab_contents_->GetInterstitialPage()->SetSize(size); | 285 tab_contents_->GetInterstitialPage()->SetSize(size); |
| 286 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 286 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
| 287 if (rwhv) | 287 if (rwhv) |
| 288 rwhv->SetSize(size); | 288 rwhv->SetSize(size); |
| 289 | 289 |
| 290 return 0; | 290 return 0; |
| 291 } | 291 } |
| OLD | NEW |