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 "views/window/window_gtk.h" | 5 #include "views/window/window_gtk.h" |
6 | 6 |
7 #include "app/gfx/path.h" | 7 #include "app/gfx/path.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
10 #include "views/screen.h" | 10 #include "views/screen.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 const gfx::Rect& bounds, | 83 const gfx::Rect& bounds, |
84 WindowDelegate* window_delegate) { | 84 WindowDelegate* window_delegate) { |
85 WindowGtk* window = new WindowGtk(window_delegate); | 85 WindowGtk* window = new WindowGtk(window_delegate); |
86 window->GetNonClientView()->SetFrameView(window->CreateFrameViewForWindow()); | 86 window->GetNonClientView()->SetFrameView(window->CreateFrameViewForWindow()); |
87 window->Init(parent, bounds); | 87 window->Init(parent, bounds); |
88 return window; | 88 return window; |
89 } | 89 } |
90 | 90 |
91 // static | 91 // static |
92 void Window::CloseAllSecondaryWindows() { | 92 void Window::CloseAllSecondaryWindows() { |
93 for (GList* window = gtk_window_list_toplevels(); window; | 93 GList* windows = gtk_window_list_toplevels(); |
| 94 for (GList* window = windows; window; |
94 window = g_list_next(window)) { | 95 window = g_list_next(window)) { |
95 Window::CloseSecondaryWidget( | 96 Window::CloseSecondaryWidget( |
96 WidgetGtk::GetViewForNative(GTK_WIDGET(window->data))); | 97 WidgetGtk::GetViewForNative(GTK_WIDGET(window->data))); |
97 } | 98 } |
| 99 g_list_free(windows); |
98 } | 100 } |
99 | 101 |
100 gfx::Rect WindowGtk::GetBounds() const { | 102 gfx::Rect WindowGtk::GetBounds() const { |
101 gfx::Rect bounds; | 103 gfx::Rect bounds; |
102 WidgetGtk::GetBounds(&bounds, true); | 104 WidgetGtk::GetBounds(&bounds, true); |
103 return bounds; | 105 return bounds; |
104 } | 106 } |
105 | 107 |
106 gfx::Rect WindowGtk::GetNormalBounds() const { | 108 gfx::Rect WindowGtk::GetNormalBounds() const { |
107 // We currently don't support tiling, so this doesn't matter. | 109 // We currently don't support tiling, so this doesn't matter. |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 center_rect = Screen::GetMonitorWorkAreaNearestWindow(GetNativeWindow()); | 456 center_rect = Screen::GetMonitorWorkAreaNearestWindow(GetNativeWindow()); |
455 } | 457 } |
456 gfx::Size size = non_client_view_->GetPreferredSize(); | 458 gfx::Size size = non_client_view_->GetPreferredSize(); |
457 gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2, | 459 gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2, |
458 center_rect.y() + (center_rect.height() - size.height()) / 2, | 460 center_rect.y() + (center_rect.height() - size.height()) / 2, |
459 size.width(), size.height()); | 461 size.width(), size.height()); |
460 SetBounds(bounds, NULL); | 462 SetBounds(bounds, NULL); |
461 } | 463 } |
462 | 464 |
463 } // namespace views | 465 } // namespace views |
OLD | NEW |