| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/renderer_host/render_widget_host_view_win.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/gdi_util.h" | 8 #include "app/gfx/gdi_util.h" |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/l10n_util_win.h" | 10 #include "app/l10n_util_win.h" |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 DestroyWindow(); | 623 DestroyWindow(); |
| 624 } | 624 } |
| 625 | 625 |
| 626 void RenderWidgetHostViewWin::Destroy() { | 626 void RenderWidgetHostViewWin::Destroy() { |
| 627 // We've been told to destroy. | 627 // We've been told to destroy. |
| 628 // By clearing close_on_deactivate_, we prevent further deactivations | 628 // By clearing close_on_deactivate_, we prevent further deactivations |
| 629 // (caused by windows messages resulting from the DestroyWindow) from | 629 // (caused by windows messages resulting from the DestroyWindow) from |
| 630 // triggering further destructions. The deletion of this is handled by | 630 // triggering further destructions. The deletion of this is handled by |
| 631 // OnFinalMessage(); | 631 // OnFinalMessage(); |
| 632 close_on_deactivate_ = false; | 632 close_on_deactivate_ = false; |
| 633 | |
| 634 // In case OnFinalMessage() does not get called before DestroyWindow() | |
| 635 // returns, make sure we don't try to access |render_widget_host_| later. | |
| 636 // http://crbug.com/24248 | |
| 637 render_widget_host_ = NULL; | |
| 638 | |
| 639 DestroyWindow(); | 633 DestroyWindow(); |
| 640 } | 634 } |
| 641 | 635 |
| 642 void RenderWidgetHostViewWin::SetTooltipText(const std::wstring& tooltip_text) { | 636 void RenderWidgetHostViewWin::SetTooltipText(const std::wstring& tooltip_text) { |
| 643 // Clamp the tooltip length to kMaxTooltipLength so that we don't | 637 // Clamp the tooltip length to kMaxTooltipLength so that we don't |
| 644 // accidentally DOS the user with a mega tooltip (since Windows doesn't seem | 638 // accidentally DOS the user with a mega tooltip (since Windows doesn't seem |
| 645 // to do this itself). | 639 // to do this itself). |
| 646 const std::wstring& new_tooltip_text = | 640 const std::wstring& new_tooltip_text = |
| 647 l10n_util::TruncateString(tooltip_text, kMaxTooltipLength); | 641 l10n_util::TruncateString(tooltip_text, kMaxTooltipLength); |
| 648 | 642 |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 | 1259 |
| 1266 // Create a reference to BrowserAccessibility which MSAA will marshall to | 1260 // Create a reference to BrowserAccessibility which MSAA will marshall to |
| 1267 // the client. | 1261 // the client. |
| 1268 reference_result = LresultFromObject(IID_IAccessible, wparam, | 1262 reference_result = LresultFromObject(IID_IAccessible, wparam, |
| 1269 static_cast<IAccessible*>(browser_accessibility_root_)); | 1263 static_cast<IAccessible*>(browser_accessibility_root_)); |
| 1270 } | 1264 } |
| 1271 return reference_result; | 1265 return reference_result; |
| 1272 } | 1266 } |
| 1273 | 1267 |
| 1274 void RenderWidgetHostViewWin::OnFinalMessage(HWND window) { | 1268 void RenderWidgetHostViewWin::OnFinalMessage(HWND window) { |
| 1275 if (render_widget_host_) | 1269 render_widget_host_->ViewDestroyed(); |
| 1276 render_widget_host_->ViewDestroyed(); | |
| 1277 delete this; | 1270 delete this; |
| 1278 } | 1271 } |
| 1279 | 1272 |
| 1280 void RenderWidgetHostViewWin::TrackMouseLeave(bool track) { | 1273 void RenderWidgetHostViewWin::TrackMouseLeave(bool track) { |
| 1281 if (track == track_mouse_leave_) | 1274 if (track == track_mouse_leave_) |
| 1282 return; | 1275 return; |
| 1283 track_mouse_leave_ = track; | 1276 track_mouse_leave_ = track; |
| 1284 | 1277 |
| 1285 DCHECK(m_hWnd); | 1278 DCHECK(m_hWnd); |
| 1286 | 1279 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 // WM_LBUTTONDOWN. | 1349 // WM_LBUTTONDOWN. |
| 1357 SetFocus(); | 1350 SetFocus(); |
| 1358 } | 1351 } |
| 1359 } | 1352 } |
| 1360 | 1353 |
| 1361 void RenderWidgetHostViewWin::ShutdownHost() { | 1354 void RenderWidgetHostViewWin::ShutdownHost() { |
| 1362 shutdown_factory_.RevokeAll(); | 1355 shutdown_factory_.RevokeAll(); |
| 1363 render_widget_host_->Shutdown(); | 1356 render_widget_host_->Shutdown(); |
| 1364 // Do not touch any members at this point, |this| has been deleted. | 1357 // Do not touch any members at this point, |this| has been deleted. |
| 1365 } | 1358 } |
| OLD | NEW |