| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/window.h" | 5 #include "chrome/views/window.h" |
| 6 | 6 |
| 7 #include "base/win_util.h" | 7 #include "base/win_util.h" |
| 8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
| 9 #include "chrome/common/gfx/chrome_font.h" | 9 #include "chrome/common/gfx/chrome_font.h" |
| 10 #include "chrome/common/gfx/icon_util.h" | 10 #include "chrome/common/gfx/icon_util.h" |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 DWORD Window::CalculateWindowExStyle() { | 630 DWORD Window::CalculateWindowExStyle() { |
| 631 DWORD window_ex_styles = 0; | 631 DWORD window_ex_styles = 0; |
| 632 if (window_delegate_->AsDialogDelegate()) | 632 if (window_delegate_->AsDialogDelegate()) |
| 633 window_ex_styles |= WS_EX_DLGMODALFRAME; | 633 window_ex_styles |= WS_EX_DLGMODALFRAME; |
| 634 if (window_delegate_->IsAlwaysOnTop()) | 634 if (window_delegate_->IsAlwaysOnTop()) |
| 635 window_ex_styles |= WS_EX_TOPMOST; | 635 window_ex_styles |= WS_EX_TOPMOST; |
| 636 return window_ex_styles; | 636 return window_ex_styles; |
| 637 } | 637 } |
| 638 | 638 |
| 639 void Window::SaveWindowPosition() { | 639 void Window::SaveWindowPosition() { |
| 640 // The window delegate does the actual saving for us. It seems like (judging |
| 641 // by go/crash) that in some circumstances we can end up here after |
| 642 // WM_DESTROY, at which point the window delegate is likely gone. So just |
| 643 // bail. |
| 644 if (!window_delegate_) |
| 645 return; |
| 646 |
| 640 WINDOWPLACEMENT win_placement = { 0 }; | 647 WINDOWPLACEMENT win_placement = { 0 }; |
| 641 win_placement.length = sizeof(WINDOWPLACEMENT); | 648 win_placement.length = sizeof(WINDOWPLACEMENT); |
| 642 | 649 |
| 643 BOOL r = GetWindowPlacement(GetHWND(), &win_placement); | 650 BOOL r = GetWindowPlacement(GetHWND(), &win_placement); |
| 644 DCHECK(r); | 651 DCHECK(r); |
| 645 | 652 |
| 646 bool maximized = (win_placement.showCmd == SW_SHOWMAXIMIZED); | 653 bool maximized = (win_placement.showCmd == SW_SHOWMAXIMIZED); |
| 647 CRect window_bounds(win_placement.rcNormalPosition); | 654 CRect window_bounds(win_placement.rcNormalPosition); |
| 648 window_delegate_->SaveWindowPlacement( | 655 window_delegate_->SaveWindowPlacement( |
| 649 gfx::Rect(win_placement.rcNormalPosition), maximized, is_always_on_top_); | 656 gfx::Rect(win_placement.rcNormalPosition), maximized, is_always_on_top_); |
| 650 } | 657 } |
| 651 | 658 |
| 652 void Window::InitClass() { | 659 void Window::InitClass() { |
| 653 static bool initialized = false; | 660 static bool initialized = false; |
| 654 if (!initialized) { | 661 if (!initialized) { |
| 655 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE); | 662 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE); |
| 656 initialized = true; | 663 initialized = true; |
| 657 } | 664 } |
| 658 } | 665 } |
| 659 | 666 |
| 660 } // namespace views | 667 } // namespace views |
| 661 | 668 |
| OLD | NEW |