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

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

Issue 7344: Convert GetPreferredSize from:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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
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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 client_view_ = client_view; 318 client_view_ = client_view;
319 if (non_client_view_) { 319 if (non_client_view_) {
320 // This will trigger the ClientView to be added by the non-client view. 320 // This will trigger the ClientView to be added by the non-client view.
321 HWNDViewContainer::SetContentsView(non_client_view_); 321 HWNDViewContainer::SetContentsView(non_client_view_);
322 } else { 322 } else {
323 HWNDViewContainer::SetContentsView(client_view_); 323 HWNDViewContainer::SetContentsView(client_view_);
324 } 324 }
325 } 325 }
326 326
327 void Window::SizeWindowToDefault() { 327 void Window::SizeWindowToDefault() {
328 CSize pref(0, 0); 328 gfx::Size pref;
329 if (non_client_view_) { 329 if (non_client_view_) {
330 non_client_view_->GetPreferredSize(&pref); 330 pref = non_client_view_->GetPreferredSize();
331 } else { 331 } else {
332 client_view_->GetPreferredSize(&pref); 332 pref = client_view_->GetPreferredSize();
333 } 333 }
334 DCHECK(pref.cx > 0 && pref.cy > 0); 334 DCHECK(pref.width() > 0 && pref.height() > 0);
335 // CenterAndSizeWindow adjusts the window size to accommodate the non-client 335 // CenterAndSizeWindow adjusts the window size to accommodate the non-client
336 // area. 336 // area.
337 win_util::CenterAndSizeWindow(owning_window(), GetHWND(), pref, true); 337 win_util::CenterAndSizeWindow(owning_window(), GetHWND(), pref.ToSIZE(),
338 true);
338 } 339 }
339 340
340 void Window::RunSystemMenu(const CPoint& point) { 341 void Window::RunSystemMenu(const CPoint& point) {
341 // We need to reset and clean up any currently created system menu objects. 342 // We need to reset and clean up any currently created system menu objects.
342 // We need to call this otherwise there's a small chance that we aren't going 343 // We need to call this otherwise there's a small chance that we aren't going
343 // to get a system menu. We also can't take the return value of this 344 // to get a system menu. We also can't take the return value of this
344 // function. We need to call it *again* to get a valid HMENU. 345 // function. We need to call it *again* to get a valid HMENU.
345 ::GetSystemMenu(GetHWND(), TRUE); 346 ::GetSystemMenu(GetHWND(), TRUE);
346 HMENU system_menu = ::GetSystemMenu(GetHWND(), FALSE); 347 HMENU system_menu = ::GetSystemMenu(GetHWND(), FALSE);
347 int id = ::TrackPopupMenu(system_menu, 348 int id = ::TrackPopupMenu(system_menu,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 void Window::InitClass() { 658 void Window::InitClass() {
658 static bool initialized = false; 659 static bool initialized = false;
659 if (!initialized) { 660 if (!initialized) {
660 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE); 661 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE);
661 initialized = true; 662 initialized = true;
662 } 663 }
663 } 664 }
664 665
665 } // namespace ChromeViews 666 } // namespace ChromeViews
666 667
OLDNEW
« chrome/browser/views/download_shelf_view.cc ('K') | « chrome/views/view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698