Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: views/window/window.cc

Issue 197063: Implements WindowGtk::CloseAllSecondaryWindows. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/window/window.h ('k') | views/window/window_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "views/window/window.h" 5 #include "views/window/window.h"
6 6
7 #include "app/gfx/font.h" 7 #include "app/gfx/font.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "base/gfx/size.h" 10 #include "base/gfx/size.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "views/widget/widget.h"
12 13
13 namespace views { 14 namespace views {
14 15
15 // static 16 // static
16 int Window::GetLocalizedContentsWidth(int col_resource_id) { 17 int Window::GetLocalizedContentsWidth(int col_resource_id) {
17 double chars = 0; 18 double chars = 0;
18 StringToDouble(WideToUTF8(l10n_util::GetString(col_resource_id)), &chars); 19 StringToDouble(WideToUTF8(l10n_util::GetString(col_resource_id)), &chars);
19 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 20 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
20 gfx::Font font = rb.GetFont(ResourceBundle::BaseFont); 21 gfx::Font font = rb.GetFont(ResourceBundle::BaseFont);
21 int width = font.GetExpectedTextWidth(static_cast<int>(chars)); 22 int width = font.GetExpectedTextWidth(static_cast<int>(chars));
(...skipping 12 matching lines...) Expand all
34 return height; 35 return height;
35 } 36 }
36 37
37 // static 38 // static
38 gfx::Size Window::GetLocalizedContentsSize(int col_resource_id, 39 gfx::Size Window::GetLocalizedContentsSize(int col_resource_id,
39 int row_resource_id) { 40 int row_resource_id) {
40 return gfx::Size(GetLocalizedContentsWidth(col_resource_id), 41 return gfx::Size(GetLocalizedContentsWidth(col_resource_id),
41 GetLocalizedContentsHeight(row_resource_id)); 42 GetLocalizedContentsHeight(row_resource_id));
42 } 43 }
43 44
45 // static
46 void Window::CloseSecondaryWidget(Widget* widget) {
47 if (!widget)
48 return;
49
50 // Close widget if it's identified as a secondary window.
51 Window* window = widget->GetWindow();
52 if (window) {
53 if (!window->IsAppWindow())
54 window->Close();
55 } else {
56 // If it's not a Window, then close it anyway since it probably is
57 // secondary.
58 widget->Close();
59 }
60 }
61
44 } // namespace views 62 } // namespace views
OLDNEW
« no previous file with comments | « views/window/window.h ('k') | views/window/window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698