OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "views/window/window.h" |
6 | 6 |
7 #include "app/gfx/font_util.h" | |
8 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
9 #include "base/string_util.h" | 8 #include "base/string_util.h" |
10 #include "gfx/font.h" | 9 #include "gfx/font.h" |
11 #include "gfx/size.h" | 10 #include "gfx/size.h" |
| 11 #include "ui/base/l10n/l10n_font_util.h" |
12 #include "views/widget/widget.h" | 12 #include "views/widget/widget.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 // static | 16 // static |
17 int Window::GetLocalizedContentsWidth(int col_resource_id) { | 17 int Window::GetLocalizedContentsWidth(int col_resource_id) { |
18 return gfx::GetLocalizedContentsWidthForFont(col_resource_id, | 18 return ui::GetLocalizedContentsWidthForFont(col_resource_id, |
19 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); | 19 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); |
20 } | 20 } |
21 | 21 |
22 // static | 22 // static |
23 int Window::GetLocalizedContentsHeight(int row_resource_id) { | 23 int Window::GetLocalizedContentsHeight(int row_resource_id) { |
24 return gfx::GetLocalizedContentsHeightForFont(row_resource_id, | 24 return ui::GetLocalizedContentsHeightForFont(row_resource_id, |
25 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); | 25 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); |
26 } | 26 } |
27 | 27 |
28 // static | 28 // static |
29 gfx::Size Window::GetLocalizedContentsSize(int col_resource_id, | 29 gfx::Size Window::GetLocalizedContentsSize(int col_resource_id, |
30 int row_resource_id) { | 30 int row_resource_id) { |
31 return gfx::Size(GetLocalizedContentsWidth(col_resource_id), | 31 return gfx::Size(GetLocalizedContentsWidth(col_resource_id), |
32 GetLocalizedContentsHeight(row_resource_id)); | 32 GetLocalizedContentsHeight(row_resource_id)); |
33 } | 33 } |
34 | 34 |
35 // static | 35 // static |
36 void Window::CloseSecondaryWidget(Widget* widget) { | 36 void Window::CloseSecondaryWidget(Widget* widget) { |
37 if (!widget) | 37 if (!widget) |
38 return; | 38 return; |
39 | 39 |
40 // Close widget if it's identified as a secondary window. | 40 // Close widget if it's identified as a secondary window. |
41 Window* window = widget->GetWindow(); | 41 Window* window = widget->GetWindow(); |
42 if (window) { | 42 if (window) { |
43 if (!window->IsAppWindow()) | 43 if (!window->IsAppWindow()) |
44 window->Close(); | 44 window->Close(); |
45 } else { | 45 } else { |
46 // If it's not a Window, then close it anyway since it probably is | 46 // If it's not a Window, then close it anyway since it probably is |
47 // secondary. | 47 // secondary. |
48 widget->Close(); | 48 widget->Close(); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 } // namespace views | 52 } // namespace views |
OLD | NEW |