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

Unified Diff: chrome_frame/infobars/internal/displaced_window.cc

Issue 4766003: Preview CL for adding an Infobar facility to Google Chrome Frame.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_frame/infobars/internal/displaced_window.h ('k') | chrome_frame/infobars/internal/host_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/infobars/internal/displaced_window.cc
===================================================================
--- chrome_frame/infobars/internal/displaced_window.cc (revision 0)
+++ chrome_frame/infobars/internal/displaced_window.cc (revision 0)
@@ -0,0 +1,42 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome_frame/infobars/internal/displaced_window.h"
+
+DisplacedWindowManager::DisplacedWindowManager() {
+}
+
+void DisplacedWindowManager::UpdateLayout() {
+ // Call SetWindowPos with SWP_FRAMECHANGED for displaced window.
+ // Displaced window will receive WM_NCCALCSIZE to recalculate its client size.
+ ::SetWindowPos(m_hWnd,
+ NULL, 0, 0, 0, 0,
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
+ SWP_FRAMECHANGED);
+}
+
+LRESULT DisplacedWindowManager::OnNcCalcSize(BOOL calc_valid_rects,
+ LPARAM lparam) {
+ // Ask the original window proc to calculate the 'natural' size of the window.
+ LRESULT ret = DefWindowProc(WM_NCCALCSIZE,
+ static_cast<WPARAM>(calc_valid_rects), lparam);
+ if (lparam == NULL)
+ return ret;
+
+ // Whether calc_valid_rects is true or false, we could treat beginning of
+ // lparam as a RECT object.
+ RECT* rect = reinterpret_cast<RECT*>(lparam);
+ RECT natural_rect = *rect;
+ if (delegate() != NULL)
+ delegate()->AdjustDisplacedWindowDimensions(rect);
+
+ // If we modified the window's dimensions, there is no way to respect a custom
+ // "client-area preservation strategy", so we must force a redraw to be safe.
+ if (calc_valid_rects && ret == WVR_VALIDRECTS &&
+ !EqualRect(&natural_rect, rect)) {
+ ret = WVR_REDRAW;
+ }
+
+ return ret;
+}
Property changes on: chrome_frame\infobars\internal\displaced_window.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome_frame/infobars/internal/displaced_window.h ('k') | chrome_frame/infobars/internal/host_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698