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

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

Issue 12895: Chromium-MultiProfile-Prototype... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years 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 | « chrome/views/window.h ('k') | no next file » | 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) 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 DestroyIcon(old_icon); 194 DestroyIcon(old_icon);
195 } 195 }
196 } 196 }
197 197
198 void Window::ExecuteSystemMenuCommand(int command) { 198 void Window::ExecuteSystemMenuCommand(int command) {
199 if (command) 199 if (command)
200 SendMessage(GetHWND(), WM_SYSCOMMAND, command, 0); 200 SendMessage(GetHWND(), WM_SYSCOMMAND, command, 0);
201 } 201 }
202 202
203 // static 203 // static
204 int Window::GetLocalizedContentsWidth(int col_resource_id) {
205 double chars = _wtof(l10n_util::GetString(col_resource_id).c_str());
206 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
207 ChromeFont font = rb.GetFont(ResourceBundle::BaseFont);
208 int width = font.GetExpectedTextWidth(static_cast<int>(chars));
209 DCHECK(width > 0);
210 return width;
211 }
212
213 // static
214 int Window::GetLocalizedContentsHeight(int row_resource_id) {
215 double lines = _wtof(l10n_util::GetString(row_resource_id).c_str());
216 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
217 ChromeFont font = rb.GetFont(ResourceBundle::BaseFont);
218 int height = static_cast<int>(font.height() * lines);
219 DCHECK(height > 0);
220 return height;
221 }
222
223 // static
204 gfx::Size Window::GetLocalizedContentsSize(int col_resource_id, 224 gfx::Size Window::GetLocalizedContentsSize(int col_resource_id,
205 int row_resource_id) { 225 int row_resource_id) {
206 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 226 return gfx::Size(GetLocalizedContentsWidth(col_resource_id),
207 ChromeFont font = rb.GetFont(ResourceBundle::BaseFont); 227 GetLocalizedContentsHeight(row_resource_id));
208
209 double chars = _wtof(l10n_util::GetString(col_resource_id).c_str());
210 double lines = _wtof(l10n_util::GetString(row_resource_id).c_str());
211
212 int width = font.GetExpectedTextWidth(static_cast<int>(chars));
213 int height = static_cast<int>(font.height() * lines);
214
215 DCHECK(width > 0 && height > 0);
216
217 return gfx::Size(width, height);
218 } 228 }
219 229
220 /////////////////////////////////////////////////////////////////////////////// 230 ///////////////////////////////////////////////////////////////////////////////
221 // Window, protected: 231 // Window, protected:
222 232
223 Window::Window(WindowDelegate* window_delegate) 233 Window::Window(WindowDelegate* window_delegate)
224 : WidgetWin(), 234 : WidgetWin(),
225 focus_on_creation_(true), 235 focus_on_creation_(true),
226 window_delegate_(window_delegate), 236 window_delegate_(window_delegate),
227 non_client_view_(NULL), 237 non_client_view_(NULL),
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 void Window::InitClass() { 628 void Window::InitClass() {
619 static bool initialized = false; 629 static bool initialized = false;
620 if (!initialized) { 630 if (!initialized) {
621 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE); 631 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE);
622 initialized = true; 632 initialized = true;
623 } 633 }
624 } 634 }
625 635
626 } // namespace views 636 } // namespace views
627 637
OLDNEW
« no previous file with comments | « chrome/views/window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698