| 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 // TODO(beng): some day make this unfortunate dependency not exist. | 9 // TODO(beng): some day make this unfortunate dependency not exist. |
| 10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 DWORD Window::CalculateWindowExStyle() { | 594 DWORD Window::CalculateWindowExStyle() { |
| 595 DWORD window_ex_styles = 0; | 595 DWORD window_ex_styles = 0; |
| 596 if (window_delegate_->AsDialogDelegate()) | 596 if (window_delegate_->AsDialogDelegate()) |
| 597 window_ex_styles |= WS_EX_DLGMODALFRAME; | 597 window_ex_styles |= WS_EX_DLGMODALFRAME; |
| 598 if (window_delegate_->IsAlwaysOnTop()) | 598 if (window_delegate_->IsAlwaysOnTop()) |
| 599 window_ex_styles |= WS_EX_TOPMOST; | 599 window_ex_styles |= WS_EX_TOPMOST; |
| 600 return window_ex_styles; | 600 return window_ex_styles; |
| 601 } | 601 } |
| 602 | 602 |
| 603 void Window::SaveWindowPosition() { | 603 void Window::SaveWindowPosition() { |
| 604 if(!window_delegate_) |
| 605 return; |
| 606 |
| 604 WINDOWPLACEMENT win_placement = { 0 }; | 607 WINDOWPLACEMENT win_placement = { 0 }; |
| 605 win_placement.length = sizeof(WINDOWPLACEMENT); | 608 win_placement.length = sizeof(WINDOWPLACEMENT); |
| 606 | 609 |
| 607 BOOL r = GetWindowPlacement(GetHWND(), &win_placement); | 610 BOOL r = GetWindowPlacement(GetHWND(), &win_placement); |
| 608 DCHECK(r); | 611 DCHECK(r); |
| 609 | 612 |
| 610 bool maximized = (win_placement.showCmd == SW_SHOWMAXIMIZED); | 613 bool maximized = (win_placement.showCmd == SW_SHOWMAXIMIZED); |
| 611 CRect window_bounds(win_placement.rcNormalPosition); | 614 CRect window_bounds(win_placement.rcNormalPosition); |
| 612 window_delegate_->SaveWindowPlacement( | 615 window_delegate_->SaveWindowPlacement( |
| 613 gfx::Rect(win_placement.rcNormalPosition), maximized, is_always_on_top_); | 616 gfx::Rect(win_placement.rcNormalPosition), maximized, is_always_on_top_); |
| 614 } | 617 } |
| 615 | 618 |
| 616 void Window::InitClass() { | 619 void Window::InitClass() { |
| 617 static bool initialized = false; | 620 static bool initialized = false; |
| 618 if (!initialized) { | 621 if (!initialized) { |
| 619 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE); | 622 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE); |
| 620 initialized = true; | 623 initialized = true; |
| 621 } | 624 } |
| 622 } | 625 } |
| 623 | 626 |
| 624 } // namespace views | 627 } // namespace views |
| 625 | 628 |
| OLD | NEW |