| 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/interstitial_page.h" | 9 #include "content/browser/tab_contents/interstitial_page.h" |
| 10 #include "content/browser/tab_contents/tab_contents.h" | 10 #include "content/browser/tab_contents/tab_contents.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 POINT point = { r.left, r.top }; | 67 POINT point = { r.left, r.top }; |
| 68 ClientToScreen(hwnd(), &point); | 68 ClientToScreen(hwnd(), &point); |
| 69 *out = gfx::Rect(point.x, point.y, r.right - r.left, r.bottom - r.top); | 69 *out = gfx::Rect(point.x, point.y, r.right - r.left, r.bottom - r.top); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void TabContentsViewWin::SetPageTitle(const string16& title) { | 72 void TabContentsViewWin::SetPageTitle(const string16& title) { |
| 73 } | 73 } |
| 74 | 74 |
| 75 void TabContentsViewWin::OnTabCrashed(base::TerminationStatus status, | 75 void TabContentsViewWin::OnTabCrashed(base::TerminationStatus status, |
| 76 int error_code) { | 76 int error_code) { |
| 77 // TODO(avi): No other TCV implementation does anything in this callback. Can |
| 78 // this be moved elsewhere so that |OnTabCrashed| can be removed everywhere? |
| 77 view_ = NULL; | 79 view_ = NULL; |
| 78 } | 80 } |
| 79 | 81 |
| 80 void TabContentsViewWin::SizeContents(const gfx::Size& size) { | 82 void TabContentsViewWin::SizeContents(const gfx::Size& size) { |
| 81 gfx::Rect bounds; | 83 gfx::Rect bounds; |
| 82 GetContainerBounds(&bounds); | 84 GetContainerBounds(&bounds); |
| 83 if (bounds.size() != size) { | 85 if (bounds.size() != size) { |
| 84 SetWindowPos(hwnd(), NULL, 0, 0, size.width(), size.height(), | 86 SetWindowPos(hwnd(), NULL, 0, 0, size.width(), size.height(), |
| 85 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); | 87 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); |
| 86 } else { | 88 } else { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 142 |
| 141 void TabContentsViewWin::CloseTabAfterEventTracking() { | 143 void TabContentsViewWin::CloseTabAfterEventTracking() { |
| 142 } | 144 } |
| 143 | 145 |
| 144 void TabContentsViewWin::GetViewBounds(gfx::Rect* out) const { | 146 void TabContentsViewWin::GetViewBounds(gfx::Rect* out) const { |
| 145 RECT r; | 147 RECT r; |
| 146 GetWindowRect(hwnd(), &r); | 148 GetWindowRect(hwnd(), &r); |
| 147 *out = gfx::Rect(r); | 149 *out = gfx::Rect(r); |
| 148 } | 150 } |
| 149 | 151 |
| 152 void TabContentsViewWin::InstallOverlayView(gfx::NativeView view) { |
| 153 NOTREACHED(); |
| 154 } |
| 155 |
| 156 void TabContentsViewWin::RemoveOverlayView() { |
| 157 NOTREACHED(); |
| 158 } |
| 159 |
| 150 void TabContentsViewWin::CreateNewWindow( | 160 void TabContentsViewWin::CreateNewWindow( |
| 151 int route_id, | 161 int route_id, |
| 152 const ViewHostMsg_CreateWindow_Params& params) { | 162 const ViewHostMsg_CreateWindow_Params& params) { |
| 153 TabContents* tab = delegate_->CreateNewWindow(this, route_id, params); | 163 TabContents* tab = delegate_->CreateNewWindow(this, route_id, params); |
| 154 | 164 |
| 155 // Copy logic from RenderViewHostDelegateViewHelper. | 165 // Copy logic from RenderViewHostDelegateViewHelper. |
| 156 TabContentsView* new_view = tab->view(); | 166 TabContentsView* new_view = tab->view(); |
| 157 new_view->CreateViewForWidget(tab->render_view_host()); | 167 new_view->CreateViewForWidget(tab->render_view_host()); |
| 158 pending_contents_[route_id] = tab->render_view_host(); | 168 pending_contents_[route_id] = tab->render_view_host(); |
| 159 } | 169 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 243 |
| 234 gfx::Size size(window_pos->cx, window_pos->cy); | 244 gfx::Size size(window_pos->cx, window_pos->cy); |
| 235 if (tab_contents_->interstitial_page()) | 245 if (tab_contents_->interstitial_page()) |
| 236 tab_contents_->interstitial_page()->SetSize(size); | 246 tab_contents_->interstitial_page()->SetSize(size); |
| 237 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 247 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
| 238 if (rwhv) | 248 if (rwhv) |
| 239 rwhv->SetSize(size); | 249 rwhv->SetSize(size); |
| 240 | 250 |
| 241 return 0; | 251 return 0; |
| 242 } | 252 } |
| OLD | NEW |